14#include <spdlog/spdlog.h>
15#include <tclap/CmdLine.h>
46 _MM_SET_EXCEPTION_MASK(_MM_GET_EXCEPTION_MASK() & ~_MM_MASK_INVALID);
49 feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
54int main(
int argc,
char* argv[])
65 INFO(
"This is OpenGeoSys-6 version {:s}.",
68 if (cli_arg.
outdir.length() > 0)
70 std::error_code mkdir_err;
71 if (std::filesystem::create_directories(cli_arg.
outdir, mkdir_err))
73 INFO(
"Output directory {:s} created.", cli_arg.
outdir);
75 else if (mkdir_err.value() != 0)
78 "Could not create output directory {:s}. Error code {:d}, {:s}",
79 cli_arg.
outdir, mkdir_err.value(), mkdir_err.message());
86 auto const start_time = std::chrono::system_clock::now();
88 INFO(
"OGS started on {:s}.", time_str);
91 std::optional<ApplicationsLib::TestDefinition> test_definition{
93 auto ogs_status = EXIT_SUCCESS;
105 bool solver_succeeded =
simulation.executeSimulation();
107 test_definition =
simulation.getTestDefinition();
109 INFO(
"[time] Execution took {:g} s.", run_time.
elapsed());
110 ogs_status = solver_succeeded ? EXIT_SUCCESS : EXIT_FAILURE;
112 catch (std::exception& e)
115 ogs_status = EXIT_FAILURE;
119 auto const end_time = std::chrono::system_clock::now();
121 INFO(
"OGS terminated on {:s}.", time_str);
124 if (ogs_status == EXIT_FAILURE)
126 ERR(
"OGS terminated with error.");
130 if (!test_definition)
137 INFO(
"##########################################");
138 INFO(
"# Running tests #");
139 INFO(
"##########################################");
141 if (!test_definition->runTests())
143 ERR(
"One of the tests failed.");
CommandLineArguments parseCommandLineArguments(int argc, char *argv[], bool const exit_on_exception)
Declaration of CommandLineArgumentParser.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the RunTime class.
Declaration of class Simulation.
double elapsed() const
Get the elapsed time in seconds.
void start()
Start the timer.
void initOGSLogger(std::string const &log_level)
std::string formatDate(std::chrono::time_point< std::chrono::system_clock > const &time)
GITINFOLIB_EXPORT const std::string ogs_version
int main(int argc, char *argv[])
void enableFloatingPointExceptions()
std::unique_ptr< Simulation > simulation
bool reference_path_is_set
std::string reference_path
std::vector< std::string > xml_patch_file_names