Commit 461f7074 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Do not read the now unnecessary high-res. DM mass from the ICs.

parent c76866d5
......@@ -851,7 +851,7 @@ int main(int argc, char *argv[]) {
/* Get ready to read particles of all kinds */
size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0;
double dim[3] = {0., 0., 0.};
float high_res_DM_mass = -1.f;
if (myrank == 0) clocks_gettime(&tic);
#if defined(HAVE_HDF5)
#if defined(WITH_MPI)
......@@ -864,18 +864,17 @@ int main(int argc, char *argv[]) {
cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL,
nr_threads, dry_run);
#else
read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts,
&Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs, &high_res_DM_mass, with_hydro,
(with_external_gravity || with_self_gravity), with_stars,
with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h,
cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL,
nr_threads, dry_run);
read_ic_serial(
ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas, &Ngpart,
&Ngpart_background, &Nspart, &Nbpart, &flag_entropy_ICs, with_hydro,
(with_external_gravity || with_self_gravity), with_stars,
with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, myrank,
nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, dry_run);
#endif
#else
read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts,
&Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs, &high_res_DM_mass, with_hydro,
&flag_entropy_ICs, with_hydro,
(with_external_gravity || with_self_gravity), with_stars,
with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h,
cosmo.a, nr_threads, dry_run);
......
......@@ -425,14 +425,14 @@ int main(int argc, char *argv[]) {
int flag_entropy_ICs = 0;
size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0;
double dim[3] = {0., 0., 0.};
float high_res_DM_mass = -1.f;
if (myrank == 0) clocks_gettime(&tic);
#if defined(HAVE_HDF5)
#if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5)
read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts,
&Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs, &high_res_DM_mass, with_hydro,
&flag_entropy_ICs, with_hydro,
/*with_grav=*/1, with_stars, with_black_holes, cleanup_h,
cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes,
MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads,
......@@ -440,7 +440,7 @@ int main(int argc, char *argv[]) {
#else
read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas,
&Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs, &high_res_DM_mass, with_hydro,
&flag_entropy_ICs, with_hydro,
/*with_grav=*/1, with_stars, with_black_holes, cleanup_h,
cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes,
MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, /*dry_run=*/0);
......@@ -448,7 +448,7 @@ int main(int argc, char *argv[]) {
#else
read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas,
&Ngpart, &Ngpart_background, &Nspart, &Nbpart,
&flag_entropy_ICs, &high_res_DM_mass, with_hydro,
&flag_entropy_ICs, with_hydro,
/*with_grav=*/1, with_stars, with_black_holes, cleanup_h,
cleanup_sqrt_a, cosmo.h, cosmo.a, nr_threads, /*dry_run=*/0);
#endif
......
......@@ -493,11 +493,11 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
double dim[3], struct part** parts, struct gpart** gparts,
struct spart** sparts, struct bpart** bparts, size_t* Ngas,
size_t* Ngparts, size_t* Ngparts_background, size_t* Nstars,
size_t* Nblackholes, int* flag_entropy, float* gpart_mass,
int with_hydro, int with_gravity, int with_stars,
int with_black_holes, int cleanup_h, int cleanup_sqrt_a,
double h, double a, int mpi_rank, int mpi_size,
MPI_Comm comm, MPI_Info info, int n_threads, int dry_run) {
size_t* Nblackholes, int* flag_entropy, int with_hydro,
int with_gravity, int with_stars, int with_black_holes,
int cleanup_h, int cleanup_sqrt_a, double h, double a,
int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info,
int n_threads, int dry_run) {
hid_t h_file = 0, h_grp = 0;
/* GADGET has only cubic boxes (in cosmological mode) */
......@@ -801,13 +801,6 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
/* Prepare the DM particles */
io_prepare_dm_gparts(&tp, *gparts, Ndm);
/* Record the mass of the DM particles */
const float local_gpart_mass = (*gparts)[0].mass;
float global_gpart_mass;
MPI_Allreduce(&local_gpart_mass, &global_gpart_mass, 1, MPI_FLOAT, MPI_MAX,
comm);
*gpart_mass = global_gpart_mass;
/* Prepare the DM background particles */
io_prepare_dm_background_gparts(&tp, *gparts + Ndm, Ndm_background);
......
......@@ -39,11 +39,11 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
double dim[3], struct part** parts, struct gpart** gparts,
struct spart** sparts, struct bpart** bparts, size_t* Ngas,
size_t* Ngparts, size_t* Ngparts_background, size_t* Nstars,
size_t* Nblackholes, int* flag_entropy, float* gpart_mass,
int with_hydro, int with_gravity, int with_stars,
int with_black_holes, int cleanup_h, int cleanup_sqrt_a,
double h, double a, int mpi_rank, int mpi_size,
MPI_Comm comm, MPI_Info info, int n_threads, int dry_run);
size_t* Nblackholes, int* flag_entropy, int with_hydro,
int with_gravity, int with_stars, int with_black_holes,
int cleanup_h, int cleanup_sqrt_a, double h, double a,
int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info,
int n_threads, int dry_run);
void write_output_serial(struct engine* e, const char* baseName,
const struct unit_system* internal_units,
......@@ -56,6 +56,7 @@ void writeArray(const struct engine* e, hid_t grp, char* fileName,
int mpi_rank, long long offset,
const struct unit_system* internal_units,
const struct unit_system* snapshot_units);
#endif
#endif /* HAVE_HDF5 && WITH_MPI && !HAVE_PARALLEL_HDF5 */
#endif /* SWIFT_SERIAL_IO_H */
......@@ -405,10 +405,10 @@ void read_ic_single(const char* fileName,
struct part** parts, struct gpart** gparts,
struct spart** sparts, struct bpart** bparts, size_t* Ngas,
size_t* Ngparts, size_t* Ngparts_background, size_t* Nstars,
size_t* Nblackholes, int* flag_entropy, float* gpart_mass,
int with_hydro, int with_gravity, int with_stars,
int with_black_holes, int cleanup_h, int cleanup_sqrt_a,
double h, double a, int n_threads, int dry_run) {
size_t* Nblackholes, int* flag_entropy, int with_hydro,
int with_gravity, int with_stars, int with_black_holes,
int cleanup_h, int cleanup_sqrt_a, double h, double a,
int n_threads, int dry_run) {
hid_t h_file = 0, h_grp = 0;
/* GADGET has only cubic boxes (in cosmological mode) */
......@@ -665,9 +665,6 @@ void read_ic_single(const char* fileName,
/* Prepare the DM particles */
io_prepare_dm_gparts(&tp, *gparts, Ndm);
/* Record the mass of the DM particles */
*gpart_mass = (*gparts)[0].mass;
/* Prepare the DM background particles */
io_prepare_dm_background_gparts(&tp, *gparts + Ndm, Ndm_background);
......@@ -1290,4 +1287,4 @@ void write_output_single(struct engine* e, const char* baseName,
e->snapshot_output_count++;
}
#endif /* HAVE_HDF5 */
#endif /* HAVE_HDF5 && !WITH_MPI */
......@@ -35,10 +35,10 @@ void read_ic_single(const char* fileName,
struct part** parts, struct gpart** gparts,
struct spart** sparts, struct bpart** bparts, size_t* Ngas,
size_t* Ndm, size_t* Ndm_background, size_t* Nstars,
size_t* Nblackholes, int* flag_entropy, float* gpart_mass,
int with_hydro, int with_gravity, int with_stars,
int with_black_holes, int cleanup_h, int cleanup_sqrt_a,
double h, double a, int nr_threads, int dry_run);
size_t* Nblackholes, int* flag_entropy, int with_hydro,
int with_gravity, int with_stars, int with_black_holes,
int cleanup_h, int cleanup_sqrt_a, double h, double a,
int nr_threads, int dry_run);
void write_output_single(struct engine* e, const char* baseName,
const struct unit_system* internal_units,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment