From f227c938f35337a936dae6475ea0965e7869aa9b Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Sat, 2 Nov 2019 21:00:41 +0100
Subject: [PATCH] Moved the time-step limiter interaction functions to one
 single common location.

---
 src/Makefile.am                               |  4 +-
 src/hydro/AnarchyDU/hydro_iact.h              | 45 ------------------
 src/hydro/AnarchyPU/hydro_iact.h              | 45 ------------------
 src/hydro/Default/hydro_iact.h                | 45 ------------------
 src/hydro/Gadget2/hydro_iact.h                | 33 -------------
 src/hydro/GizmoMFM/hydro_iact.h               | 25 ----------
 src/hydro/GizmoMFV/hydro_iact.h               | 25 ----------
 src/hydro/Minimal/hydro_iact.h                | 27 -----------
 src/hydro/Planetary/hydro_iact.h              | 24 ----------
 src/hydro/PressureEnergy/hydro_iact.h         | 23 ---------
 .../hydro_iact.h                              | 24 ----------
 src/hydro/PressureEntropy/hydro_iact.h        | 24 ----------
 src/hydro/Shadowswift/hydro_iact.h            | 25 ----------
 src/runner_doiact_limiter.c                   |  2 +-
 src/timestep_limiter_iact.h                   | 47 +++++++++++++++++++
 15 files changed, 50 insertions(+), 368 deletions(-)
 create mode 100644 src/timestep_limiter_iact.h

diff --git a/src/Makefile.am b/src/Makefile.am
index e00acf8799..8984b85dd7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,8 +98,8 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h
                  runner_doiact_functions_hydro.h runner_doiact_functions_stars.h runner_doiact_functions_black_holes.h \
 		 runner_doiact_functions_limiter.h runner_doiact_limiter.h units.h intrinsics.h minmax.h \
                  kick.h timestep.h drift.h adiabatic_index.h io_properties.h dimension.h part_type.h periodic.h memswap.h \
-                 dump.h logger.h sign.h logger_io.h timestep_limiter.h timestep_sync.h timestep_sync_part.h hashmap.h \
-		 gravity.h gravity_io.h gravity_cache.h \
+                 dump.h logger.h sign.h logger_io.h timestep_limiter.h timestep_limiter_iact.h timestep_sync.h timestep_sync_part.h \
+		 hashmap.h gravity.h gravity_io.h gravity_cache.h \
 		 gravity/Default/gravity.h gravity/Default/gravity_iact.h gravity/Default/gravity_io.h \
 		 gravity/Default/gravity_debug.h gravity/Default/gravity_part.h  \
 		 gravity/Potential/gravity.h gravity/Potential/gravity_iact.h gravity/Potential/gravity_io.h \
diff --git a/src/hydro/AnarchyDU/hydro_iact.h b/src/hydro/AnarchyDU/hydro_iact.h
index 17618830d4..215c88982b 100644
--- a/src/hydro/AnarchyDU/hydro_iact.h
+++ b/src/hydro/AnarchyDU/hydro_iact.h
@@ -570,49 +570,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
     pi->min_ngb_time_bin = min(pi->min_ngb_time_bin, pj->time_bin);
 }
 
-/**
- * @brief Timestep limiter loop
- *
- * @param r2 Comoving square distance between the two particles.
- * @param dx Comoving vector separating both particles (pi - pj).
- * @param hi Comoving smoothing-length of part*icle i.
- * @param hj Comoving smoothing-length of part*icle j.
- * @param pi First part*icle.
- * @param pj Second part*icle (not updated).
- * @param a Current scale factor.
- * @param H Current Hubble parameter.
- *
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- *
- * @param r2 Comoving square distance between the two particles.
- * @param dx Comoving vector separating both particles (pi - pj).
- * @param hi Comoving smoothing-length of part*icle i.
- * @param hj Comoving smoothing-length of part*icle j.
- * @param pi First part*icle.
- * @param pj Second part*icle (not updated).
- * @param a Current scale factor.
- * @param H Current Hubble parameter.
- *
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pj->time_bin > pi->time_bin + 2) {
-
-    /* Store the smallest time bin that woke up this particle */
-    pj->wakeup = max(pj->wakeup, -pi->time_bin);
-  }
-}
-
 #endif /* SWIFT_ANARCHY_DU_HYDRO_IACT_H */
diff --git a/src/hydro/AnarchyPU/hydro_iact.h b/src/hydro/AnarchyPU/hydro_iact.h
index bb53221908..9abd09a5f6 100644
--- a/src/hydro/AnarchyPU/hydro_iact.h
+++ b/src/hydro/AnarchyPU/hydro_iact.h
@@ -554,49 +554,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   pi->force.h_dt -= mj * dvdr * r_inv / rhoj * wi_dr;
 }
 
-/**
- * @brief Timestep limiter loop
- *
- * @param r2 Comoving square distance between the two particles.
- * @param dx Comoving vector separating both particles (pi - pj).
- * @param hi Comoving smoothing-length of part*icle i.
- * @param hj Comoving smoothing-length of part*icle j.
- * @param pi First part*icle.
- * @param pj Second part*icle (not updated).
- * @param a Current scale factor.
- * @param H Current Hubble parameter.
- *
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- *
- * @param r2 Comoving square distance between the two particles.
- * @param dx Comoving vector separating both particles (pi - pj).
- * @param hi Comoving smoothing-length of part*icle i.
- * @param hj Comoving smoothing-length of part*icle j.
- * @param pi First part*icle.
- * @param pj Second part*icle (not updated).
- * @param a Current scale factor.
- * @param H Current Hubble parameter.
- *
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->viscosity.v_sig >
-      const_limiter_max_v_sig_ratio * pj->viscosity.v_sig) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
-
 #endif /* SWIFT_ANARCHY_PU_HYDRO_IACT_H */
diff --git a/src/hydro/Default/hydro_iact.h b/src/hydro/Default/hydro_iact.h
index 07c8f0edc3..eb6612fe48 100644
--- a/src/hydro/Default/hydro_iact.h
+++ b/src/hydro/Default/hydro_iact.h
@@ -517,49 +517,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   pi->force.h_dt -= mj * dvdr * pi->force.f * r_inv / rhoj * wi_dr;
 }
 
-/**
- * @brief Timestep limiter loop
- *
- * @param r2 Comoving square distance between the two particles.
- * @param dx Comoving vector separating both particles (pi - pj).
- * @param hi Comoving smoothing-length of part*icle i.
- * @param hj Comoving smoothing-length of part*icle j.
- * @param pi First part*icle.
- * @param pj Second part*icle (not updated).
- * @param a Current scale factor.
- * @param H Current Hubble parameter.
- *
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- *
- * @param r2 Comoving square distance between the two particles.
- * @param dx Comoving vector separating both particles (pi - pj).
- * @param hi Comoving smoothing-length of part*icle i.
- * @param hj Comoving smoothing-length of part*icle j.
- * @param pi First part*icle.
- * @param pj Second part*icle (not updated).
- * @param a Current scale factor.
- * @param H Current Hubble parameter.
- *
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->viscosity.v_sig >
-      const_limiter_max_v_sig_ratio * pj->viscosity.v_sig) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
-
 #endif /* SWIFT_DEFAULT_HYDRO_IACT_H */
diff --git a/src/hydro/Gadget2/hydro_iact.h b/src/hydro/Gadget2/hydro_iact.h
index 118a29d771..27e8e8d8a2 100644
--- a/src/hydro/Gadget2/hydro_iact.h
+++ b/src/hydro/Gadget2/hydro_iact.h
@@ -1052,37 +1052,4 @@ runner_iact_nonsym_2_vec_force(
 
 #endif
 
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) {
-
-    // ALEXEI seems to crash with this option when running with debug checks
-    // on comparing ti_kick to ti_start in kick_part. Use code below instead
-    // (commented MATTHIEU)
-    // pj->wakeup = time_bin_awake;
-
-    // MATTHIEU
-    if (pj->wakeup == time_bin_not_awake)
-      pj->wakeup = time_bin_awake;
-    else if (pj->wakeup > 0)
-      pj->wakeup = -pj->wakeup;
-  }
-}
-
 #endif /* SWIFT_GADGET2_HYDRO_IACT_H */
diff --git a/src/hydro/GizmoMFM/hydro_iact.h b/src/hydro/GizmoMFM/hydro_iact.h
index 08e3de538a..e8b8efaeb7 100644
--- a/src/hydro/GizmoMFM/hydro_iact.h
+++ b/src/hydro/GizmoMFM/hydro_iact.h
@@ -488,29 +488,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0, a, H);
 }
 
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->timestepvars.vmax >
-      const_limiter_max_v_sig_ratio * pj->timestepvars.vmax) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
-
 #endif /* SWIFT_GIZMO_MFM_HYDRO_IACT_H */
diff --git a/src/hydro/GizmoMFV/hydro_iact.h b/src/hydro/GizmoMFV/hydro_iact.h
index 2ac5474f0e..1b8aac4ff8 100644
--- a/src/hydro/GizmoMFV/hydro_iact.h
+++ b/src/hydro/GizmoMFV/hydro_iact.h
@@ -503,29 +503,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0, a, H);
 }
 
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->timestepvars.vmax >
-      const_limiter_max_v_sig_ratio * pj->timestepvars.vmax) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
-
 #endif /* SWIFT_GIZMO_MFV_HYDRO_IACT_H */
diff --git a/src/hydro/Minimal/hydro_iact.h b/src/hydro/Minimal/hydro_iact.h
index 78d3301a16..ca896b8b30 100644
--- a/src/hydro/Minimal/hydro_iact.h
+++ b/src/hydro/Minimal/hydro_iact.h
@@ -436,31 +436,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
     pi->min_ngb_time_bin = min(pi->min_ngb_time_bin, pj->time_bin);
 }
 
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pj->time_bin > pi->time_bin + 2) {
-
-    // message("aa");
-
-    /* Store the smallest time bin that woke up this particle */
-    pj->wakeup = max(pj->wakeup, -pi->time_bin);
-  }
-}
-
 #endif /* SWIFT_MINIMAL_HYDRO_IACT_H */
diff --git a/src/hydro/Planetary/hydro_iact.h b/src/hydro/Planetary/hydro_iact.h
index 3a8d1f4e88..15340d302d 100644
--- a/src/hydro/Planetary/hydro_iact.h
+++ b/src/hydro/Planetary/hydro_iact.h
@@ -348,28 +348,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   pi->force.v_sig = max(pi->force.v_sig, v_sig);
 }
 
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
-
 #endif /* SWIFT_PLANETARY_HYDRO_IACT_H */
diff --git a/src/hydro/PressureEnergy/hydro_iact.h b/src/hydro/PressureEnergy/hydro_iact.h
index f0bd991522..f40253a081 100644
--- a/src/hydro/PressureEnergy/hydro_iact.h
+++ b/src/hydro/PressureEnergy/hydro_iact.h
@@ -437,28 +437,5 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   /* Update the signal velocity. */
   pi->force.v_sig = max(pi->force.v_sig, v_sig);
 }
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
 
 #endif /* SWIFT_PRESSURE_ENERGY_HYDRO_IACT_H */
diff --git a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h
index 3e0fec0459..6ed6dd2c36 100644
--- a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h
+++ b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h
@@ -426,28 +426,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   pi->force.v_sig = max(pi->force.v_sig, v_sig);
 }
 
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float* dx, float hi, float hj, struct part* restrict pi,
-    struct part* restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
-
 #endif /* SWIFT_PRESSURE_ENERGY_MORRIS_HYDRO_IACT_H */
diff --git a/src/hydro/PressureEntropy/hydro_iact.h b/src/hydro/PressureEntropy/hydro_iact.h
index d5045d77f2..194932f65e 100644
--- a/src/hydro/PressureEntropy/hydro_iact.h
+++ b/src/hydro/PressureEntropy/hydro_iact.h
@@ -404,28 +404,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
   pi->entropy_dt += mj * visc_term * r_inv * dvdr;
 }
 
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
-
 #endif /* SWIFT_PRESSURE_ENTROPY_HYDRO_IACT_H */
diff --git a/src/hydro/Shadowswift/hydro_iact.h b/src/hydro/Shadowswift/hydro_iact.h
index 791e4c7924..eda8e3759d 100644
--- a/src/hydro/Shadowswift/hydro_iact.h
+++ b/src/hydro/Shadowswift/hydro_iact.h
@@ -342,28 +342,3 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
 
   runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0, a, H);
 }
-
-/**
- * @brief Timestep limiter loop
- */
-__attribute__((always_inline)) INLINE static void runner_iact_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Nothing to do here if both particles are active */
-}
-
-/**
- * @brief Timestep limiter loop (non-symmetric version)
- */
-__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
-    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
-    struct part *restrict pj, float a, float H) {
-
-  /* Wake up the neighbour? */
-  if (pi->timestepvars.vmax >
-      const_limiter_max_v_sig_ratio * pj->timestepvars.vmax) {
-
-    pj->wakeup = time_bin_awake;
-  }
-}
diff --git a/src/runner_doiact_limiter.c b/src/runner_doiact_limiter.c
index 7387cc1e89..ac65ca063c 100644
--- a/src/runner_doiact_limiter.c
+++ b/src/runner_doiact_limiter.c
@@ -26,10 +26,10 @@
 #include "active.h"
 #include "cell.h"
 #include "engine.h"
-#include "hydro.h"
 #include "runner.h"
 #include "space_getsid.h"
 #include "timers.h"
+#include "timestep_limiter_iact.h"
 
 /* Import the limiter loop functions. */
 #define FUNCTION limiter
diff --git a/src/timestep_limiter_iact.h b/src/timestep_limiter_iact.h
new file mode 100644
index 0000000000..ba515260ed
--- /dev/null
+++ b/src/timestep_limiter_iact.h
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * This file is part of SWIFT.
+ * Copyright (c) 2018 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ ******************************************************************************/
+#ifndef SWIFT_TIMESTEP_LIMITER_IACT_H
+#define SWIFT_TIMESTEP_LIMITER_IACT_H
+
+/**
+ * @brief Timestep limiter loop
+ */
+__attribute__((always_inline)) INLINE static void runner_iact_limiter(
+    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
+    struct part *restrict pj, float a, float H) {
+
+  /* Nothing to do here if both particles are active */
+}
+
+/**
+ * @brief Timestep limiter loop (non-symmetric version)
+ */
+__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
+    float r2, const float *dx, float hi, float hj, struct part *restrict pi,
+    struct part *restrict pj, float a, float H) {
+
+  /* Wake up the neighbour? */
+  if (pj->time_bin > pi->time_bin + 2) {
+
+    /* Store the smallest time bin that woke up this particle */
+    pj->wakeup = max(pj->wakeup, -pi->time_bin);
+  }
+}
+
+#endif /* SWIFT_TIMESTEP_LIMITER_IACT_H */
-- 
GitLab