Skip to content
Snippets Groups Projects
Commit 35b4de8b authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Update data names

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