From 2d35ec05e3d086429eaba1eb577fa2c84bb64380 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Sat, 16 Feb 2019 23:47:06 +0100
Subject: [PATCH] Use a separate function to check whether a cell has active
 sparts.

---
 src/active.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/active.h b/src/active.h
index 5bbbd3803c..dabb798855 100644
--- a/src/active.h
+++ b/src/active.h
@@ -85,9 +85,16 @@ __attribute__((always_inline)) INLINE static int cell_are_gpart_drifted(
 __attribute__((always_inline)) INLINE static int cell_are_spart_drifted(
     const struct cell *c, const struct engine *e) {
 
-  /* Currently just use the gpart drift
-   * This function is just for clarity */
-  return cell_are_gpart_drifted(c, e);
+#ifdef SWIFT_DEBUG_CHECKS
+  if (c->stars.ti_old_part > e->ti_current)
+    error(
+        "Cell has been drifted too far forward in time! c->ti_old=%lld (t=%e) "
+        "and e->ti_current=%lld (t=%e)",
+        c->stars.ti_old_part, c->stars.ti_old_part * e->time_base,
+        e->ti_current, e->ti_current * e->time_base);
+#endif
+
+  return (c->stars.ti_old_part == e->ti_current);
 }
 
 /* Are cells / particles active for regular tasks ? */
-- 
GitLab