From 3ba1096057f6cfdb24aa38e8e7794fb9592f5bb2 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Sun, 4 Aug 2019 23:14:33 +0200
Subject: [PATCH] Set the reposition of BH to -FLT_MAX when the reposition does
 not happen.

---
 src/black_holes/EAGLE/black_holes.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/black_holes/EAGLE/black_holes.h b/src/black_holes/EAGLE/black_holes.h
index 9092e80a47..2dd7345e8c 100644
--- a/src/black_holes/EAGLE/black_holes.h
+++ b/src/black_holes/EAGLE/black_holes.h
@@ -118,6 +118,8 @@ __attribute__((always_inline)) INLINE static void black_holes_predict_extra(
     }
 #endif
 
+    message("Reposition!");
+
     bp->x[0] = bp->reposition.x[0];
     bp->x[1] = bp->reposition.x[1];
     bp->x[2] = bp->reposition.x[2];
@@ -458,11 +460,9 @@ __attribute__((always_inline)) INLINE static void black_holes_prepare_feedback(
   }
 }
 
-__attribute__((always_inline)) INLINE static void
-black_holes_end_reposition(struct bpart* restrict bp,
-			   const struct black_holes_props* props,
-			   const struct phys_const* constants,
-			   const struct cosmology* cosmo) {
+__attribute__((always_inline)) INLINE static void black_holes_end_reposition(
+    struct bpart* restrict bp, const struct black_holes_props* props,
+    const struct phys_const* constants, const struct cosmology* cosmo) {
 
   const float potential = gravity_get_comoving_potential(bp->gpart);
 
@@ -471,8 +471,13 @@ black_holes_end_reposition(struct bpart* restrict bp,
   if (potential < bp->reposition.min_potential ||
       bp->subgrid_mass > props->max_reposition_mass) {
 
+    message("No repo!");
+
     /* No need to reposition */
     bp->reposition.min_potential = FLT_MAX;
+    bp->reposition.x[0] = -FLT_MAX;
+    bp->reposition.x[1] = -FLT_MAX;
+    bp->reposition.x[2] = -FLT_MAX;
   }
 }
 
-- 
GitLab