diff --git a/src/cell.c b/src/cell.c index 3c6d6e4507b9a175e1741f0bd7b60c6726279c0d..d174ac09c42233548dfda2cf096899ea47fb7682 100644 --- a/src/cell.c +++ b/src/cell.c @@ -3501,7 +3501,9 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { if (c->timestep != NULL) scheduler_activate(s, c->timestep); if (c->hydro.end_force != NULL) scheduler_activate(s, c->hydro.end_force); if (c->hydro.cooling != NULL) scheduler_activate(s, c->hydro.cooling); +#ifdef WITH_LOGGER if (c->logger != NULL) scheduler_activate(s, c->logger); +#endif if (c->top->hydro.star_formation != NULL) { cell_activate_star_formation_tasks(c->top, s); @@ -3656,7 +3658,9 @@ int cell_unskip_gravity_tasks(struct cell *c, struct scheduler *s) { if (c->grav.mesh != NULL) scheduler_activate(s, c->grav.mesh); if (c->grav.long_range != NULL) scheduler_activate(s, c->grav.long_range); if (c->grav.end_force != NULL) scheduler_activate(s, c->grav.end_force); +#ifdef WITH_LOGGER if (c->logger != NULL) scheduler_activate(s, c->logger); +#endif } return rebuild; @@ -3898,7 +3902,9 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s, if (c->kick1 != NULL) scheduler_activate(s, c->kick1); if (c->kick2 != NULL) scheduler_activate(s, c->kick2); if (c->timestep != NULL) scheduler_activate(s, c->timestep); - if (c->logger != NULL) scheduler_activate(s, c->logger); +#ifdef WITH_LOGGER + if (c->logger != NULL) scheduler_activate(s, c->logger); +#endif } } @@ -4176,7 +4182,9 @@ int cell_unskip_black_holes_tasks(struct cell *c, struct scheduler *s) { if (c->kick1 != NULL) scheduler_activate(s, c->kick1); if (c->kick2 != NULL) scheduler_activate(s, c->kick2); if (c->timestep != NULL) scheduler_activate(s, c->timestep); +#ifdef WITH_LOGGER if (c->logger != NULL) scheduler_activate(s, c->logger); +#endif } return rebuild; diff --git a/src/cell.h b/src/cell.h index f59576b4fc303580fc37db31e2fecb707ec774e6..be54c886eef3aa121ea02dbb86a97c2ce2bc5f83 100644 --- a/src/cell.h +++ b/src/cell.h @@ -755,8 +755,10 @@ struct cell { /*! The task to limit the time-step of inactive particles */ struct task *timestep_limiter; - /*! The logger task */ - struct task *logger; +#ifdef WITH_LOGGER + /*! The logger task */ + struct task *logger; +#endif /*! Minimum dimension, i.e. smallest edge of this cell (min(width)). */ float dmin; diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 6a8341068cb87d2994a8d658a9a7255462ef294e..f3a2645806326cb52f84ef0dae029afa64134838 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -789,24 +789,33 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) { c->kick1 = scheduler_addtask(s, task_type_kick1, task_subtype_none, 0, 0, c, NULL); + c->kick2 = scheduler_addtask(s, task_type_kick2, task_subtype_none, 0, 0, + c, NULL); + #if defined(WITH_LOGGER) + /* Add the hydro logger task. */ c->logger = scheduler_addtask(s, task_type_logger, task_subtype_none, 0, - 0, c, NULL); -#endif + 0, c, NULL); - c->kick2 = scheduler_addtask(s, task_type_kick2, task_subtype_none, 0, 0, - c, NULL); + /* Add the kick2 dependency */ + scheduler_addunlock(s, c->kick2, c->logger); + + /* Create a variable in order to avoid to many ifdef */ + struct task *kick2_or_logger = c->logger; +#else + struct task *kick2_or_logger = c->kick2; +#endif /* Add the time-step calculation task and its dependency */ c->timestep = scheduler_addtask(s, task_type_timestep, task_subtype_none, 0, 0, c, NULL); - scheduler_addunlock(s, c->kick2, c->timestep); + scheduler_addunlock(s, kick2_or_logger, c->timestep); scheduler_addunlock(s, c->timestep, c->kick1); /* Subgrid tasks: star formation */ if (with_star_formation && c->hydro.count > 0) { - scheduler_addunlock(s, c->kick2, c->top->hydro.star_formation); + scheduler_addunlock(s, kick2_or_logger, c->top->hydro.star_formation); scheduler_addunlock(s, c->top->hydro.star_formation, c->timestep); } @@ -820,9 +829,6 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) { scheduler_addunlock(s, c->timestep_limiter, c->kick1); } -#if defined(WITH_LOGGER) - scheduler_addunlock(s, c->kick1, c->logger); -#endif } } else { /* We are above the super-cell so need to go deeper */ @@ -1008,6 +1014,11 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, c->hydro.stars_resort); } } +#ifdef WITH_LOGGER + struct task *c_kick2_or_logger = c->logger; +#else + struct task *c_kick2_or_logger = c->kick2; +#endif /* Are we in a super-cell ? */ if (c->hydro.super == c) { @@ -1094,7 +1105,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, c->stars.ghost = scheduler_addtask(s, task_type_stars_ghost, task_subtype_none, 0, 0, c, NULL); - scheduler_addunlock(s, c->super->kick2, c->stars.stars_in); + scheduler_addunlock(s, c_kick2_or_logger, c->stars.stars_in); scheduler_addunlock(s, c->stars.stars_out, c->super->timestep); if (with_star_formation && c->hydro.count > 0) { @@ -1124,7 +1135,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, c->black_holes.swallow_ghost[2] = scheduler_addtask( s, task_type_bh_swallow_ghost3, task_subtype_none, 0, 0, c, NULL); - scheduler_addunlock(s, c->super->kick2, c->black_holes.black_holes_in); + scheduler_addunlock(s, c_kick2_or_logger, c->black_holes.black_holes_in); scheduler_addunlock(s, c->black_holes.black_holes_out, c->super->timestep); } @@ -1760,6 +1771,13 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, const long long flags = t->flags; struct cell *ci = t->ci; struct cell *cj = t->cj; +#ifdef WITH_LOGGER + struct task *ci_super_kick2_or_logger = ci->super->logger; + struct task *cj_super_kick2_or_logger = (cj == NULL)? NULL : cj->super->logger; +#else + struct task *ci_super_kick2_or_logger = ci->super->kick2; + struct task *cj_super_kick2_or_logger = (cj == NULL)? NULL : cj->super->kick2; +#endif /* Sort tasks depend on the drift of the cell (gas version). */ if (t_type == task_type_sort && ci->nodeID == nodeID) { @@ -1907,7 +1925,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, } if (with_limiter) { - scheduler_addunlock(sched, ci->super->kick2, t_limiter); + scheduler_addunlock(sched, ci_super_kick2_or_logger, t_limiter); scheduler_addunlock(sched, t_limiter, ci->super->timestep); scheduler_addunlock(sched, t_limiter, ci->super->timestep_limiter); } @@ -2097,7 +2115,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, } if (with_limiter) { - scheduler_addunlock(sched, ci->super->kick2, t_limiter); + scheduler_addunlock(sched, ci_super_kick2_or_logger, t_limiter); scheduler_addunlock(sched, t_limiter, ci->super->timestep); scheduler_addunlock(sched, t_limiter, ci->super->timestep_limiter); } @@ -2175,7 +2193,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, } if (with_limiter) { - scheduler_addunlock(sched, cj->super->kick2, t_limiter); + scheduler_addunlock(sched, cj_super_kick2_or_logger, t_limiter); scheduler_addunlock(sched, t_limiter, cj->super->timestep); scheduler_addunlock(sched, t_limiter, cj->super->timestep_limiter); } @@ -2343,7 +2361,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, } if (with_limiter) { - scheduler_addunlock(sched, ci->super->kick2, t_limiter); + scheduler_addunlock(sched, ci_super_kick2_or_logger, t_limiter); scheduler_addunlock(sched, t_limiter, ci->super->timestep); scheduler_addunlock(sched, t_limiter, ci->super->timestep_limiter); } @@ -2537,7 +2555,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, } if (with_limiter) { - scheduler_addunlock(sched, ci->super->kick2, t_limiter); + scheduler_addunlock(sched, ci_super_kick2_or_logger, t_limiter); scheduler_addunlock(sched, t_limiter, ci->super->timestep); scheduler_addunlock(sched, t_limiter, ci->super->timestep_limiter); } @@ -2617,7 +2635,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, } if (with_limiter) { - scheduler_addunlock(sched, cj->super->kick2, t_limiter); + scheduler_addunlock(sched, cj_super_kick2_or_logger, t_limiter); scheduler_addunlock(sched, t_limiter, cj->super->timestep); scheduler_addunlock(sched, t_limiter, cj->super->timestep_limiter); } diff --git a/src/runner.c b/src/runner.c index 82626e090439841f1a2e499e7b1ca987771f3c14..22fdfaee1d422a935be5d6a5329f67d8b9c41efb 100644 --- a/src/runner.c +++ b/src/runner.c @@ -4929,7 +4929,7 @@ void runner_do_logger(struct runner *r, struct cell *c, int timer) { const int count = c->hydro.count; /* Anything to do here? */ - if (!cell_is_starting_hydro(c, e) && !cell_is_starting_gravity(c, e)) return; + if (!cell_is_active_hydro(c, e) && !cell_is_active_gravity(c, e)) return; /* Recurse? Avoid spending too much time in useless cells. */ if (c->split) { @@ -4947,7 +4947,7 @@ void runner_do_logger(struct runner *r, struct cell *c, int timer) { /* If particle needs to be log */ /* This is the same function than part_is_active, except for * debugging checks */ - if (part_is_starting(p, e)) { + if (part_is_active(p, e)) { if (logger_should_write(&xp->logger_data, e->logger)) { /* Write particle */