From 18ebebb194a8c536ce4349cfd9a1529ee97e48d9 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Tue, 14 May 2019 15:06:32 +0100 Subject: [PATCH] Initialise the FOF structure in the main() --- examples/main.c | 7 ++++++- examples/main_fof.c | 11 ++++++----- src/engine.c | 4 +++- src/engine.h | 3 ++- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/examples/main.c b/examples/main.c index 133b7a2e26..b334b128af 100644 --- a/examples/main.c +++ b/examples/main.c @@ -99,6 +99,7 @@ int main(int argc, char *argv[]) { struct feedback_props feedback_properties; struct entropy_floor_properties entropy_floor; struct black_holes_props black_holes_properties; + struct fof_props fof_properties; struct part *parts = NULL; struct phys_const prog_const; struct space s; @@ -828,6 +829,10 @@ int main(int argc, char *argv[]) { chemistry_init(params, &us, &prog_const, &chemistry); if (myrank == 0) chemistry_print(&chemistry); + /* Initialise the FOF properties */ + bzero(&fof_properties, sizeof(struct fof_props)); + if (with_fof) fof_init(&fof_properties, params); + /* Be verbose about what happens next */ if (myrank == 0) message("Reading ICs from file '%s'", ICfileName); if (myrank == 0 && cleanup_h) @@ -1038,7 +1043,7 @@ int main(int argc, char *argv[]) { &hydro_properties, &entropy_floor, &gravity_properties, &stars_properties, &black_holes_properties, &feedback_properties, &mesh, &potential, &cooling_func, - &starform, &chemistry); + &starform, &chemistry, &fof_properties); engine_config(0, &e, params, nr_nodes, myrank, nr_threads, with_aff, talking, restart_file); diff --git a/examples/main_fof.c b/examples/main_fof.c index 39c91d29cc..2e8aa0e930 100644 --- a/examples/main_fof.c +++ b/examples/main_fof.c @@ -99,6 +99,7 @@ int main(int argc, char *argv[]) { struct feedback_props feedback_properties; struct entropy_floor_properties entropy_floor; struct black_holes_props black_holes_properties; + struct fof_props fof_properties; struct part *parts = NULL; struct phys_const prog_const; struct space s; @@ -913,6 +914,10 @@ int main(int argc, char *argv[]) { chemistry_init(params, &us, &prog_const, &chemistry); if (myrank == 0) chemistry_print(&chemistry); + /* Initialise the FOF properties */ + bzero(&fof_properties, sizeof(struct fof_props)); + if (with_fof) fof_init(&fof_properties, params); + /* Construct the engine policy */ int engine_policies = ENGINE_POLICY | engine_policy_steal; if (with_drift_all) engine_policies |= engine_policy_drift_all; @@ -939,7 +944,7 @@ int main(int argc, char *argv[]) { &hydro_properties, &entropy_floor, &gravity_properties, &stars_properties, &black_holes_properties, &feedback_properties, &mesh, &potential, &cooling_func, - &starform, &chemistry); + &starform, &chemistry, &fof_properties); engine_config(0, &e, params, nr_nodes, myrank, nr_threads, with_aff, talking, restart_file); @@ -1001,10 +1006,6 @@ int main(int argc, char *argv[]) { e.tic_step = getticks(); #endif - /* Initialise the FOF parameters. */ - // MATTHIEU - // fof_init(&s); - /* Initialise the particles */ engine_init_particles(&e, flag_entropy_ICs, clean_smoothing_length_values, 0); diff --git a/src/engine.c b/src/engine.c index 253d8657ad..fc4ce74bcf 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4906,7 +4906,8 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params, const struct external_potential *potential, struct cooling_function_data *cooling_func, const struct star_formation *starform, - const struct chemistry_global_data *chemistry) { + const struct chemistry_global_data *chemistry, + struct fof_props *fof_properties) { /* Clean-up everything */ bzero(e, sizeof(struct engine)); @@ -4977,6 +4978,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params, e->star_formation = starform; e->feedback_props = feedback; e->chemistry = chemistry; + e->fof_properties = fof_properties; e->parameter_file = params; #ifdef WITH_MPI e->cputime_last_step = 0; diff --git a/src/engine.h b/src/engine.h index 791487dd76..1c788c3e60 100644 --- a/src/engine.h +++ b/src/engine.h @@ -490,7 +490,8 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params, const struct external_potential *potential, struct cooling_function_data *cooling_func, const struct star_formation *starform, - const struct chemistry_global_data *chemistry); + const struct chemistry_global_data *chemistry, + struct fof_props *fof_properties); void engine_config(int restart, struct engine *e, struct swift_params *params, int nr_nodes, int nodeID, int nr_threads, int with_aff, int verbose, const char *restart_file); -- GitLab