From 9a43bec347a5dd772ca4aa5133e659f556b2ea53 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Fri, 12 Apr 2019 15:57:45 +0200 Subject: [PATCH 1/3] Crash gracefully on start-up if the user compiled with cooling but forgot the runtime flag. --- examples/main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/main.c b/examples/main.c index 52eed321a..b01dce41e 100644 --- a/examples/main.c +++ b/examples/main.c @@ -742,12 +742,19 @@ int main(int argc, char *argv[]) { if (myrank == 0) potential_print(&potential); /* Initialise the cooling function properties */ - bzero(&cooling_func, sizeof(struct cooling_function_data)); - if (with_cooling || with_temperature) { #ifdef COOLING_NONE - if (with_cooling) - error("ERROR: Running with cooling but compiled without it."); + if (with_cooling || with_temperature) { + error("ERROR: Running with cooling / temperature calculation" + "but compiled without it."); + } +#else + if (!with_cooling && !with_temperature) { + error("ERROR: Compiled with cooling but running without it." + "Did you forget the --cooling or --temperature flags?"); + } #endif + bzero(&cooling_func, sizeof(struct cooling_function_data)); + if (with_cooling || with_temperature) { cooling_init(params, &us, &prog_const, &cooling_func); } if (myrank == 0) cooling_print(&cooling_func); -- GitLab From d48403d32f701cef7ffe7bbaf741f9651ecd71af Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" Date: Fri, 12 Apr 2019 15:53:46 +0100 Subject: [PATCH 2/3] Need a space between . and next character. --- examples/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/main.c b/examples/main.c index b01dce41e..66bbab458 100644 --- a/examples/main.c +++ b/examples/main.c @@ -749,7 +749,7 @@ int main(int argc, char *argv[]) { } #else if (!with_cooling && !with_temperature) { - error("ERROR: Compiled with cooling but running without it." + error("ERROR: Compiled with cooling but running without it. " "Did you forget the --cooling or --temperature flags?"); } #endif -- GitLab From 121b6ad97eca342a08d20397b000f6a06a7e2c5f Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" Date: Fri, 12 Apr 2019 16:27:19 +0100 Subject: [PATCH 3/3] Another space required. --- examples/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/main.c b/examples/main.c index 66bbab458..24218fe08 100644 --- a/examples/main.c +++ b/examples/main.c @@ -745,7 +745,7 @@ int main(int argc, char *argv[]) { #ifdef COOLING_NONE if (with_cooling || with_temperature) { error("ERROR: Running with cooling / temperature calculation" - "but compiled without it."); + " but compiled without it."); } #else if (!with_cooling && !with_temperature) { -- GitLab