diff --git a/src/engine.h b/src/engine.h index 81c6fa07109833dcabc906e435bfb6edc1fe9a0e..df4e8b534c619cf98c9eb0e3b98b9a4e229fcdfc 100644 --- a/src/engine.h +++ b/src/engine.h @@ -684,7 +684,7 @@ struct engine { /* Function prototypes, engine.c. */ void engine_addlink(struct engine *e, struct link **l, struct task *t); void engine_barrier(struct engine *e); -void engine_compute_next_snapshot_time(struct engine *e); +void engine_compute_next_snapshot_time(struct engine *e, const int restart); void engine_compute_next_stf_time(struct engine *e); void engine_compute_next_fof_time(struct engine *e); void engine_compute_next_statistics_time(struct engine *e); diff --git a/src/engine_config.c b/src/engine_config.c index 74fc0d20d6dd12fc90c17d09505c092f4da148c9..c3aa430f9c4103f9614187a8e4c23cc5e56da59d 100644 --- a/src/engine_config.c +++ b/src/engine_config.c @@ -789,7 +789,7 @@ void engine_config(int restart, int fof, struct engine *e, #endif /* Find the time of the first snapshot output */ - engine_compute_next_snapshot_time(e); + engine_compute_next_snapshot_time(e, restart); /* Find the time of the first statistics output */ engine_compute_next_statistics_time(e); diff --git a/src/engine_io.c b/src/engine_io.c index f8e97d8eee0e07e5b7551a7b992d5f313a2ac1cd..5b3116998e55278ff65a114764849c48555f0c06 100644 --- a/src/engine_io.c +++ b/src/engine_io.c @@ -565,7 +565,7 @@ void engine_io(struct engine *e) { #endif /* ... and find the next output time */ - engine_compute_next_snapshot_time(e); + engine_compute_next_snapshot_time(e, /*restart=*/0); break; case output_statistics: @@ -752,15 +752,19 @@ void engine_set_and_verify_snapshot_triggers(struct engine *e) { * @brief Computes the next time (on the time line) for a dump * * @param e The #engine. + * @param restart Are we calling this upon a restart event? */ -void engine_compute_next_snapshot_time(struct engine *e) { +void engine_compute_next_snapshot_time(struct engine *e, const int restart) { /* Do output_list file case */ if (e->output_list_snapshots) { output_list_read_next_time(e->output_list_snapshots, e, "snapshots", &e->ti_next_snapshot); - engine_set_and_verify_snapshot_triggers(e); + /* Unless we are restarting, check the allowed recording trigger time */ + if (!restart) engine_set_and_verify_snapshot_triggers(e); + + /* All done in the list case */ return; } @@ -818,8 +822,8 @@ void engine_compute_next_snapshot_time(struct engine *e) { message("Next snapshot time set to t=%e.", next_snapshot_time); } - /* Set the recording triggers accordingly for the next output */ - engine_set_and_verify_snapshot_triggers(e); + /* Unless we are restarting, set the recording triggers accordingly for the next output */ + if (!restart) engine_set_and_verify_snapshot_triggers(e); } } @@ -1184,7 +1188,7 @@ void engine_init_output_lists(struct engine *e, struct swift_params *params, if (e->output_list_snapshots->select_output_on) output_list_check_selection(e->output_list_snapshots, output_options); - engine_compute_next_snapshot_time(e); + engine_compute_next_snapshot_time(e, /*restart=*/0); if (e->policy & engine_policy_cosmology) e->a_first_snapshot =