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

Restored the task logic for long-range gravity and M-M calculations

parent 2781ef21
......@@ -1321,6 +1321,8 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
if (c->kick2 != NULL) scheduler_activate(s, c->kick2);
if (c->timestep != NULL) scheduler_activate(s, c->timestep);
if (c->grav_down != NULL) scheduler_activate(s, c->grav_down);
if (c->grav_long_range != NULL) scheduler_activate(s, c->grav_long_range);
if (c->grav_top_level != NULL) scheduler_activate(s, c->grav_top_level);
if (c->cooling != NULL) scheduler_activate(s, c->cooling);
if (c->sourceterms != NULL) scheduler_activate(s, c->sourceterms);
......
......@@ -170,7 +170,10 @@ struct cell {
struct task *timestep;
/*! Task constructing the multipole from the particles */
struct task *grav_up;
struct task *grav_top_level;
/*! Task constructing the multipole from the particles */
struct task *grav_long_range;
/*! Task propagating the multipole to the particles */
struct task *grav_down;
......
......@@ -132,6 +132,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
struct scheduler *s = &e->sched;
const int is_hydro = (e->policy & engine_policy_hydro);
const int is_self_gravity = (e->policy & engine_policy_self_gravity);
const int is_with_cooling = (e->policy & engine_policy_cooling);
const int is_with_sourceterms = (e->policy & engine_policy_sourceterms);
......@@ -165,6 +166,19 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
scheduler_addunlock(s, c->drift, c->init);
if (is_self_gravity) {
/* Gravity non-neighbouring pm calculations */
c->grav_long_range = scheduler_addtask(
s, task_type_grav_long_range, task_subtype_none, 0, 0, c, NULL, 0);
/* Gravity top-level periodic calculation */
c->grav_top_level = scheduler_addtask(
s, task_type_grav_top_level, task_subtype_none, 0, 0, c, NULL, 0);
scheduler_addunlock(s, c->init, c->grav_long_range);
scheduler_addunlock(s, c->init, c->grav_top_level);
}
/* Generate the ghost task. */
if (is_hydro)
c->ghost = scheduler_addtask(s, task_type_ghost, task_subtype_none, 0,
......@@ -871,7 +885,7 @@ void engine_addtasks_grav(struct engine *e, struct cell *c, struct task *up,
struct task *down) {
/* Link the tasks to this cell. */
c->grav_up = up;
// c->grav_up = up;
c->grav_down = down;
/* Recurse? */
......@@ -1572,11 +1586,6 @@ void engine_make_self_gravity_tasks(struct engine *e) {
scheduler_addtask(sched, task_type_self, task_subtype_grav, 0, 0, ci, NULL,
0);
/* Let's also build a task for all the non-neighbouring pm calculations */
/* scheduler_addtask(sched, task_type_grav_long_range, task_subtype_none, 0,
* 0, */
/* ci, NULL, 0); */
for (int cjd = cid + 1; cjd < nr_cells; ++cjd) {
struct cell *cj = &cells[cjd];
......@@ -2447,7 +2456,9 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
}
/* Gravity ? */
else if (t->type == task_type_grav_down) {
else if (t->type == task_type_grav_down ||
t->type == task_type_grav_long_range ||
t->type == task_type_grav_top_level) {
if (cell_is_active(t->ci, e)) scheduler_activate(s, t);
}
......
......@@ -1802,11 +1802,12 @@ void *runner_main(void *data) {
case task_type_grav_down:
// runner_do_grav_down(r, t->ci);
break;
/* case task_type_grav_gather_m: */
/* break; */
/* case task_type_grav_fft: */
/* runner_do_grav_fft(r); */
/* break; */
case task_type_grav_top_level:
// runner_do_grav_top_level(r);
break;
case task_type_grav_long_range:
// runner_do_grav_fft(r);
break;
case task_type_cooling:
if (e->policy & engine_policy_cooling) runner_do_end_force(r, ci, 1);
runner_do_cooling(r, t->ci, 1);
......
......@@ -247,6 +247,9 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements,
c->drift = NULL;
c->cooling = NULL;
c->sourceterms = NULL;
c->grav_top_level = NULL;
c->grav_long_range = NULL;
c->grav_down = NULL;
c->super = c;
if (c->sort != NULL) {
free(c->sort);
......
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