Skip to content
Snippets Groups Projects
Commit 0eb2abd8 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Separate the creation and the linking of the gravity tasks

parent 30c4cf40
No related branches found
No related tags found
1 merge request!143Gravity particles
......@@ -105,6 +105,9 @@ void engine_make_ghost_tasks(struct engine *e, struct cell *c,
struct cell *super) {
struct scheduler *s = &e->sched;
const int is_with_external_gravity =
(e->policy & engine_policy_external_gravity) ==
engine_policy_external_gravity;
/* Am I the super-cell? */
if (super == NULL && (c->count > 0 || c->gcount > 0)) {
......@@ -115,12 +118,6 @@ void engine_make_ghost_tasks(struct engine *e, struct cell *c,
/* Local tasks only... */
if (c->nodeID == e->nodeID) {
if (c->count > 0) {
/* Generate the ghost task. */
c->ghost = scheduler_addtask(s, task_type_ghost, task_subtype_none, 0,
0, c, NULL, 0);
}
/* Add the init task. */
c->init = scheduler_addtask(s, task_type_init, task_subtype_none, 0, 0, c,
NULL, 0);
......@@ -133,16 +130,19 @@ void engine_make_ghost_tasks(struct engine *e, struct cell *c,
c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, 0, c,
NULL, 0);
if (c->gcount > 0) {
/* Add the gravity tasks */
c->grav_external = scheduler_addtask(
s, task_type_grav_external, task_subtype_none, 0, 0, c, NULL, 0);
if (c->count > 0) {
/* Enforce gravity calculated before kick */
scheduler_addunlock(s, c->grav_external, c->kick);
/* Generate the ghost task. */
c->ghost = scheduler_addtask(s, task_type_ghost, task_subtype_none, 0,
0, c, NULL, 0);
}
/* Enforce gravity calculated after init */
scheduler_addunlock(s, c->init, c->grav_external);
if (c->gcount > 0) {
/* Add the external gravity tasks */
if (is_with_external_gravity)
c->grav_external = scheduler_addtask(
s, task_type_grav_external, task_subtype_none, 0, 0, c, NULL, 0);
}
}
}
......@@ -1297,6 +1297,12 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
/* /\* Kick tasks should rely on the grav_down tasks of their cell. *\/ */
/* else if (t->type == task_type_kick && t->ci->grav_down != NULL) */
/* scheduler_addunlock(sched, t->ci->grav_down, t); */
/* External gravity tasks should depend on init and unlock the kick */
else if (t->type == task_type_grav_external) {
scheduler_addunlock(sched, t->ci->init, t);
scheduler_addunlock(sched, t, t->ci->kick);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment