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

Abort recursion early in the gravity tasks if the cells are inactive

parent c6011947
No related branches found
No related tags found
No related merge requests found
......@@ -712,6 +712,9 @@ void runner_dopair_grav(struct runner *r, struct cell *ci, struct cell *cj,
}
#endif
/* Anything to do here? */
if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return;
TIMER_TIC;
/* Can we use M-M interactions ? */
......@@ -796,6 +799,9 @@ void runner_dopair_grav(struct runner *r, struct cell *ci, struct cell *cj,
*/
void runner_doself_grav(struct runner *r, struct cell *c, int gettimer) {
/* Some constants */
const struct engine *e = r->e;
#ifdef SWIFT_DEBUG_CHECKS
/* Early abort? */
if (c->gcount == 0) error("Doing self gravity on an empty cell !");
......@@ -803,6 +809,9 @@ void runner_doself_grav(struct runner *r, struct cell *c, int gettimer) {
TIMER_TIC;
/* Anything to do here? */
if (!cell_is_active(c, e)) return;
/* If the cell is split, interact each progeny with itself, and with
each of its siblings. */
if (c->split) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment