From 2d34a8e0e8fcb9ac2819e95fb4935c63f6a048ff Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Mon, 1 May 2017 11:53:33 +0100
Subject: [PATCH] Do not recurse in runner_do_timestep() if the cell is
 inactive. Just reset the counters to zero.

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

diff --git a/src/runner.c b/src/runner.c
index 778eb0c7c6..290f676105 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -1135,6 +1135,14 @@ void runner_do_timestep(struct runner *r, struct cell *c, int timer) {
 
   TIMER_TIC;
 
+  /* Anything to do here? */
+  if (!cell_is_active(c, e)) {
+    c->updated = 0;
+    c->g_updated = 0;
+    c->s_updated = 0;
+    return;
+  }
+
   int updated = 0, g_updated = 0, s_updated = 0;
   integertime_t ti_end_min = max_nr_timesteps, ti_end_max = 0, ti_beg_max = 0;
 
-- 
GitLab