diff --git a/examples/main.c b/examples/main.c index f1fe32041eb5d8c3a5123b21d113befd4ab4a9e8..ca20148b6f684c8b92c4f1d4efd33497d9e469b7 100644 --- a/examples/main.c +++ b/examples/main.c @@ -384,10 +384,10 @@ int main(int argc, char *argv[]) { if (myrank == 0) clocks_gettime(&tic); #if defined(WITH_MPI) #if defined(HAVE_PARALLEL_HDF5) - read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas, &Ngpart, - &Nspart, &periodic, &flag_entropy_ICs, with_hydro, - (with_external_gravity || with_self_gravity), with_stars, - myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, dry_run); + read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas, + &Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro, + (with_external_gravity || with_self_gravity), with_stars, + myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, dry_run); #else read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas, &Ngpart, &Nspart, &periodic, &flag_entropy_ICs, with_hydro, diff --git a/src/parallel_io.c b/src/parallel_io.c index 1dbe196c151345a09ccc736958e11c6c73ea33eb..c8c58ef842314e8e3382c20e0d8dcfbfa57d85c6 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -374,11 +374,11 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile, */ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units, double dim[3], struct part** parts, struct gpart** gparts, - struct spart** sparts, size_t* Ngas, size_t* Ngparts, - size_t* Nstars, int* periodic, int* flag_entropy, - int with_hydro, int with_gravity, int with_stars, - int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info, - int dry_run) { + struct spart** sparts, size_t* Ngas, size_t* Ngparts, + size_t* Nstars, int* periodic, int* flag_entropy, + int with_hydro, int with_gravity, int with_stars, + int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info, + int dry_run) { hid_t h_file = 0, h_grp = 0; /* GADGET has only cubic boxes (in cosmological mode) */ @@ -499,8 +499,8 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units, /* Allocate memory to store SPH particles */ if (with_hydro) { *Ngas = N[0]; - if (posix_memalign((void*)parts, part_align, (*Ngas) * sizeof(struct part)) != - 0) + if (posix_memalign((void*)parts, part_align, + (*Ngas) * sizeof(struct part)) != 0) error("Error while allocating memory for particles"); bzero(*parts, *Ngas * sizeof(struct part)); } @@ -519,7 +519,7 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units, Ndm = N[1]; *Ngparts = (with_hydro ? N[GAS] : 0) + N[DM] + (with_stars ? N[STAR] : 0); if (posix_memalign((void*)gparts, gpart_align, - *Ngparts * sizeof(struct gpart)) != 0) + *Ngparts * sizeof(struct gpart)) != 0) error("Error while allocating memory for gravity particles"); bzero(*gparts, *Ngparts * sizeof(struct gpart)); } @@ -553,25 +553,25 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units, switch (ptype) { case GAS: - if (with_hydro) { - Nparticles = *Ngas; - hydro_read_particles(*parts, list, &num_fields); - } + if (with_hydro) { + Nparticles = *Ngas; + hydro_read_particles(*parts, list, &num_fields); + } break; case DM: - if (with_gravity) { - Nparticles = Ndm; - darkmatter_read_particles(*gparts, list, &num_fields); - } + if (with_gravity) { + Nparticles = Ndm; + darkmatter_read_particles(*gparts, list, &num_fields); + } break; case STAR: if (with_stars) { - Nparticles = *Nstars; - star_read_particles(*sparts, list, &num_fields); - } - break; + Nparticles = *Nstars; + star_read_particles(*sparts, list, &num_fields); + } + break; default: message("Particle Type %d not yet supported. Particles ignored", ptype); @@ -851,9 +851,9 @@ void write_output_parallel(struct engine* e, const char* baseName, break; case STAR: - Nparticles = Nstars; - star_write_particles(sparts, list, &num_fields); - break; + Nparticles = Nstars; + star_write_particles(sparts, list, &num_fields); + break; default: error("Particle Type %d not yet supported. Aborting", ptype); @@ -864,7 +864,7 @@ void write_output_parallel(struct engine* e, const char* baseName, writeArray(e, h_grp, fileName, xmfFile, partTypeGroupName, list[i], Nparticles, N_total[ptype], mpi_rank, offset[ptype], internal_units, snapshot_units); - + /* Free temporary array */ if (dmparts) { free(dmparts); diff --git a/src/parallel_io.h b/src/parallel_io.h index 3f7395b8c17aaee8654d3b3f61e78d35cd27cb61..e4cb9f5976bc0f5b55207a7422597a05feaa3d5e 100644 --- a/src/parallel_io.h +++ b/src/parallel_io.h @@ -36,11 +36,11 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units, double dim[3], struct part** parts, struct gpart** gparts, - struct spart** sparts, size_t* Ngas, size_t* Ngparts, - size_t* Nsparts, int* periodic, int* flag_entropy, - int with_hydro, int with_gravity, int with_stars, - int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info, - int dry_run); + struct spart** sparts, size_t* Ngas, size_t* Ngparts, + size_t* Nsparts, int* periodic, int* flag_entropy, + int with_hydro, int with_gravity, int with_stars, + int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info, + int dry_run); void write_output_parallel(struct engine* e, const char* baseName, const struct UnitSystem* internal_units,