From d3b1883fed1908f65d3e012a3d061df12e989a1d Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 22 Mar 2017 10:50:45 +0800
Subject: [PATCH] Added check that the cell has been drifted before sorting it.

---
 src/runner.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/runner.c b/src/runner.c
index 7308d85a2b..d3f931444c 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -340,7 +340,10 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int clock) {
   const int count = c->count;
   float buff[8];
 
-  TIMER_TIC
+  TIMER_TIC;
+
+  /* Check that the particles have been moved to the current time */
+  if (!cell_is_drifted(c, r->e)) error("Sorting un-drifted cell");
 
   /* Clean-up the flags, i.e. filter out what's already been sorted, but
      only if the sorts are recent. */
-- 
GitLab