16{
17
18 TCLAP::CmdLine cmd(
19 "OpenGeoSys-6 software."
20 "\n"
21 "Copyright (c) 2012-2026, OpenGeoSys Community "
22 "(https://www.opengeosys.org) "
23 "\n"
24 "Distributed under a Modified BSD License. "
25 "See accompanying file LICENSE.txt or "
26 "https://www.opengeosys.org/project/license"
27 "\n"
28 "version: " +
30 "\n"
31 "CMake arguments: " +
32 CMakeInfoLib::CMakeInfo::cmake_args,
33 ' ',
35 "CMake arguments: " + CMakeInfoLib::CMakeInfo::cmake_args);
36
38 cmd.setOutput(&tclapOutput);
39 cmd.setExceptionHandling(exit_on_exception);
40
41 TCLAP::SwitchArg log_parallel("", "log-parallel",
42 "enables all MPI ranks to log");
43
44#ifndef _WIN32
45
46 TCLAP::SwitchArg enable_fpe_arg("", "enable-fpe",
47 "enables floating point exceptions");
48#endif
49 TCLAP::SwitchArg unbuffered_cout_arg("", "unbuffered-std-out",
50 "use unbuffered standard output");
51
52 TCLAP::ValueArg<std::string> reference_path_arg(
53 "r", "reference",
54 "Input. Run output result comparison after successful simulation "
55 "comparing to all files in the given path. This requires test "
56 "definitions to be present in the project file.",
57 false, "", "REF_PATH");
58
59 TCLAP::UnlabeledValueArg<std::string> project_arg(
60 "project-file",
61 "Input (.prj|.xml). Path to the ogs6 project file",
62 true,
63 "",
64 "PROJECT_FILE");
65
66 TCLAP::MultiArg<std::string> xml_patch_files_arg(
67 "p", "xml-patch",
68 "Input (.xml). The xml patch file(s) which is (are) applied (in the "
69 "given order) "
70 "to the PROJECT_FILE",
71 false, "XML_PATCH_FILE");
72
73 TCLAP::ValueArg<std::string> outdir_arg(
74 "o", "output-directory", "Output. The output directory to write to",
75 false, "", "OUTPUT_PATH");
76
77 TCLAP::ValueArg<std::string> mesh_dir_arg(
78 "m", "mesh-input-directory",
79 "Input. The directory where the meshes are read from", false, "",
80 "MESH_DIR_PATH");
81
82 TCLAP::ValueArg<std::string> script_dir_arg(
83 "s", "script-input-directory",
84 "Input. The directory where script files (e.g. Python BCs) are read "
85 "from",
86 false, "", "SCRIPT_DIR_PATH");
87
88 TCLAP::SwitchArg write_prj_arg("",
89 "write-prj",
90 "Writes processed project file to output "
91 "path / [prj_base_name]_processed.prj.");
92
93 TCLAP::SwitchArg nonfatal_arg("",
94 "config-warnings-nonfatal",
95 "warnings from parsing the configuration "
96 "file will not trigger program abortion");
97 cmd.add(reference_path_arg);
98 cmd.add(project_arg);
99 cmd.add(xml_patch_files_arg);
100 cmd.add(outdir_arg);
101 cmd.add(mesh_dir_arg);
102 cmd.add(script_dir_arg);
103 cmd.add(write_prj_arg);
104 cmd.add(log_parallel);
106 cmd.add(log_level_arg);
107 cmd.add(nonfatal_arg);
108 cmd.add(unbuffered_cout_arg);
109#ifndef _WIN32
110
111 cmd.add(enable_fpe_arg);
112#endif
113
114 cmd.parse(argc, argv);
115
119 cli_args.
project = project_arg.getValue();
120
123 cli_args.
outdir = outdir_arg.getValue();
125 mesh_dir_arg.getValue().empty() ? project_dir : mesh_dir_arg.getValue();
126 cli_args.
script_dir = script_dir_arg.getValue().empty()
127 ? project_dir
128 : script_dir_arg.getValue();
129 cli_args.
nonfatal = nonfatal_arg.getValue();
131 cli_args.
log_level = log_level_arg.getValue();
132 cli_args.
write_prj = write_prj_arg.getValue();
133
134
135 if (unbuffered_cout_arg.isSet())
136 {
137 std::cout.setf(std::ios::unitbuf);
138 }
139#ifndef _WIN32
141#endif
142
143 return cli_args;
144}
TCLAP::ValueArg< std::string > makeLogLevelArg()
std::string extractPath(std::string const &pathname)
GITINFOLIB_EXPORT const std::string ogs_version
bool reference_path_is_set
std::string reference_path
std::vector< std::string > xml_patch_file_names