Commit 35b4de8b authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Update data names

parent 871123b8
......@@ -18,9 +18,9 @@ void particle_print(const struct particle *p) {
printf("Mass: %g\n", p->mass);
printf("Time: %g\n", p->time);
printf("Cutoff Radius: %g\n", p->h);
printf("Position: (%g, %g, %g)\n", p->pos[0], p->pos[1], p->pos[2]);
printf("Velocity: (%g, %g, %g)\n", p->vel[0], p->vel[1], p->vel[2]);
printf("Acceleration: (%g, %g, %g)\n", p->acc[0], p->acc[1], p->acc[2]);
printf("Positions: (%g, %g, %g)\n", p->pos[0], p->pos[1], p->pos[2]);
printf("Velocities: (%g, %g, %g)\n", p->vel[0], p->vel[1], p->vel[2]);
printf("Accelerations: (%g, %g, %g)\n", p->acc[0], p->acc[1], p->acc[2]);
printf("Entropy: %g\n", p->entropy);
printf("Density: %g\n", p->density);
}
......@@ -72,15 +72,15 @@ int particle_read_field(struct particle *part, void *map, size_t *offset,
const char *field, const size_t size) {
void *p = NULL;
if (strcmp("position", field) == 0) {
if (strcmp("positions", field) == 0) {
p = &part->pos;
} else if (strcmp("velocity", field) == 0) {
} else if (strcmp("velocities", field) == 0) {
p = &part->vel;
} else if (strcmp("acceleration", field) == 0) {
} else if (strcmp("accelerations", field) == 0) {
p = &part->acc;
} else if (strcmp("entropy", field) == 0) {
p = &part->entropy;
} else if (strcmp("cutoff radius", field) == 0) {
} else if (strcmp("smoothing length", field) == 0) {
p = &part->h;
} else if (strcmp("density", field) == 0) {
p = &part->density;
......
......@@ -93,15 +93,15 @@ static PyObject *loadFromIndex(__attribute__((unused)) PyObject *self,
dim[1] = DIM;
/* init output */
if (header_is_present(&h, "position")) {
if (header_is_present(&h, "positions")) {
pos = (PyArrayObject *)PyArray_SimpleNew(2, dim, NPY_DOUBLE);
}
if (header_is_present(&h, "velocity")) {
if (header_is_present(&h, "velocities")) {
vel = (PyArrayObject *)PyArray_SimpleNew(2, dim, NPY_FLOAT);
}
if (header_is_present(&h, "acceleration")) {
if (header_is_present(&h, "accelerations")) {
acc = (PyArrayObject *)PyArray_SimpleNew(2, dim, NPY_FLOAT);
}
......@@ -110,7 +110,7 @@ static PyObject *loadFromIndex(__attribute__((unused)) PyObject *self,
(PyArrayObject *)PyArray_SimpleNew(1, PyArray_DIMS(offset), NPY_FLOAT);
}
if (header_is_present(&h, "cutoff radius")) {
if (header_is_present(&h, "smoothing length")) {
h_sph =
(PyArrayObject *)PyArray_SimpleNew(1, PyArray_DIMS(offset), NPY_FLOAT);
}
......@@ -196,16 +196,16 @@ static PyObject *loadFromIndex(__attribute__((unused)) PyObject *self,
/* construct return */
PyObject *dict = PyDict_New();
PyObject *key = PyUnicode_FromString("position");
PyObject *key = PyUnicode_FromString("positions");
PyDict_SetItem(dict, key, PyArray_Return(pos));
if (vel) {
key = PyUnicode_FromString("velocity");
key = PyUnicode_FromString("velocities");
PyDict_SetItem(dict, key, PyArray_Return(vel));
}
if (acc) {
key = PyUnicode_FromString("acceleration");
key = PyUnicode_FromString("accelerations");
PyDict_SetItem(dict, key, PyArray_Return(acc));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment