diff --git a/examples/main.c b/examples/main.c index 54e67237b1707a0e3425ea61fe539a9e6edc0100..78e94da4c1a25c627046ca0ec34921971cc25c9a 100644 --- a/examples/main.c +++ b/examples/main.c @@ -404,30 +404,18 @@ int main(int argc, char *argv[]) { fflush(stdout); } - /* Discard gparts if we don't have gravity - * (Better implementation of i/o will come)*/ - if (!with_external_gravity && !with_self_gravity) { - free(gparts); - gparts = NULL; - for (size_t k = 0; k < Ngas; ++k) parts[k].gpart = NULL; - for (size_t k = 0; k < Nspart; ++k) sparts[k].gpart = NULL; - Ngpart = 0; - } +#ifdef SWIFT_DEBUG_CHECKS + /* Check once and for all that we don't have unwanted links */ if (!with_stars) { - free(sparts); - sparts = NULL; for (size_t k = 0; k < Ngpart; ++k) if (gparts[k].type == swift_type_star) error("Linking problem"); - Nspart = 0; } if (!with_hydro) { - free(parts); - parts = NULL; for (size_t k = 0; k < Ngpart; ++k) if (gparts[k].type == swift_type_gas) error("Linking problem"); - Ngas = 0; } - +#endif + /* Get the total number of particles across all nodes. */ long long N_total[3] = {0, 0, 0}; #if defined(WITH_MPI) diff --git a/src/single_io.c b/src/single_io.c index 324a76208aed6fbe61229e0101fd53a42b3fbd77..76cd69be117f061bc07a0223201e409c09f39d50 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -321,8 +321,10 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile, * @param Nstars (output) The number of #spart read. * @param periodic (output) 1 if the volume is periodic, 0 if not. * @param flag_entropy (output) 1 if the ICs contained Entropy in the - * InternalEnergy - * field + * InternalEnergy field + * @param with_hydro Are we reading gas particles ? + * @param with_hydro Are we reading/creating #gpart arrays ? + * @param with_stars Are we reading star particles ? * @param dry_run If 1, don't read the particle. Only allocates the arrays. * * Opens the HDF5 file fileName and reads the particles contained