From ad8fd4036c5783e66070004be8bc429c36ceebcb Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 2 Aug 2017 12:49:19 +0100
Subject: [PATCH] In engine_marktask() only check whether to rebuild the space
 for density pair/sub-pair, not for all sub-types of pair/sub-pair.

---
 src/engine.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 89bb6c693e..dbd65d248f 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -2579,9 +2579,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
       /* If this task does not involve any active cells, skip it. */
       if (!cell_is_active(t->ci, e) && !cell_is_active(t->cj, e)) continue;
 
-      /* Too much particle movement? */
-      if (cell_need_rebuild_for_pair(ci, cj)) *rebuild_space = 1;
-
       /* Only activate tasks that involve a local active cell. */
       if ((cell_is_active(ci, e) && ci->nodeID == engine_rank) ||
           (cj != NULL && cell_is_active(cj, e) && cj->nodeID == engine_rank)) {
@@ -2613,6 +2610,9 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
       /* Only interested in density tasks as of here. */
       if (t->subtype == task_subtype_density) {
 
+	/* Too much particle movement? */
+	if (cell_need_rebuild_for_pair(ci, cj)) *rebuild_space = 1;
+
 #ifdef WITH_MPI
         /* Activate the send/recv tasks. */
         if (ci->nodeID != engine_rank) {
-- 
GitLab