From c541d53f128c55e9adc418a8899d51d6fbf219bb Mon Sep 17 00:00:00 2001 From: John Helly <j.c.helly@durham.ac.uk> Date: Fri, 9 Oct 2020 09:59:22 +0100 Subject: [PATCH] Added Snapshots:invoke_fof parameter to run FoF just before writing snapshots --- examples/main.c | 5 +++++ src/engine.c | 8 ++++++++ src/engine.h | 1 + 3 files changed, 14 insertions(+) diff --git a/examples/main.c b/examples/main.c index dd352e3a40..51cabd7132 100644 --- a/examples/main.c +++ b/examples/main.c @@ -1635,6 +1635,11 @@ int main(int argc, char *argv[]) { /* Write final snapshot? */ if ((e.output_list_snapshots && e.output_list_snapshots->final_step_dump) || !e.output_list_snapshots) { + + if(with_fof && e.snapshot_invoke_fof) { + engine_fof(&e, /*dump_results=*/0, /*seed_black_holes=*/0); + } + #ifdef HAVE_VELOCIRAPTOR if (with_structure_finding && e.snapshot_invoke_stf && !e.stf_this_timestep) diff --git a/src/engine.c b/src/engine.c index 1caf437df6..c72984c1fe 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2845,6 +2845,7 @@ void engine_check_for_dumps(struct engine *e) { const int with_cosmology = (e->policy & engine_policy_cosmology); const int with_stf = (e->policy & engine_policy_structure_finding); const int with_los = (e->policy & engine_policy_line_of_sight); + const int with_fof = (e->policy & engine_policy_fof); /* What kind of output are we getting? */ enum output_type { @@ -2928,6 +2929,11 @@ void engine_check_for_dumps(struct engine *e) { e->force_checks_snapshot_flag = 1; #endif + /* Do we want FoF group IDs in the snapshot? */ + if(with_fof && e->snapshot_invoke_fof) { + engine_fof(e, /*dump_results=*/0, /*seed_black_holes=*/0); + } + /* Do we want a corresponding VELOCIraptor output? */ if (with_stf && e->snapshot_invoke_stf && !e->stf_this_timestep) { @@ -3982,6 +3988,8 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params, parser_get_opt_param_int(params, "Snapshots:int_time_label_on", 0); e->snapshot_invoke_stf = parser_get_opt_param_int(params, "Snapshots:invoke_stf", 0); + e->snapshot_invoke_fof = + parser_get_opt_param_int(params, "Snapshots:invoke_fof", 0); e->snapshot_units = (struct unit_system *)malloc(sizeof(struct unit_system)); units_init_default(e->snapshot_units, params, "Snapshots", internal_units); e->snapshot_output_count = 0; diff --git a/src/engine.h b/src/engine.h index 10d1767c30..ab18392e0b 100644 --- a/src/engine.h +++ b/src/engine.h @@ -314,6 +314,7 @@ struct engine { int snapshot_compression; int snapshot_int_time_label_on; int snapshot_invoke_stf; + int snapshot_invoke_fof; struct unit_system *snapshot_units; int snapshot_output_count; -- GitLab