From 3f49741eaec996c10370fa2c3b245b0aca2cab3d Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Fri, 21 Sep 2018 16:22:15 +0200
Subject: [PATCH] Moved the check of negative flags for hydro pairs to the
 debug code. That never happens in real life code.

---
 src/scheduler.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/scheduler.c b/src/scheduler.c
index a71b901674..795ef9aa8f 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -1306,15 +1306,15 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
 
       case task_type_sub_pair:
         if (t->ci->nodeID != nodeID || t->cj->nodeID != nodeID) {
-          if (t->flags < 0)
-            cost = 3.f * (wscale * count_i) * count_j;
-          else
-            cost = 3.f * (wscale * count_i) * count_j * sid_scale[t->flags];
+#ifdef SWIFT_DEBUG_CHECKS
+          if (t->flags < 0) error("Negative flag value!");
+#endif
+	  cost = 3.f * (wscale * count_i) * count_j * sid_scale[t->flags];
         } else {
-          if (t->flags < 0)
-            cost = 2.f * (wscale * count_i) * count_j;
-          else
-            cost = 2.f * (wscale * count_i) * count_j * sid_scale[t->flags];
+#ifdef SWIFT_DEBUG_CHECKS
+          if (t->flags < 0) error("Negative flag value!");
+#endif
+	  cost = 2.f * (wscale * count_i) * count_j * sid_scale[t->flags];
         }
         break;
 
-- 
GitLab