From e10da7ea7cb5f6bd5e65d2a252a4a8f1eb88aac2 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Wed, 1 Feb 2023 22:29:53 +0800
Subject: [PATCH] Use the new checking functions after every step

---
 src/engine.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/engine.c b/src/engine.c
index 9bae8120d1..fd62ed4d43 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -2078,6 +2078,16 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
     stars_exact_density_check(e->s, e, /*rel_tol=*/1e-3);
 #endif
 
+#ifdef SWIFT_BLACK_HOLES_DENSITY_CHECKS
+  /* Run the brute-force black holes calculation for some parts */
+  if (e->policy & engine_policy_black_holes)
+    black_holes_exact_density_compute(e->s, e);
+
+  /* Check the accuracy of the black holes calculation */
+  if (e->policy & engine_policy_black_holes)
+    black_holes_exact_density_check(e->s, e, /*rel_tol=*/1e-3);
+#endif
+
 #ifdef SWIFT_GRAVITY_FORCE_CHECKS
   /* Check the accuracy of the gravity calculation */
   if (e->policy & engine_policy_self_gravity)
@@ -2611,6 +2621,16 @@ int engine_step(struct engine *e) {
     stars_exact_density_check(e->s, e, /*rel_tol=*/1e-2);
 #endif
 
+#ifdef SWIFT_BLACK_HOLES_DENSITY_CHECKS
+  /* Run the brute-force black holes calculation for some parts */
+  if (e->policy & engine_policy_black_holes)
+    black_holes_exact_density_compute(e->s, e);
+
+  /* Check the accuracy of the black holes calculation */
+  if (e->policy & engine_policy_black_holes)
+    black_holes_exact_density_check(e->s, e, /*rel_tol=*/1e-3);
+#endif
+
 #ifdef SWIFT_GRAVITY_FORCE_CHECKS
   /* Check if we want to run force checks this timestep. */
   if (e->policy & engine_policy_self_gravity) {
-- 
GitLab