Commit 0f6ff35e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Put the checks for i/o dumps into a separate function. Call that function...

Put the checks for i/o dumps into a separate function. Call that function after the 0th step as well.
parent ea214bbb
......@@ -943,6 +943,9 @@ int main(int argc, char *argv[]) {
engine_dump_snapshot(&e);
engine_print_stats(&e);
/* Is there a dump before the end of the first time-step? */
engine_check_for_dumps(&e);
#ifdef HAVE_VELOCIRAPTOR
/* Call VELOCIraptor for the first time after the first snapshot dump. */
// if (e.policy & engine_policy_structure_finding) {
......
......@@ -2746,8 +2746,7 @@ void engine_link_gravity_tasks(struct engine *e) {
/* Get a pointer to the task. */
struct task *t = &sched->tasks[k];
if(t->type == task_type_none)
continue;
if (t->type == task_type_none) continue;
/* Get the cells we act on */
struct cell *ci = t->ci;
......@@ -4844,6 +4843,21 @@ void engine_step(struct engine *e) {
/* Create a restart file if needed. */
engine_dump_restarts(e, 0, e->restart_onexit && engine_is_done(e));
engine_check_for_dumps(e);
TIMER_TOC2(timer_step);
clocks_gettime(&time2);
e->wallclock_time = (float)clocks_diff(&time1, &time2);
#ifdef SWIFT_DEBUG_TASKS
/* Time in ticks at the end of this step. */
e->toc_step = getticks();
#endif
}
void engine_check_for_dumps(struct engine *e) {
/* Save some statistics ? */
int save_stats = 0;
if (e->ti_end_min > e->ti_next_stats && e->ti_next_stats > 0) save_stats = 1;
......@@ -4997,16 +5011,6 @@ void engine_step(struct engine *e) {
e->ti_current = ti_current;
e->max_active_bin = max_active_bin;
e->time = time;
TIMER_TOC2(timer_step);
clocks_gettime(&time2);
e->wallclock_time = (float)clocks_diff(&time1, &time2);
#ifdef SWIFT_DEBUG_TASKS
/* Time in ticks at the end of this step. */
e->toc_step = getticks();
#endif
}
/**
......
......@@ -382,6 +382,7 @@ void engine_drift_all(struct engine *e);
void engine_drift_top_multipoles(struct engine *e);
void engine_reconstruct_multipoles(struct engine *e);
void engine_print_stats(struct engine *e);
void engine_check_for_dumps(struct engine *e);
void engine_dump_snapshot(struct engine *e);
void engine_init_output_lists(struct engine *e, struct swift_params *params);
void engine_init(struct engine *e, struct space *s, struct swift_params *params,
......
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