diff --git a/src/debug.h b/src/debug.h index 15c4ca7819d6e191916ffd8587409fd723e968fd..3e9fcb6c50603e03ea675176bb0d1a0c02cd12bf 100644 --- a/src/debug.h +++ b/src/debug.h @@ -23,7 +23,6 @@ #include "cell.h" #include "part.h" - void printParticle(struct part *parts, struct xpart *xparts, long long int i, int N); void printgParticle(struct gpart *parts, long long int i, int N); diff --git a/src/hydro/Default/hydro.h b/src/hydro/Default/hydro.h index 28eb0f3fa1707d6832db186d940489cc67d582a3..3215390e83db1e5f134768211c52d2dec32cecad 100644 --- a/src/hydro/Default/hydro.h +++ b/src/hydro/Default/hydro.h @@ -73,7 +73,7 @@ __attribute__((always_inline)) * @param time The current time */ __attribute__((always_inline)) -INLINE static void hydro_end_density(struct part* p, float time) { + INLINE static void hydro_end_density(struct part* p, float time) { /* Some smoothing length multiples. */ const float h = p->h; @@ -175,7 +175,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( float u, w; const float dt = t1 - t0; - + /* Predict internal energy */ w = p->force.u_dt / p->u * dt; if (fabsf(w) < 0.01f) /* 1st order expansion of exp(w) */ @@ -201,8 +201,6 @@ __attribute__((always_inline)) p->force.h_dt *= p->h * 0.333333333f; } - - /** * @brief Kick the additional variables * @@ -210,11 +208,7 @@ __attribute__((always_inline)) * @param dt The time-step for this kick */ __attribute__((always_inline)) - INLINE static void hydro_kick_extra(struct part* p, float dt) { - -} - - + INLINE static void hydro_kick_extra(struct part* p, float dt) {} /** * @brief Converts hydro quantity of a particle @@ -224,5 +218,4 @@ __attribute__((always_inline)) * @param p The particle to act upon */ __attribute__((always_inline)) - INLINE static void hydro_convert_quantities(struct part* p) { -} + INLINE static void hydro_convert_quantities(struct part* p) {} diff --git a/src/hydro/Default/hydro_debug.h b/src/hydro/Default/hydro_debug.h index 48f50a119f532afc5052a9fb90d1342d708ab764..36eb75ae60e7a49ae798c232377985dd90cff54a 100644 --- a/src/hydro/Default/hydro_debug.h +++ b/src/hydro/Default/hydro_debug.h @@ -17,18 +17,14 @@ * ******************************************************************************/ - __attribute__((always_inline)) -INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) { - printf( - "x=[%.3e,%.3e,%.3e], " - "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n " - "h=%.3e, " - "wcount=%d, m=%.3e, dh_drho=%.3e, rho=%.3e, t_begin=%.3e, t_end=%.3e\n", - p->x[0], p->x[1], p->x[2], - p->v[0], p->v[1], p->v[2], xp->v_full[0], - xp->v_full[1], xp->v_full[2], p->a[0], - p->a[1], p->a[2], 2. * p->h, - (int)p->density.wcount, p->mass, p->rho_dh, - p->rho, p->t_begin, p->t_end); + INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) { + printf( + "x=[%.3e,%.3e,%.3e], " + "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n " + "h=%.3e, " + "wcount=%d, m=%.3e, dh_drho=%.3e, rho=%.3e, t_begin=%.3e, t_end=%.3e\n", + p->x[0], p->x[1], p->x[2], p->v[0], p->v[1], p->v[2], xp->v_full[0], + xp->v_full[1], xp->v_full[2], p->a[0], p->a[1], p->a[2], 2. * p->h, + (int)p->density.wcount, p->mass, p->rho_dh, p->rho, p->t_begin, p->t_end); } diff --git a/src/hydro/Default/hydro_io.h b/src/hydro/Default/hydro_io.h index 705b6886e2658341b3c896c2d8cf6b63a9fbabb5..fa25a600fd9c928eb27ce93d39d54f1af324df9e 100644 --- a/src/hydro/Default/hydro_io.h +++ b/src/hydro/Default/hydro_io.h @@ -23,36 +23,34 @@ * @param h_grp The HDF5 group in which to read the arrays. * @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) + * @param offset The offset of the particles for this MPI rank (only used in MPI + *mode) * @param parts The particle array * */ -__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) { +__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) { /* Read arrays */ - readArray(h_grp, "Coordinates", DOUBLE, N, 3, parts, N_total, - offset, x, COMPULSORY); - readArray(h_grp, "Velocities", FLOAT, N, 3, parts, N_total, - offset, v, COMPULSORY); - readArray(h_grp, "Masses", FLOAT, N, 1, parts, N_total, - offset, mass, COMPULSORY); - readArray(h_grp, "SmoothingLength", FLOAT, N, 1, parts, N_total, - offset, h, COMPULSORY); - readArray(h_grp, "InternalEnergy", FLOAT, N, 1, parts, N_total, - offset, u, COMPULSORY); - readArray(h_grp, "ParticleIDs", ULONGLONG, N, 1, parts, N_total, - offset, id, COMPULSORY); - readArray(h_grp, "Acceleration", FLOAT, N, 3, parts, N_total, - offset, a, OPTIONAL); - readArray(h_grp, "Density", FLOAT, N, 1, parts, N_total, - offset, rho, OPTIONAL); + readArray(h_grp, "Coordinates", DOUBLE, N, 3, parts, N_total, offset, x, + COMPULSORY); + readArray(h_grp, "Velocities", FLOAT, N, 3, parts, N_total, offset, v, + COMPULSORY); + readArray(h_grp, "Masses", FLOAT, N, 1, parts, N_total, offset, mass, + COMPULSORY); + readArray(h_grp, "SmoothingLength", FLOAT, N, 1, parts, N_total, offset, h, + COMPULSORY); + readArray(h_grp, "InternalEnergy", FLOAT, N, 1, parts, N_total, offset, u, + COMPULSORY); + readArray(h_grp, "ParticleIDs", ULONGLONG, N, 1, parts, N_total, offset, id, + COMPULSORY); + readArray(h_grp, "Acceleration", FLOAT, N, 3, parts, N_total, offset, a, + OPTIONAL); + readArray(h_grp, "Density", FLOAT, N, 1, parts, N_total, offset, rho, + OPTIONAL); } - - - /** * @brief Writes the different particles to the HDF5 file * @@ -62,24 +60,23 @@ INLINE static void hydro_read_particles(hid_t h_grp, int N, long long N_total, * @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) + * @param offset The offset of the particles for this MPI rank (only used in MPI + *mode) * @param parts The particle array * @param us The unit system to use * */ -__attribute__((always_inline)) -INLINE static void hydro_write_particles(hid_t h_grp, char* fileName, FILE* xmfFile, - int N, long long N_total, int mpi_rank, - long long offset, struct part* parts, - struct UnitSystem* us) { +__attribute__((always_inline)) INLINE static void hydro_write_particles( + hid_t h_grp, char* fileName, FILE* xmfFile, int N, long long N_total, + int mpi_rank, long long offset, struct part* parts, struct UnitSystem* us) { /* Write arrays */ writeArray(h_grp, fileName, xmfFile, "Coordinates", DOUBLE, N, 3, parts, N_total, mpi_rank, offset, x, us, UNIT_CONV_LENGTH); writeArray(h_grp, fileName, xmfFile, "Velocities", FLOAT, N, 3, parts, - N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED); - writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, - N_total, mpi_rank, offset, mass, us, UNIT_CONV_MASS); + N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED); + writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, N_total, + mpi_rank, offset, mass, us, UNIT_CONV_MASS); writeArray(h_grp, fileName, xmfFile, "SmoothingLength", FLOAT, N, 1, parts, N_total, mpi_rank, offset, h, us, UNIT_CONV_LENGTH); writeArray(h_grp, fileName, xmfFile, "InternalEnergy", FLOAT, N, 1, parts, @@ -88,9 +85,6 @@ INLINE static void hydro_write_particles(hid_t h_grp, char* fileName, FILE* xmfF N_total, mpi_rank, offset, id, us, UNIT_CONV_NO_UNITS); writeArray(h_grp, fileName, xmfFile, "Acceleration", FLOAT, N, 3, parts, N_total, mpi_rank, offset, a, us, UNIT_CONV_ACCELERATION); - writeArray(h_grp, fileName, xmfFile, "Density", FLOAT, N, 1, parts, - N_total, mpi_rank, offset, rho, us, UNIT_CONV_DENSITY); - - + writeArray(h_grp, fileName, xmfFile, "Density", FLOAT, N, 1, parts, N_total, + mpi_rank, offset, rho, us, UNIT_CONV_DENSITY); } - diff --git a/src/hydro/Gadget2/hydro_debug.h b/src/hydro/Gadget2/hydro_debug.h index 5030bccae81d2062ccf39071b70cf3b098284f48..3d17c4f94191cec37521f7f1fd4aa1716c8f5fc2 100644 --- a/src/hydro/Gadget2/hydro_debug.h +++ b/src/hydro/Gadget2/hydro_debug.h @@ -17,24 +17,19 @@ * ******************************************************************************/ - __attribute__((always_inline)) -INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) { - printf( - "x=[%.3e,%.3e,%.3e], " - "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n " - "h=%.3e, " - "wcount=%d, m=%.3e, dh_drho=%.3e, rho=%.3e, P=%.3e, S=%.3e, " - "dS/dt=%.3e,\n" - "divV=%.3e, curlV=%.3e, rotV=[%.3e,%.3e,%.3e] \n " - "v_sig=%e t_begin=%.3e, t_end=%.3e\n", - p->x[0], p->x[1], p->x[2], - p->v[0], p->v[1], p->v[2], xp->v_full[0], - xp->v_full[1], xp->v_full[2], p->a[0], - p->a[1], p->a[2], 2. * p->h, - (int)p->density.wcount, p->mass, p->rho_dh, - p->rho, p->pressure, p->entropy, - p->entropy_dt, p->div_v, p->curl_v, - p->rot_v[0], p->rot_v[1], p->rot_v[2], - p->v_sig, p->t_begin, p->t_end); + INLINE static void hydro_debug_particle(struct part* p, struct xpart* xp) { + printf( + "x=[%.3e,%.3e,%.3e], " + "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n " + "h=%.3e, " + "wcount=%d, m=%.3e, dh_drho=%.3e, rho=%.3e, P=%.3e, S=%.3e, " + "dS/dt=%.3e,\n" + "divV=%.3e, curlV=%.3e, rotV=[%.3e,%.3e,%.3e] \n " + "v_sig=%e t_begin=%.3e, t_end=%.3e\n", + p->x[0], p->x[1], p->x[2], p->v[0], p->v[1], p->v[2], xp->v_full[0], + xp->v_full[1], xp->v_full[2], p->a[0], p->a[1], p->a[2], 2. * p->h, + (int)p->density.wcount, p->mass, p->rho_dh, p->rho, p->pressure, + p->entropy, p->entropy_dt, p->div_v, p->curl_v, p->rot_v[0], p->rot_v[1], + p->rot_v[2], p->v_sig, p->t_begin, p->t_end); } diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h index e6ced1b8aca911b8fd7742e9296cece5d237c328..5e01d67fddcc81d766e8aa59eee2d6368378170c 100644 --- a/src/hydro/Gadget2/hydro_io.h +++ b/src/hydro/Gadget2/hydro_io.h @@ -23,35 +23,34 @@ * @param h_grp The HDF5 group in which to read the arrays. * @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) + * @param offset The offset of the particles for this MPI rank (only used in MPI + *mode) * @param parts The particle array * */ -__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) { +__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) { /* Read arrays */ - readArray(h_grp, "Coordinates", DOUBLE, N, 3, parts, N_total, - offset, x, COMPULSORY); - readArray(h_grp, "Velocities", FLOAT, N, 3, parts, N_total, - offset, v, COMPULSORY); - readArray(h_grp, "Masses", FLOAT, N, 1, parts, N_total, - offset, mass, COMPULSORY); - readArray(h_grp, "SmoothingLength", FLOAT, N, 1, parts, N_total, - offset, h, COMPULSORY); - readArray(h_grp, "InternalEnergy", FLOAT, N, 1, parts, N_total, - offset, entropy, COMPULSORY); - readArray(h_grp, "ParticleIDs", ULONGLONG, N, 1, parts, N_total, - offset, id, COMPULSORY); - readArray(h_grp, "Acceleration", FLOAT, N, 3, parts, N_total, - offset, a, OPTIONAL); - readArray(h_grp, "Density", FLOAT, N, 1, parts, N_total, - offset, rho, OPTIONAL); + readArray(h_grp, "Coordinates", DOUBLE, N, 3, parts, N_total, offset, x, + COMPULSORY); + readArray(h_grp, "Velocities", FLOAT, N, 3, parts, N_total, offset, v, + COMPULSORY); + readArray(h_grp, "Masses", FLOAT, N, 1, parts, N_total, offset, mass, + COMPULSORY); + readArray(h_grp, "SmoothingLength", FLOAT, N, 1, parts, N_total, offset, h, + COMPULSORY); + readArray(h_grp, "InternalEnergy", FLOAT, N, 1, parts, N_total, offset, + entropy, COMPULSORY); + readArray(h_grp, "ParticleIDs", ULONGLONG, N, 1, parts, N_total, offset, id, + COMPULSORY); + readArray(h_grp, "Acceleration", FLOAT, N, 3, parts, N_total, offset, a, + OPTIONAL); + readArray(h_grp, "Density", FLOAT, N, 1, parts, N_total, offset, rho, + OPTIONAL); } - - /** * @brief Writes the different particles to the HDF5 file * @@ -61,34 +60,32 @@ INLINE static void hydro_read_particles(hid_t h_grp, int N, long long N_total, * @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) + * @param offset The offset of the particles for this MPI rank (only used in MPI + *mode) * @param parts The particle array * @param us The unit system to use * */ -__attribute__((always_inline)) -INLINE static void hydro_write_particles(hid_t h_grp, char* fileName, FILE* xmfFile, - int N, long long N_total, int mpi_rank, - long long offset, struct part* parts, - struct UnitSystem* us) { +__attribute__((always_inline)) INLINE static void hydro_write_particles( + hid_t h_grp, char* fileName, FILE* xmfFile, int N, long long N_total, + int mpi_rank, long long offset, struct part* parts, struct UnitSystem* us) { /* Write arrays */ writeArray(h_grp, fileName, xmfFile, "Coordinates", DOUBLE, N, 3, parts, N_total, mpi_rank, offset, x, us, UNIT_CONV_LENGTH); writeArray(h_grp, fileName, xmfFile, "Velocities", FLOAT, N, 3, parts, - N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED); - writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, - N_total, mpi_rank, offset, mass, us, UNIT_CONV_MASS); + N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED); + writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, N_total, + mpi_rank, offset, mass, us, UNIT_CONV_MASS); writeArray(h_grp, fileName, xmfFile, "SmoothingLength", FLOAT, N, 1, parts, N_total, mpi_rank, offset, h, us, UNIT_CONV_LENGTH); writeArray(h_grp, fileName, xmfFile, "InternalEnergy", FLOAT, N, 1, parts, - N_total, mpi_rank, offset, entropy, us, UNIT_CONV_ENTROPY_PER_UNIT_MASS); + N_total, mpi_rank, offset, entropy, us, + UNIT_CONV_ENTROPY_PER_UNIT_MASS); writeArray(h_grp, fileName, xmfFile, "ParticleIDs", ULONGLONG, N, 1, parts, N_total, mpi_rank, offset, id, us, UNIT_CONV_NO_UNITS); writeArray(h_grp, fileName, xmfFile, "Acceleration", FLOAT, N, 3, parts, N_total, mpi_rank, offset, a, us, UNIT_CONV_ACCELERATION); - writeArray(h_grp, fileName, xmfFile, "Density", FLOAT, N, 1, parts, - N_total, mpi_rank, offset, rho, us, UNIT_CONV_DENSITY); - - + writeArray(h_grp, fileName, xmfFile, "Density", FLOAT, N, 1, parts, N_total, + mpi_rank, offset, rho, us, UNIT_CONV_DENSITY); } diff --git a/src/parallel_io.c b/src/parallel_io.c index 59bd5af1a9646bb830055be9061438a671882896..1391322af1e1520cabc007eee354b669bc4219c6 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -151,7 +151,6 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N, H5Dclose(h_data); } - /*----------------------------------------------------------------------------- * Routines writing an output file *-----------------------------------------------------------------------------*/ @@ -287,7 +286,6 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, H5Sclose(h_filespace); } - /** * @brief A helper macro to call the readArrayBackEnd function more easily. * @@ -308,8 +306,6 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, readArrayBackEnd(grp, name, type, N, dim, N_total, offset, \ (char*)(&(part[0]).field), importance) - - /** * @brief A helper macro to call the writeArrayBackEnd function more easily. * @@ -337,13 +333,9 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, mpi_rank, offset, (char*)(&(part[0]).field), us, \ convFactor) - /* Import the right hydro definition */ #include "hydro_io.h" - - - /** * @brief Reads an HDF5 initial condition file (GADGET-3 type) in parallel * @@ -449,8 +441,6 @@ void read_ic_parallel(char* fileName, double dim[3], struct part** parts, /* message("Done Reading particles..."); */ } - - /** * @brief Writes an HDF5 output file (GADGET-3 type) with its XMF descriptor * @@ -566,8 +556,9 @@ void write_output_parallel(struct engine* e, struct UnitSystem* us, h_grp = H5Gcreate1(h_file, "/PartType0", 0); if (h_grp < 0) error("Error while creating particle group.\n"); - /* Write particle fields from the particle structure */ - hydro_write_particles(h_grp, fileName, xmfFile, N, N_total, mpi_rank, offset, parts, us); + /* Write particle fields from the particle structure */ + hydro_write_particles(h_grp, fileName, xmfFile, N, N_total, mpi_rank, offset, + parts, us); /* Close particle group */ H5Gclose(h_grp); diff --git a/src/serial_io.c b/src/serial_io.c index 6f2d5fc8684c7c208272c87c4560dfcb27e5f18e..78b0ab58989a0ddf164156291f5c2c2c696c15dc 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -168,7 +168,6 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N, H5Dclose(h_data); } - /*----------------------------------------------------------------------------- * Routines writing an output file *-----------------------------------------------------------------------------*/ @@ -242,9 +241,9 @@ void prepareArray(hid_t grp, char* fileName, FILE* xmfFile, char* name, * * Calls #error() if an error occurs. */ -void writeArrayBackEnd(hid_t grp, char* name, - enum DATA_TYPE type, int N, int dim, long long N_total, - long long offset, char* part_c) { +void writeArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N, + int dim, long long N_total, long long offset, + char* part_c) { hid_t h_data = 0, h_err = 0, h_memspace = 0, h_filespace = 0; hsize_t shape[2], offsets[2]; void* temp = 0; @@ -311,7 +310,6 @@ void writeArrayBackEnd(hid_t grp, char* name, H5Sclose(h_filespace); } - /** * @brief A helper macro to call the readArrayBackEnd function more easily. * @@ -327,12 +325,11 @@ void writeArrayBackEnd(hid_t grp, char* name, * @param importance Is the data compulsory or not * */ -#define readArray(grp, name, type, N, dim, part, N_total, offset, \ - field, importance) \ - readArrayBackEnd(grp, name, type, N, dim, N_total, offset, \ +#define readArray(grp, name, type, N, dim, part, N_total, offset, field, \ + importance) \ + readArrayBackEnd(grp, name, type, N, dim, N_total, offset, \ (char*)(&(part[0]).field), importance) - /** * @brief A helper macro to call the readArrayBackEnd function more easily. * @@ -351,17 +348,14 @@ void writeArrayBackEnd(hid_t grp, char* name, * @param convFactor The UnitConversionFactor for this array * */ -#define writeArray(grp, fileName, xmfFile, name, type, N, dim, part, N_total,\ - mpi_rank, offset, field, us, convFactor) \ - writeArrayBackEnd(grp, name, type, N, dim, \ - N_total, offset, (char*)(&(part[0]).field)) - +#define writeArray(grp, fileName, xmfFile, name, type, N, dim, part, N_total, \ + mpi_rank, offset, field, us, convFactor) \ + writeArrayBackEnd(grp, name, type, N, dim, N_total, offset, \ + (char*)(&(part[0]).field)) /* Import the right hydro definition */ #include "hydro_io.h" - - /** * @brief Reads an HDF5 initial condition file (GADGET-3 type) * @@ -474,7 +468,7 @@ void read_ic_serial(char* fileName, double dim[3], struct part** parts, int* N, h_grp = H5Gopen1(h_file, "/PartType0"); if (h_grp < 0) error("Error while opening particle group on rank %d.\n", mpi_rank); - + /* Read particle fields into the particle structure */ hydro_read_particles(h_grp, *N, N_total, offset, *parts); @@ -492,9 +486,6 @@ void read_ic_serial(char* fileName, double dim[3], struct part** parts, int* N, /* message("Done Reading particles..."); */ } - - - /** * @brief Writes an HDF5 output file (GADGET-3 type) with its XMF descriptor * @@ -658,8 +649,9 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank, if (h_grp < 0) error("Error while opening particle group on rank %d.\n", mpi_rank); - /* Write particle fields from the particle structure */ - hydro_write_particles(h_grp, fileName, xmfFile, N, N_total, 0, offset, parts, us); + /* Write particle fields from the particle structure */ + hydro_write_particles(h_grp, fileName, xmfFile, N, N_total, 0, offset, + parts, us); /* Close particle group */ H5Gclose(h_grp); diff --git a/src/single_io.c b/src/single_io.c index 8ddbeda2e0ed4eb01137b106401c96956bc53b24..1a74f690f1a0658f74a58c55d3ab0ffcf2717463 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -39,7 +39,6 @@ #include "common_io.h" #include "error.h" - /*----------------------------------------------------------------------------- * Routines reading an IC file *-----------------------------------------------------------------------------*/ @@ -129,7 +128,6 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N, H5Dclose(h_data); } - /*----------------------------------------------------------------------------- * Routines writing an output file *-----------------------------------------------------------------------------*/ @@ -231,7 +229,6 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, H5Sclose(h_space); } - /** * @brief A helper macro to call the readArrayBackEnd function more easily. * @@ -248,10 +245,9 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, * */ #define readArray(grp, name, type, N, dim, part, N_total, offset, field, \ - importance) \ - readArrayBackEnd(grp, name, type, N, dim, \ - (char*)(&(part[0]).field), importance) - + importance) \ + readArrayBackEnd(grp, name, type, N, dim, (char*)(&(part[0]).field), \ + importance) /** * @brief A helper macro to call the readArrayBackEnd function more easily. @@ -274,16 +270,13 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, * */ #define writeArray(grp, fileName, xmfFile, name, type, N, dim, part, N_total, \ - mpi_rank, offset, field, us, convFactor) \ + mpi_rank, offset, field, us, convFactor) \ writeArrayBackEnd(grp, fileName, xmfFile, name, type, N, dim, \ (char*)(&(part[0]).field), us, convFactor) - /* Import the right hydro definition */ #include "hydro_io.h" - - /** * @brief Reads an HDF5 initial condition file (GADGET-3 type) * @@ -364,7 +357,7 @@ void read_ic_single(char* fileName, double dim[3], struct part** parts, int* N, /* Read particle fields into the particle structure */ hydro_read_particles(h_grp, *N, *N, 0, *parts); - + /* Close particle group */ H5Gclose(h_grp); @@ -374,8 +367,6 @@ void read_ic_single(char* fileName, double dim[3], struct part** parts, int* N, H5Fclose(h_file); } - - /** * @brief Writes an HDF5 output file (GADGET-3 type) with its XMF descriptor * @@ -470,9 +461,9 @@ void write_output_single(struct engine* e, struct UnitSystem* us) { h_grp = H5Gcreate1(h_file, "/PartType0", 0); if (h_grp < 0) error("Error while creating particle group.\n"); - /* Write particle fields from the particle structure */ + /* Write particle fields from the particle structure */ hydro_write_particles(h_grp, fileName, xmfFile, N, N, 0, 0, parts, us); - + /* Close particle group */ H5Gclose(h_grp);