diff --git a/src/cell.c b/src/cell.c index cc893824a72e008808735a2c651ea8c98fe5490c..396e473e75662586cf92d1f3bebbc8e8d80c9f6a 100644 --- a/src/cell.c +++ b/src/cell.c @@ -3329,7 +3329,8 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj, /* Can we use multipoles ? */ if (cell_can_use_pair_mm(ci, cj, e, sp, /*use_rebuild_data=*/0, - /*is_top_level=*/0)) { + /*is_tree_walk=*/1)) { + /* Ok, no need to drift anything */ return; } @@ -6388,19 +6389,21 @@ void cell_reorder_extra_gparts(struct cell *c, struct part *parts, * @param s The #space. * @param use_rebuild_data Are we considering the data at the last tree-build * (1) or current data (0)? + * @param is_tree_walk Are we calling this in the tree walk (1) or for the + * top-level task construction (0)? */ int cell_can_use_pair_mm(const struct cell *restrict ci, const struct cell *restrict cj, const struct engine *e, const struct space *s, const int use_rebuild_data, - const int is_top_level) { + const int is_tree_walk) { const struct gravity_props *props = e->gravity_properties; const int periodic = s->periodic; const double dim[3] = {s->dim[0], s->dim[1], s->dim[2]}; /* Check for trivial cases */ - if (!is_top_level && ci->grav.count <= 1) return 0; - if (!is_top_level && cj->grav.count <= 1) return 0; + if (is_tree_walk && ci->grav.count <= 1) return 0; + if (is_tree_walk && cj->grav.count <= 1) return 0; /* Recover the multipole information */ const struct gravity_tensors *restrict multi_i = ci->grav.multipole; diff --git a/src/cell.h b/src/cell.h index b4980a158eb95e3a0146e569b9487ce0f5a3a762..b233dab755a59617450db8dd7e81832c2bb46fab 100644 --- a/src/cell.h +++ b/src/cell.h @@ -960,7 +960,7 @@ void cell_reorder_extra_gparts(struct cell *c, struct part *parts, void cell_reorder_extra_sparts(struct cell *c, const ptrdiff_t sparts_offset); int cell_can_use_pair_mm(const struct cell *ci, const struct cell *cj, const struct engine *e, const struct space *s, - const int use_rebuild_data, const int is_top_level); + const int use_rebuild_data, const int is_tree_walk); /** * @brief Compute the square of the minimal distance between any two points in diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index c931630fbd07bbfdc1beec7640bdb352f33207a8..b73aa475c008cbb77f53e981d49f61c43ab845fb 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1382,7 +1382,7 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements, /* Are the cells too close for a MM interaction ? */ if (!cell_can_use_pair_mm(ci, cj, e, s, /*use_rebuild_data=*/1, - /*is_top_level=*/1)) { + /*is_tree_walk=*/0)) { /* Ok, we need to add a direct pair calculation */ scheduler_addtask(sched, task_type_pair, task_subtype_grav, 0, 0, diff --git a/src/runner_doiact_grav.c b/src/runner_doiact_grav.c index bcddbbc283ac1500133e94213a146ff357fe39e0..731d7aa9f6a56cb22c34cfe8bbc581910ad30b4e 100644 --- a/src/runner_doiact_grav.c +++ b/src/runner_doiact_grav.c @@ -2402,7 +2402,7 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, } if (cell_can_use_pair_mm(top, cj, e, e->s, /*use_rebuild_data=*/1, - /*is_top_level=*/1)) { + /*is_tree_walk=*/0)) { /* Call the PM interaction fucntion on the active sub-cells of ci */ runner_dopair_grav_mm_nonsym(r, ci, cj); diff --git a/src/scheduler.c b/src/scheduler.c index 98da3b10ec85c40e17763bb3676f31c2411c5e55..bb380e5a51f478fb53762e805ef1bbbdb0fceec7 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -874,7 +874,7 @@ static void scheduler_splittask_gravity(struct task *t, struct scheduler *s) { /* Can we use a M-M interaction here? */ if (cell_can_use_pair_mm(ci->progeny[i], cj->progeny[j], e, sp, /*use_rebuild_data=*/1, - /*is_top_level=*/0)) { + /*is_tree_walk=*/1)) { /* Flag this pair as being treated by the M-M task. * We use the 64 bits in the task->flags field to store