From 886706a18ba0c6f6bbcbcaacc7860e7a3b9678b1 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Wed, 2 Aug 2017 21:42:29 +0100 Subject: [PATCH] Abort recursion early in the gravity tasks if the cells are inactive --- src/runner_doiact_grav.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/runner_doiact_grav.h b/src/runner_doiact_grav.h index 702274e4d1..a5b803ae62 100644 --- a/src/runner_doiact_grav.h +++ b/src/runner_doiact_grav.h @@ -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) { -- GitLab