From c6fc53d933cf3a389c06605a449f17bbfe5441fb Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Tue, 17 Jan 2017 14:49:30 +0000
Subject: [PATCH] Check that particles received from an other node have been
 properly drifted.

---
 src/cell.c   | 1 -
 src/runner.c | 7 +++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/cell.c b/src/cell.c
index d17ba527a3..64af8e146a 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -129,7 +129,6 @@ int cell_unpack(struct pcell *pc, struct cell *c, struct space *s) {
       temp->dx_max = 0.f;
       temp->nodeID = c->nodeID;
       temp->parent = c;
-      temp->ti_old = c->ti_old;
       c->progeny[k] = temp;
       c->split = 1;
       count += cell_unpack(&pc[pc->progeny[k]], temp, s);
diff --git a/src/runner.c b/src/runner.c
index 17309d2c8c..1daaded6a0 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -1222,15 +1222,18 @@ void runner_do_recv_cell(struct runner *r, struct cell *c, int timer) {
     for (size_t k = 0; k < nr_parts; k++) {
       const integertime_t ti_end =
           get_integer_time_end(ti_current, parts[k].time_bin);
-      // if(ti_end < ti_current) error("Received invalid particle !");
       ti_end_min = min(ti_end_min, ti_end);
       ti_end_max = max(ti_end_max, ti_end);
       h_max = max(h_max, parts[k].h);
+
+#ifdef SWIFT_DEBUG_CHECKS
+      if(parts[k].ti_drift != ti_current)
+	error("Received un-drifted particle !");
+#endif
     }
     for (size_t k = 0; k < nr_gparts; k++) {
       const integertime_t ti_end =
           get_integer_time_end(ti_current, gparts[k].time_bin);
-      // if(ti_end < ti_current) error("Received invalid particle !");
       ti_end_min = min(ti_end_min, ti_end);
       ti_end_max = max(ti_end_max, ti_end);
     }
-- 
GitLab