diff --git a/examples/main.c b/examples/main.c index dd352e3a409e350ccaf5b1ab668d131fb95eebaf..51cabd7132d25ffd01b395a56e008a66e2758eca 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 1caf437df6e66143033acaa7e7c11cfc33e17bf6..c72984c1fe9368ee1f493cc520176b7b8dfe6d1d 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 10d1767c308d94adad21c9521af2a4c25f1a56a5..ab18392e0bd5325b249fd788d509d6b5c8a0c49f 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;