Skip to content
Snippets Groups Projects
Commit ae21e481 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

No need to discard particles any more. This is done at reading time.

parent 3f70533d
No related branches found
No related tags found
2 merge requests!310Star particles and gparts links over MPI,!304Star particle infrastructure
......@@ -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)
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment