From d6ae557df354b4b5bc49d8c1f5dbea140db7a025 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Tue, 28 May 2019 10:58:53 +0200
Subject: [PATCH] Better --fof help string and prevent the code from running
 with black holes seeding if the black holes policy has not been chosen.

---
 examples/main.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/examples/main.c b/examples/main.c
index ac385a0ec3..10e592109b 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -212,9 +212,10 @@ int main(int argc, char *argv[]) {
       OPT_BOOLEAN('S', "stars", &with_stars, "Run with stars.", NULL, 0, 0),
       OPT_BOOLEAN('B', "black-holes", &with_black_holes,
                   "Run with black holes.", NULL, 0, 0),
-      OPT_BOOLEAN('u', "fof", &with_fof,
-                  "Run Friends-of-Friends algorithm and black holes seeding.",
-                  NULL, 0, 0),
+      OPT_BOOLEAN(
+          'u', "fof", &with_fof,
+          "Run Friends-of-Friends algorithm to perform black hole seeding.",
+          NULL, 0, 0),
       OPT_BOOLEAN('x', "velociraptor", &with_structure_finding,
                   "Run with structure finding.", NULL, 0, 0),
       OPT_BOOLEAN(0, "limiter", &with_limiter, "Run with time-step limiter.",
@@ -373,6 +374,14 @@ int main(int argc, char *argv[]) {
     return 1;
   }
 
+  if (with_fof && !with_black_holes) {
+    if (myrank == 0)
+      printf(
+          "Error: Cannot perform FOF seeding without black holes being in use, "
+          "-B must be chosen.\n");
+    return 1;
+  }
+
   if (!with_stars && with_star_formation) {
     if (myrank == 0) {
       argparse_usage(&argparse);
-- 
GitLab