Commit d578629b authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Restored the old behaviour of the external gravity tasks.

parent b3575963
...@@ -1401,8 +1401,13 @@ void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s) { ...@@ -1401,8 +1401,13 @@ void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s) {
} }
/** /**
* @brief Traverse a sub-cell task and activate the drift and sort tasks along * @brief Traverse a sub-cell task and activate the hydro drift tasks that are
* the way. * required
* by a hydro task
*
* @param ci The first #cell we recurse in.
* @param cj The second #cell we recurse in.
* @param s The task #scheduler.
*/ */
void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj, void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s) { struct scheduler *s) {
...@@ -1670,7 +1675,13 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj, ...@@ -1670,7 +1675,13 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
} }
/** /**
* @brief Traverse a sub-cell task and activate the gravity drift tasks * @brief Traverse a sub-cell task and activate the gravity drift tasks that are
* required
* by a self gravity task.
*
* @param ci The first #cell we recurse in.
* @param cj The second #cell we recurse in.
* @param s The task #scheduler.
*/ */
void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj, void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s) { struct scheduler *s) {
...@@ -1795,6 +1806,40 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj, ...@@ -1795,6 +1806,40 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
} }
} }
/**
* @brief Traverse a sub-cell task and activate the gravity drift tasks that are
* required
* by an external gravity task.
*
* @param ci The #cell we recurse in.
* @param s The task #scheduler.
*/
void cell_activate_subcell_external_grav_tasks(struct cell *ci,
struct scheduler *s) {
/* Some constants */
const struct space *sp = s->space;
const struct engine *e = sp->e;
/* Do anything? */
if (!cell_is_active(ci, e)) return;
/* Recurse? */
if (ci->split) {
/* Loop over all progenies (no need for pairs for self-gravity) */
for (int j = 0; j < 8; j++) {
if (ci->progeny[j] != NULL) {
cell_activate_subcell_external_grav_tasks(ci->progeny[j], s);
}
}
} else {
/* We have reached the bottom of the tree: activate gpart drift */
cell_activate_drift_gpart(ci, s);
}
}
/** /**
* @brief Un-skips all the tasks associated with a given cell and checks * @brief Un-skips all the tasks associated with a given cell and checks
* if the space needs to be rebuilt. * if the space needs to be rebuilt.
...@@ -1987,7 +2032,10 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { ...@@ -1987,7 +2032,10 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
scheduler_activate(s, t); scheduler_activate(s, t);
/* Set the drifting flags */ /* Set the drifting flags */
if (t->type == task_type_self) { if (t->type == task_type_self &&
t->subtype == task_subtype_external_grav) {
cell_activate_subcell_external_grav_tasks(t->ci, s);
} else if (t->type == task_type_self && t->subtype == task_subtype_grav) {
cell_activate_subcell_grav_tasks(t->ci, NULL, s); cell_activate_subcell_grav_tasks(t->ci, NULL, s);
} else if (t->type == task_type_pair) { } else if (t->type == task_type_pair) {
cell_activate_subcell_grav_tasks(t->ci, t->cj, s); cell_activate_subcell_grav_tasks(t->ci, t->cj, s);
......
...@@ -408,6 +408,8 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj, ...@@ -408,6 +408,8 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s); struct scheduler *s);
void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj, void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s); struct scheduler *s);
void cell_activate_subcell_external_grav_tasks(struct cell *ci,
struct scheduler *s);
void cell_activate_drift_part(struct cell *c, struct scheduler *s); void cell_activate_drift_part(struct cell *c, struct scheduler *s);
void cell_activate_drift_gpart(struct cell *c, struct scheduler *s); void cell_activate_drift_gpart(struct cell *c, struct scheduler *s);
void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s); void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s);
......
...@@ -196,7 +196,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { ...@@ -196,7 +196,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
scheduler_addunlock(s, c->kick2, c->timestep); scheduler_addunlock(s, c->kick2, c->timestep);
scheduler_addunlock(s, c->timestep, c->kick1); scheduler_addunlock(s, c->timestep, c->kick1);
/* Add the gravity tasks */ /* Add the self-gravity tasks */
if (is_self_gravity) { if (is_self_gravity) {
/* Initialisation of the multipoles */ /* Initialisation of the multipoles */
...@@ -217,8 +217,10 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { ...@@ -217,8 +217,10 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
scheduler_addunlock(s, c->grav_down, c->kick2); scheduler_addunlock(s, c->grav_down, c->kick2);
} }
/* Generate the ghost tasks. */ /* Add the hydrodynamics tasks */
if (is_with_hydro) { if (is_with_hydro) {
/* Generate the ghost tasks. */
c->ghost_in = c->ghost_in =
scheduler_addtask(s, task_type_ghost, task_subtype_none, 0, scheduler_addtask(s, task_type_ghost, task_subtype_none, 0,
/* implicit = */ 1, c, NULL); /* implicit = */ 1, c, NULL);
......
...@@ -695,7 +695,7 @@ void scheduler_splittasks_mapper(void *map_data, int num_elements, ...@@ -695,7 +695,7 @@ void scheduler_splittasks_mapper(void *map_data, int num_elements,
scheduler_splittask_gravity(t, s); scheduler_splittask_gravity(t, s);
} else if (t->type == task_type_grav_top_level || } else if (t->type == task_type_grav_top_level ||
t->type == task_type_grav_ghost) { t->type == task_type_grav_ghost) {
// MATTHIEU: for the future /* For future use */
} else { } else {
error("Unexpected task sub-type"); error("Unexpected task sub-type");
} }
......
Markdown is supported
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