diff --git a/src/gravity/Default/gravity_io.h b/src/gravity/Default/gravity_io.h index cbeca755016bc28fd51f06a806d37cd944a155cc..82472c6b5d35c9e23f78b8d2a85ba4f84107f180 100644 --- a/src/gravity/Default/gravity_io.h +++ b/src/gravity/Default/gravity_io.h @@ -24,23 +24,26 @@ * @param N The number of particles on that MPI rank. * @param N_total The total number of particles (only used in MPI mode) * @param offset The offset of the particles for this MPI rank (only used in MPI - *mode) + * mode) * @param gparts The particle array + * @param internal_units The #UnitSystem used internally + * @param ic_units The #UnitSystem used in the snapshots * */ __attribute__((always_inline)) INLINE static void darkmatter_read_particles( hid_t h_grp, int N, long long N_total, long long offset, - struct gpart* gparts) { + struct gpart* gparts, const struct UnitSystem* internal_units, + struct UnitSystem* ic_units) { /* Read arrays */ readArray(h_grp, "Coordinates", DOUBLE, N, 3, gparts, N_total, offset, x, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_LENGTH); readArray(h_grp, "Masses", FLOAT, N, 1, gparts, N_total, offset, mass, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_MASS); readArray(h_grp, "Velocities", FLOAT, N, 3, gparts, N_total, offset, v_full, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_SPEED); readArray(h_grp, "ParticleIDs", ULONGLONG, N, 1, gparts, N_total, offset, id, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_NO_UNITS); } /** @@ -49,13 +52,13 @@ __attribute__((always_inline)) INLINE static void darkmatter_read_particles( * @param h_grp The HDF5 group in which to write the arrays. * @param fileName The name of the file (unsued in MPI mode). * @param partTypeGroupName The name of the group containing the particles in - *the HDF5 file. + * the HDF5 file. * @param xmfFile The XMF file to write to (unused in MPI mode). * @param Ndm The number of DM particles on that MPI rank. * @param Ndm_total The total number of g-particles (only used in MPI mode) * @param mpi_rank The MPI rank of this node (only used in MPI mode) * @param offset The offset of the particles for this MPI rank (only used in MPI - *mode) + * mode) * @param gparts The #gpart array * @param internal_units The #UnitSystem used internally * @param snapshot_units The #UnitSystem used in the snapshots diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h index 7475b83728439a66968ae4505e2b8f603685fe48..078c29464a88e237fd5342b5f6ac18a11a8b4631 100644 --- a/src/hydro/Gadget2/hydro_io.h +++ b/src/hydro/Gadget2/hydro_io.h @@ -24,31 +24,33 @@ * @param N The number of particles on that MPI rank. * @param N_total The total number of particles (only used in MPI mode) * @param offset The offset of the particles for this MPI rank (only used in MPI - *mode) + * mode) * @param parts The particle array + * @param internal_units The #UnitSystem used internally + * @param ic_units The #UnitSystem used in the snapshots * */ __attribute__((always_inline)) INLINE static void hydro_read_particles( - hid_t h_grp, int N, long long N_total, long long offset, - struct part* parts) { + hid_t h_grp, int N, long long N_total, long long offset, struct part* parts, + const struct UnitSystem* internal_units, struct UnitSystem* ic_units) { /* Read arrays */ readArray(h_grp, "Coordinates", DOUBLE, N, 3, parts, N_total, offset, x, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_LENGTH); readArray(h_grp, "Velocities", FLOAT, N, 3, parts, N_total, offset, v, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_SPEED); readArray(h_grp, "Masses", FLOAT, N, 1, parts, N_total, offset, mass, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_MASS); readArray(h_grp, "SmoothingLength", FLOAT, N, 1, parts, N_total, offset, h, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_LENGTH); readArray(h_grp, "InternalEnergy", FLOAT, N, 1, parts, N_total, offset, - entropy, COMPULSORY); + entropy, COMPULSORY, internal_units, ic_units, UNIT_CONV_ENERGY); readArray(h_grp, "ParticleIDs", ULONGLONG, N, 1, parts, N_total, offset, id, - COMPULSORY); + COMPULSORY, internal_units, ic_units, UNIT_CONV_NO_UNITS); readArray(h_grp, "Acceleration", FLOAT, N, 3, parts, N_total, offset, a_hydro, - OPTIONAL); + OPTIONAL, internal_units, ic_units, UNIT_CONV_ACCELERATION); readArray(h_grp, "Density", FLOAT, N, 1, parts, N_total, offset, rho, - OPTIONAL); + OPTIONAL, internal_units, ic_units, UNIT_CONV_DENSITY); } /** @@ -57,13 +59,13 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles( * @param h_grp The HDF5 group in which to write the arrays. * @param fileName The name of the file (unsued in MPI mode). * @param partTypeGroupName The name of the group containing the particles in - *the HDF5 file. + * the HDF5 file. * @param xmfFile The XMF file to write to (unused in MPI mode). * @param N The number of particles on that MPI rank. * @param N_total The total number of particles (only used in MPI mode) * @param mpi_rank The MPI rank of this node (only used in MPI mode) * @param offset The offset of the particles for this MPI rank (only used in MPI - *mode) + * mode) * @param parts The particle array * @param internal_units The #UnitSystem used internally * @param snapshot_units The #UnitSystem used in the snapshots