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