From da42ff05f68630efa5ebf2ddc44a254ece4a404e Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Tue, 11 Jun 2019 12:23:21 +0100
Subject: [PATCH] Merge branch 'timestep_ignore_inhibited' into 'master'

The time-step task should ignore inhibited particles when computing the next time-step end.

See merge request swift/swiftsim!828

(cherry picked from commit 41561056dd0a9afccc3a4fe3279320b02b3077f0)

1f3b63aa The time-step task should ignore inhibited particles when computing the next time-step end.
---
 src/runner.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/runner.c b/src/runner.c
index c1ac634eb7..bd0bf01a1e 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -3098,7 +3098,10 @@ void runner_do_timestep(struct runner *r, struct cell *c, int timer) {
       else { /* part is inactive */
 
         /* Count the number of inhibited particles */
-        if (part_is_inhibited(p, e)) inhibited++;
+        if (part_is_inhibited(p, e)) {
+          inhibited++;
+          continue;
+        }
 
         const integertime_t ti_end =
             get_integer_time_end(ti_current, p->time_bin);
@@ -3167,7 +3170,10 @@ void runner_do_timestep(struct runner *r, struct cell *c, int timer) {
         } else { /* gpart is inactive */
 
           /* Count the number of inhibited particles */
-          if (gpart_is_inhibited(gp, e)) g_inhibited++;
+          if (gpart_is_inhibited(gp, e)) {
+            g_inhibited++;
+            continue;
+          }
 
           const integertime_t ti_end =
               get_integer_time_end(ti_current, gp->time_bin);
@@ -3226,7 +3232,10 @@ void runner_do_timestep(struct runner *r, struct cell *c, int timer) {
       } else {
 
         /* Count the number of inhibited particles */
-        if (spart_is_inhibited(sp, e)) ++s_inhibited;
+        if (spart_is_inhibited(sp, e)) {
+          ++s_inhibited;
+          continue;
+        }
 
         const integertime_t ti_end =
             get_integer_time_end(ti_current, sp->time_bin);
@@ -3288,7 +3297,10 @@ void runner_do_timestep(struct runner *r, struct cell *c, int timer) {
       } else {
 
         /* Count the number of inhibited particles */
-        if (bpart_is_inhibited(bp, e)) ++b_inhibited;
+        if (bpart_is_inhibited(bp, e)) {
+          ++b_inhibited;
+          continue;
+        }
 
         const integertime_t ti_end =
             get_integer_time_end(ti_current, bp->time_bin);
-- 
GitLab