From 4a90c6c6eb93c6c7291599b160948a7d7e2313de Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Fri, 30 Jun 2017 11:07:23 +0100
Subject: [PATCH] Make sure we do not update a local cell in the receive tasks.

---
 src/runner.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/runner.c b/src/runner.c
index 5b09b89898..2ebb21e114 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -1518,6 +1518,11 @@ void runner_do_recv_part(struct runner *r, struct cell *c, int clear_sorts,
   timebin_t time_bin_max = 0;
   float h_max = 0.f;
 
+#ifdef SWIFT_DEBUG_CHECKS
+  if(c->nodeID == engine_rank)
+    error("Updating a local cell!");
+#endif
+
   /* Clear this cell's sorted mask. */
   if (clear_sorts) c->sorted = 0;
 
@@ -1597,6 +1602,11 @@ void runner_do_recv_gpart(struct runner *r, struct cell *c, int timer) {
   timebin_t time_bin_min = num_time_bins;
   timebin_t time_bin_max = 0;
 
+#ifdef SWIFT_DEBUG_CHECKS
+  if(c->nodeID == engine_rank)
+    error("Updating a local cell!");
+#endif
+
   /* If this cell is a leaf, collect the particle data. */
   if (!c->split) {
 
@@ -1670,6 +1680,11 @@ void runner_do_recv_spart(struct runner *r, struct cell *c, int timer) {
   timebin_t time_bin_min = num_time_bins;
   timebin_t time_bin_max = 0;
 
+#ifdef SWIFT_DEBUG_CHECKS
+  if(c->nodeID == engine_rank)
+    error("Updating a local cell!");
+#endif
+
   /* If this cell is a leaf, collect the particle data. */
   if (!c->split) {
 
-- 
GitLab