From 5bd5ebb22c71e9bf297f53454ef56572773ac4bf Mon Sep 17 00:00:00 2001 From: MFraters Date: Tue, 13 Feb 2024 22:00:32 -0500 Subject: [PATCH] Change the meaning of bool limit-debug-consistency-checks to be more intuative. --- include/world_builder/world.h | 2 +- source/gwb-dat/main.cc | 6 +++--- source/world_builder/world.cc | 2 +- tests/gwb-dat/testing_too_many_arguments/screen-output.log | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/world_builder/world.h b/include/world_builder/world.h index 246ef2f91..fa0c41bfd 100644 --- a/include/world_builder/world.h +++ b/include/world_builder/world.h @@ -60,7 +60,7 @@ namespace WorldBuilder * documented algorithm), we can test the results and they should be the same even for different * compilers and machines. */ - World(std::string filename, bool has_output_dir = false, const std::string &output_dir = "", unsigned long random_number_seed = 1, const bool limit_debug_consistency_checks = false); + World(std::string filename, bool has_output_dir = false, const std::string &output_dir = "", unsigned long random_number_seed = 1, const bool limit_debug_consistency_checks = true); /** * Destructor diff --git a/source/gwb-dat/main.cc b/source/gwb-dat/main.cc index 1e997312c..c1a25ba85 100644 --- a/source/gwb-dat/main.cc +++ b/source/gwb-dat/main.cc @@ -73,7 +73,7 @@ int main(int argc, char **argv) unsigned int grain_compositions = 0; size_t n_grains = 0; bool convert_spherical = false; - bool limit_debug_consistency_checks = true; + bool limit_debug_consistency_checks = false; bool output_json_files = false; if (find_command_line_option(argv, argv+argc, "-h") || find_command_line_option(argv, argv+argc, "--help")) @@ -86,7 +86,7 @@ int main(int argc, char **argv) } if (find_command_line_option(argv, argv+argc, "-ldcc") || find_command_line_option(argv, argv+argc, "--limit-debug-consistency-checks")) - limit_debug_consistency_checks = false; + limit_debug_consistency_checks = true; if (find_command_line_option(argv, argv+argc, "--output-json-files")) output_json_files = true; @@ -106,7 +106,7 @@ int main(int argc, char **argv) return 0; } - if ((argc == 3 && (!limit_debug_consistency_checks || output_json_files)) || (argc == 3 && (!limit_debug_consistency_checks && output_json_files)) || argc > 5) + if ((argc == 3 && !(limit_debug_consistency_checks && output_json_files)) || (argc == 4 && !(!limit_debug_consistency_checks != !output_json_files)) || (argc == 5 && (!limit_debug_consistency_checks && !output_json_files)) || argc > 5) { std::cout << "Only exactly two command line arguments may be given, which should be the world builder file location and the data file location (in that order) " << "or exactly three command line arguments, which should be the world builder file location, the data file location and --limit-debug-consistency-checks or --output-json-files (in that order)," diff --git a/source/world_builder/world.cc b/source/world_builder/world.cc index 5794411e2..54a61af17 100644 --- a/source/world_builder/world.cc +++ b/source/world_builder/world.cc @@ -306,7 +306,7 @@ namespace WorldBuilder // We receive the cartesian points from the user. const Point<3> point(point_,cartesian); (void) this->limit_debug_consistency_checks; - WBAssert(!this->limit_debug_consistency_checks || this->parameters.coordinate_system->natural_coordinate_system() == cartesian + WBAssert(this->limit_debug_consistency_checks || this->parameters.coordinate_system->natural_coordinate_system() == cartesian || approx(depth, this->parameters.coordinate_system->max_model_depth()-sqrt(point_[0]*point_[0]+point_[1]*point_[1]+point_[2]*point_[2])), "Inconsistent input. Please check whether the radius in the sperhical coordinates is consistent with the radius of the planet as defined " << "in the program that uses the Geodynamic World Builder. " diff --git a/tests/gwb-dat/testing_too_many_arguments/screen-output.log b/tests/gwb-dat/testing_too_many_arguments/screen-output.log index 732f9115e..a7d3c9dd9 100644 --- a/tests/gwb-dat/testing_too_many_arguments/screen-output.log +++ b/tests/gwb-dat/testing_too_many_arguments/screen-output.log @@ -1 +1 @@ -Only exactly two command line arguments may be given, which should be the world builder file location and the data file location (in that order) or exactly three command line arguments, which should be the world builder file location, the data file location and --limit-debug-consistency-checks (in that order). , argc = 5, limit_debug_consistency_checks = true +Only exactly two command line arguments may be given, which should be the world builder file location and the data file location (in that order) or exactly three command line arguments, which should be the world builder file location, the data file location and --limit-debug-consistency-checks or --output-json-files (in that order),or exactly four comman line arguments, which should be the world builder file location, the data file location and --limit-debug-consistency-checks and --output-json-files (in that order),, argc = 5, limit_debug_consistency_checks = false, output_json_files = false