Commit 099ff19b authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Move the limiter loop to the hydro.super level.

parent a58a8c4f
......@@ -2718,14 +2718,15 @@ void cell_activate_limiter(struct cell *c, struct scheduler *s) {
/* Set the do_sub_limiter all the way up and activate the super limiter
if this has not yet been done. */
if (c == c->super) {
if (c == c->hydro.super) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->timestep_limiter == NULL)
if (c->hydro.limiter_out == NULL)
error("Trying to activate un-existing c->timestep_limiter");
if (c->hydro.timestep_limiter == NULL)
error("Trying to activate un-existing c->timestep_limiter");
#endif
if(c == c->hydro.super)
scheduler_activate(s, c->hydro.limiter_out);
scheduler_activate(s, c->timestep_limiter);
scheduler_activate(s, c->hydro.limiter_out);
scheduler_activate(s, c->hydro.timestep_limiter);
} else {
for (struct cell *parent = c->parent;
parent != NULL &&
......@@ -2734,14 +2735,15 @@ void cell_activate_limiter(struct cell *c, struct scheduler *s) {
/* Mark this cell for limiting */
cell_set_flag(parent, cell_flag_do_hydro_sub_limiter);
if (parent == c->super) {
if (parent == c->hydro.super) {
#ifdef SWIFT_DEBUG_CHECKS
if (parent->timestep_limiter == NULL)
if (parent->hydro.timestep_limiter == NULL)
error("Trying to activate un-existing parent->timestep_limiter");
if (parent->hydro.limiter_out == NULL)
error("Trying to activate un-existing parent->timestep_limiter");
#endif
if(parent == parent->hydro.super)
scheduler_activate(s, parent->hydro.limiter_out);
scheduler_activate(s, parent->timestep_limiter);
scheduler_activate(s, parent->hydro.limiter_out);
scheduler_activate(s, parent->hydro.timestep_limiter);
break;
}
}
......
......@@ -366,6 +366,9 @@ struct cell {
/*! Dependency implicit task for the time-step limiter (in->limiter->out)*/
struct task *limiter_out;
/*! The task to limit the time-step of inactive particles */
struct task *timestep_limiter;
/*! Dependency implicit task for the ghost (in->ghost->out)*/
struct task *ghost_in;
......@@ -761,9 +764,6 @@ struct cell {
/*! The task to compute time-steps */
struct task *timestep;
/*! The task to limit the time-step of inactive particles */
struct task *timestep_limiter;
#ifdef WITH_LOGGER
/*! The logger task */
struct task *logger;
......
......@@ -791,7 +791,6 @@ void engine_addtasks_recv_gravity(struct engine *e, struct cell *c,
void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) {
struct scheduler *s = &e->sched;
const int with_limiter = (e->policy & engine_policy_limiter);
const int with_star_formation = (e->policy & engine_policy_star_formation);
/* Are we at the top-level? */
......@@ -842,16 +841,6 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) {
scheduler_addunlock(s, kick2_or_logger, c->top->hydro.star_formation);
scheduler_addunlock(s, c->top->hydro.star_formation, c->timestep);
}
/* Time-step limiting */
if (with_limiter) {
c->timestep_limiter = scheduler_addtask(
s, task_type_timestep_limiter, task_subtype_none, 0, 0, c, NULL);
/* Make sure it is not run before kick2 */
scheduler_addunlock(s, c->timestep, c->timestep_limiter);
scheduler_addunlock(s, c->timestep_limiter, c->kick1);
}
}
} else { /* We are above the super-cell so need to go deeper */
......@@ -1170,6 +1159,9 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c,
/* Time-step limiter */
if (with_limiter) {
c->hydro.timestep_limiter = scheduler_addtask(
s, task_type_timestep_limiter, task_subtype_none, 0, 0, c, NULL);
c->hydro.limiter_in =
scheduler_addtask(s, task_type_limiter_in, task_subtype_none, 0,
/* implicit = */ 1, c, NULL);
......@@ -1180,8 +1172,9 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c,
scheduler_addunlock(s, c->super->kick2, c->hydro.limiter_in);
scheduler_addunlock(s, c->hydro.limiter_out, c->super->timestep);
scheduler_addunlock(s, c->hydro.limiter_out,
c->super->timestep_limiter);
scheduler_addunlock(s, c->hydro.limiter_out, c->hydro.timestep_limiter);
scheduler_addunlock(s, c->super->timestep, c->hydro.timestep_limiter);
scheduler_addunlock(s, c->hydro.timestep_limiter, c->super->kick1);
if (with_feedback) {
scheduler_addunlock(s, c->stars.stars_out, c->hydro.limiter_in);
......
......@@ -251,7 +251,9 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements,
c->kick1 = NULL;
c->kick2 = NULL;
c->timestep = NULL;
c->timestep_limiter = NULL;
c->hydro.limiter_in = NULL;
c->hydro.limiter_out = NULL;
c->hydro.timestep_limiter = NULL;
c->hydro.end_force = NULL;
c->hydro.drift = NULL;
c->stars.drift = NULL;
......
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