10 #ifdef HAVE_GPERFTOOLS    11 #include "gperftools/profiler.h"    12 #include "gperftools/heap-profiler.h"    16 #include "MooseRevision.h"    64 #include "libmesh/exodusII_io.h"    65 #include "libmesh/mesh_refinement.h"    66 #include "libmesh/string_to_enum.h"    67 #include "libmesh/checkpoint_io.h"    68 #include "libmesh/mesh_base.h"    69 #include "libmesh/petsc_solver_exception.h"    72 #ifdef LIBMESH_HAVE_DLOPEN    74 #include <sys/utsname.h>     77 #ifdef MOOSE_LIBTORCH_ENABLED    78 #include <torch/version.h>    84 #include <sys/types.h>    97       "app_to_run", 
"--app <type>", 
"Specify the application type to run (case-sensitive)");
   104       "input_file", 
"-i <input file(s)>", 
"Specify input file(s); multiple files are merged");
   115   params.
addCommandLineParam<
bool>(
"display_version", 
"-v --version", 
"Print application version");
   119       "--mesh-only <optional path>",
   121       "Build and output the mesh only (Default: \"<input_file_name>_in.e\")");
   124       "--csg-only <optional path>",
   126       "Setup and output the input mesh in CSG format only (Default: "   127       "\"<input_file_name>_out_csg.json\")");
   129       "show_input", 
"--show-input", 
"Shows the parsed input file before running the simulation");
   132       "show_outputs", 
"--show-outputs", 
"Shows the output execution time information");
   135       "show_controls", 
"--show-controls", 
"Shows the Control logic available and executed");
   139       "no_color", 
"--no-color", 
"Disable coloring of all Console outputs");
   144       "color", 
"--color <auto,on,off=on>", colors, 
"Whether to use color in console output");
   151       "Ignore input file and build a minimal application with Transient executioner");
   156       "Starts a process to communicate with development tools using the language server protocol");
   159       "definition", 
"--definition", 
"Shows a SON style input definition dump for input validation");
   160   params.
addCommandLineParam<
bool>(
"dump", 
"--dump", 
"Shows a dump of available input file syntax");
   163       "--dump-search <search>",
   164       "Shows a dump of available input syntax matching a search");
   165   params.
addCommandLineParam<
bool>(
"registry", 
"--registry", 
"Lists all known objects and actions");
   167       "registry_hit", 
"--registry-hit", 
"Lists all known objects and actions in hit format");
   169       "use_executor", 
"--executor", 
"Use the new Executor system instead of Executioners");
   172       "show_type", 
"--show-type", 
"Return the name of the application object");
   173   params.
addCommandLineParam<
bool>(
"yaml", 
"--yaml", 
"Dumps all input file syntax in YAML format");
   175       "yaml_search", 
"--yaml-search", 
"Dumps input file syntax matching a search in YAML format");
   176   params.
addCommandLineParam<
bool>(
"json", 
"--json", 
"Dumps all input file syntax in JSON format");
   178       "json_search", 
"--json-search", 
"Dumps input file syntax matching a search in JSON format");
   180       "syntax", 
"--syntax", 
"Dumps the associated Action syntax paths ONLY");
   182       "show_docs", 
"--docs", 
"Print url/path to the documentation website");
   184       "show_capabilities", 
"--show-capabilities", 
"Dumps the capability registry in JSON format.");
   186       "required_capabilities",
   187       "--required-capabilities",
   188       "A list of conditions that is checked against the registered capabilities (see "   189       "--show-capabilities). The executable will terminate early if the conditions are not met.");
   191       "check_capabilities",
   192       "--check-capabilities",
   193       "A list of conditions that is checked against the registered capabilities. Will exit based "   194       "on whether or not the capaiblities are fulfilled. Does not check dynamically loaded apps.");
   197                                    "Check the input file (i.e. requires -i <filename>) and quit");
   201       "--show-copyable-inputs",
   202       "Shows the directories able to be copied into a user-writable location");
   206       "--copy-inputs <dir>",
   207       "Copies installed inputs (e.g. tests, examples, etc.) to a directory <appname>_<dir>");
   212       "--run <test harness args>",
   214       "Runs the inputs in the current directory copied to a "   215       "user-writable location by \"--copy-inputs\"");
   218       "list_constructed_objects",
   219       "--list-constructed-objects",
   220       "List all moose object type names constructed by the master app factory");
   223       "n_threads", 
"--n-threads=<n>", 
"Runs the specified number of threads per process");
   230                                    "Warn about unused input file options instead of erroring");
   233       "error_unused", 
"-e --error-unused", 
"Error when encountering unused input file options");
   237       "-o --error-override",
   238       "Error when encountering overridden or parameters supplied multiple times");
   241       "error_deprecated", 
"--error-deprecated", 
"Turn deprecated code messages into Errors");
   245                                    "--distributed-mesh",
   246                                    "Forces the use of a distributed finite element mesh");
   253       "--split-mesh <splits>",
   254       "Comma-separated list of numbers of chunks to split the mesh into");
   258       "split_file", 
"--split-file <filename>", 
"Name of split mesh file(s) to write/read");
   260   params.
addCommandLineParam<
bool>(
"use_split", 
"--use-split", 
"Use split distributed mesh files");
   263       "refinements", 
"-r <num refinements>", 
"Specify additional initial uniform mesh refinements");
   267       "--recover <optional file base>",
   269       "Continue the calculation. Without <file base>, the most recent recovery file will be used");
   274       "Forcefully load checkpoints despite possible incompatibilities");
   280                                    "Disables the output of the application header.");
   284       "test_checkpoint_half_transient",
   285       "--test-checkpoint-half-transient",
   286       "Run half of a transient with checkpoints enabled; used by the TestHarness");
   291                                    "Test re-running the middle timestep; used by the TestHarness");
   296       "Enable floating point exception handling in critical sections of code"   298       " (automatic due to debug build)"   306       "Disable floating point exception handling in critical sections of code"   308       " (unused due to non-debug build)"   315       "no_gdb_backtrace", 
"--no-gdb-backtrace", 
"Disables gdb backtraces.");
   323                                    "Enable all performance logging for timing; disables screen "   324                                    "output of performance logs for all Console objects");
   327       "no_timing", 
"--no-timing", 
"Disabled performance logging; overrides -t or --timing");
   331       "allow_test_objects", 
"--allow-test-objects", 
"Register test objects and syntax");
   339       "Keep standard output from all processors when running in parallel");
   344       "Keep standard output from all processors when running in parallel");
   349       "--timpi-sync <type=nbx>",
   351       "Changes the sync type used in spare parallel communitations within TIMPI");
   356                                           "--start-in-debugger <debugger>",
   357                                           "Start the application and attach a debugger; this will "   358                                           "launch xterm windows using <debugger>");
   362       "--stop-for-debugger <seconds>",
   363       "Pauses the application during startup for <seconds> to allow for connection of debuggers");
   366       "perf_graph_live_all", 
"--perf-graph-live-all", 
"Forces printing of ALL progress messages");
   370       "disable_perf_graph_live", 
"--disable-perf-graph-live", 
"Disables PerfGraph live printing");
   374       "automatic_automatic_scaling", 
false, 
"Whether to turn on automatic scaling by default");
   376   const MooseEnum compute_device_type(
"cpu cuda mps hip ceed-cpu ceed-cuda ceed-hip", 
"cpu");
   381       "The device type we want to run accelerated (libtorch, MFEM) computations on.");
   383 #ifdef HAVE_GPERFTOOLS   386       "--gperf-profiler-on <ranks>",
   387       "To generate profiling report only on comma-separated list of MPI ranks");
   392       "--show-data-params",
   394       "Show found paths for all DataFileName parameters in the header");
   398                                    "Show registered data paths for searching in the header");
   401   params.
addPrivateParam<std::shared_ptr<Parallel::Communicator>>(
"_comm");
   407   params.
addPrivateParam<std::unique_ptr<Backup> *>(
"_initial_backup", 
nullptr);
   409 #ifdef MOOSE_MFEM_ENABLED   415       "use_legacy_material_output",
   417       "Set false to allow material properties to be output on INITIAL, not just TIMESTEP_END.");
   419       "use_legacy_initial_residual_evaluation_behavior",
   421       "The legacy behavior performs an often times redundant residual evaluation before the "   422       "solution modifying objects are executed prior to the initial (0th nonlinear iteration) "   423       "residual evaluation. The new behavior skips that redundant residual evaluation unless the "   424       "parameter Executioner/use_pre_SMO_residual is set to true.");
   429       "Set true to enable data-driven mesh generation, which is an experimental feature");
   433       "--parse-neml2-only",
   434       "Executes the [NEML2] block to parse the input file and terminate.");
   454     _comm(getParam<
std::shared_ptr<
Parallel::Communicator>>(
"_comm")),
   455     _file_base_set_by_user(false),
   456     _output_position_set(false),
   457     _start_time_set(false),
   459     _global_time_offset(0.0),
   461     _action_factory(*this),
   462     _action_warehouse(*this, _syntax, _action_factory),
   463     _output_warehouse(*this),
   464     _parser(getCheckedPointerParam<
std::shared_ptr<
Parser>>(
"_parser")),
   465     _command_line(getCheckedPointerParam<
std::shared_ptr<
CommandLine>>(
"_command_line")),
   466     _builder(*this, _action_warehouse, *_parser),
   468     _perf_graph(createRecoverablePerfGraph()),
   469     _solution_invalidity(createRecoverableSolutionInvalidity()),
   470     _rank_map(*_comm, _perf_graph),
   471     _use_executor(getParam<bool>(
"use_executor")),
   472     _null_executor(NULL),
   473     _use_nonlinear(true),
   474     _use_eigen_value(false),
   475     _enable_unused_check(ERROR_UNUSED),
   477     _error_overridden(false),
   478     _early_exit_param(
""),
   479     _ready_to_exit(false),
   481     _initial_from_file(false),
   482     _distributed_mesh_on_command_line(false),
   486     _use_split(getParam<bool>(
"use_split")),
   487     _force_restart(getParam<bool>(
"force_restart")),
   493     _test_checkpoint_half_transient(parameters.
get<bool>(
"test_checkpoint_half_transient")),
   494     _test_restep(parameters.
get<bool>(
"test_restep")),
   495     _check_input(getParam<bool>(
"check_input")),
   496     _multiapp_level(isParamValid(
"_multiapp_level") ? getParam<unsigned 
int>(
"_multiapp_level")
   498     _multiapp_number(isParamValid(
"_multiapp_number") ? getParam<unsigned 
int>(
"_multiapp_number")
   500     _use_master_mesh(getParam<bool>(
"_use_master_mesh")),
   501     _master_mesh(isParamValid(
"_master_mesh") ? getParam<const 
MooseMesh *>(
"_master_mesh")
   503     _master_displaced_mesh(isParamValid(
"_master_displaced_mesh")
   504                                ? getParam<const 
MooseMesh *>(
"_master_displaced_mesh")
   506     _mesh_generator_system(*this),
   507     _chain_control_system(*this),
   508     _rd_reader(*this, _restartable_data, forceRestart()),
   509     _execute_flags(
moose::internal::ExecFlagRegistry::getExecFlagRegistry().getFlags()),
   510     _output_buffer_cache(nullptr),
   511     _automatic_automatic_scaling(getParam<bool>(
"automatic_automatic_scaling")),
   512     _initial_backup(getParam<
std::unique_ptr<
Backup> *>(
"_initial_backup"))
   513 #ifdef MOOSE_LIBTORCH_ENABLED
   515     _libtorch_device(determineLibtorchDeviceType(getParam<
MooseEnum>(
"compute_device")))
   517 #ifdef MOOSE_MFEM_ENABLED
   519     _mfem_device(isParamValid(
"_mfem_device")
   520                      ? getParam<
std::shared_ptr<
mfem::Device>>(
"_mfem_device")
   522     _mfem_devices(isParamValid(
"_mfem_devices") ? getParam<
std::set<
std::string>>(
"_mfem_devices")
   523                                                 : 
std::set<
std::string>{})
   526   if (¶meters != &_pars)
   530     const std::string bad_params = 
"(InputParameters parameters)";
   531     const std::string good_params = 
"(const InputParameters & parameters)";
   532     const std::string source_constructor = type() + 
"::" + type();
   534                                 " copy-constructs its input parameters.\n\n",
   535                                 "This is deprecated and will not be allowed in the future.\n\n",
   557   mooseAssert(_command_line->hasParsed(), 
"Command line has not parsed");
   558   mooseAssert(_parser->queryRoot() && _parser->queryCommandLineRoot(), 
"Parser has not parsed");
   561   const auto & timpi_sync = getParam<std::string>(
"timpi_sync");
   564 #ifdef HAVE_GPERFTOOLS   565   if (isUltimateMaster())
   567     bool has_cpu_profiling = 
false;
   568     bool has_heap_profiling = 
false;
   569     static std::string cpu_profile_file;
   570     static std::string heap_profile_file;
   573     if (std::getenv(
"MOOSE_PROFILE_BASE"))
   575       has_cpu_profiling = 
true;
   577           std::getenv(
"MOOSE_PROFILE_BASE") + std::to_string(_comm->rank()) + 
".prof";
   580       if (!
name.first.empty())
   582         if (processor_id() == 0)
   589     if (std::getenv(
"MOOSE_HEAP_BASE"))
   591       has_heap_profiling = 
true;
   592       heap_profile_file = std::getenv(
"MOOSE_HEAP_BASE") + std::to_string(_comm->rank());
   595       if (!
name.first.empty())
   597         if (processor_id() == 0)
   604     if (isParamSetByUser(
"gperf_profiler_on"))
   606       auto rankstr = getParam<std::string>(
"gperf_profiler_on");
   607       std::vector<processor_id_type> ranks;
   610         mooseError(
"Invalid argument for --gperf-profiler-on: '", rankstr, 
"'");
   611       for (
auto & rank : ranks)
   613         if (rank >= _comm->size())
   614           mooseError(
"Invalid argument for --gperf-profiler-on: ",
   616                      " is greater than or equal to ",
   618         if (rank == _comm->rank())
   620           _cpu_profiling = has_cpu_profiling;
   621           _heap_profiling = has_heap_profiling;
   627       _cpu_profiling = has_cpu_profiling;
   628       _heap_profiling = has_heap_profiling;
   632       if (!ProfilerStart(cpu_profile_file.c_str()))
   633         mooseError(
"CPU profiler is not started properly");
   637       HeapProfilerStart(heap_profile_file.c_str());
   638       if (!IsHeapProfilerRunning())
   639         mooseError(
"Heap profiler is not started properly");
   643   if (std::getenv(
"MOOSE_PROFILE_BASE") || std::getenv(
"MOOSE_HEAP_BASE"))
   644     mooseError(
"gperftool is not available for CPU or heap profiling");
   648   if (isParamValid(
"language_server") && getParam<bool>(
"language_server"))
   649     _output_buffer_cache = Moose::out.rdbuf(
nullptr);
   654   _the_warehouse = std::make_unique<TheWarehouse>();
   657   _the_warehouse->registerAttribute<
AttribExecOns>(
"exec_ons", 0);
   660   _the_warehouse->registerAttribute<
AttribThread>(
"thread", 0);
   662   _the_warehouse->registerAttribute<
AttribPreIC>(
"pre_ic", 0);
   663   _the_warehouse->registerAttribute<
AttribPreAux>(
"pre_aux");
   664   _the_warehouse->registerAttribute<
AttribPostAux>(
"post_aux");
   665   _the_warehouse->registerAttribute<
AttribName>(
"name", 
"dummy");
   666   _the_warehouse->registerAttribute<
AttribSystem>(
"system", 
"dummy");
   667   _the_warehouse->registerAttribute<
AttribVar>(
"variable", -1);
   671   _the_warehouse->registerAttribute<
AttribSorted>(
"sorted");
   674   _perf_graph.enableLivePrint();
   676   if (_check_input && isParamSetByUser(
"recover"))
   677     mooseError(
"Cannot run --check-input with --recover. Recover files might not exist");
   679   if (isParamSetByUser(
"start_in_debugger") && isUltimateMaster())
   681     auto command = getParam<std::string>(
"start_in_debugger");
   683     Moose::out << 
"Starting in debugger using: " << command << std::endl;
   687     std::stringstream command_stream;
   690     command_stream << 
"xterm -e \"echo 'Rank: " << processor_id() << 
"  Hostname: " << 
hostname   691                    << 
"  PID: " << getpid() << 
"'; echo ''; ";
   694     if (command.find(
"lldb") != std::string::npos || command.find(
"gdb") != std::string::npos)
   695       command_stream << command << 
" -p " << getpid();
   699                  "\nIf this is truly what you meant then contact moose-users to have a discussion "   700                  "about adding your debugger.");
   703     command_stream << 
"\""   705     std::string command_string = command_stream.str();
   706     Moose::out << 
"Running: " << command_string << std::endl;
   708     int ret = std::system(command_string.c_str());
   712     std::this_thread::sleep_for(std::chrono::seconds(10));
   715   if (isParamSetByUser(
"stop_for_debugger") && isUltimateMaster())
   717     Moose::out << 
"\nStopping for " << getParam<unsigned int>(
"stop_for_debugger")
   718                << 
" seconds to allow attachment from a debugger.\n";
   720     Moose::out << 
"\nAll of the processes you can connect to:\n";
   721     Moose::out << 
"rank - hostname - pid\n";
   728       Moose::err << processor_id() << 
" - " << 
hostname << 
" - " << getpid() << 
"\n";
   731     Moose::out << 
"\nWaiting...\n" << std::endl;
   734     std::this_thread::sleep_for(std::chrono::seconds(getParam<unsigned int>(
"stop_for_debugger")));
   737   if (_master_mesh && isUltimateMaster())
   738     mooseError(
"Mesh can be passed in only for sub-apps");
   740   if (_master_displaced_mesh && !_master_mesh)
   741     mooseError(
"_master_mesh should have been set when _master_displaced_mesh is set");
   743 #ifdef MOOSE_MFEM_ENABLED   746     mooseAssert(!isUltimateMaster(),
   747                 "The MFEM device should only be auto-set for sub-applications");
   748     mooseAssert(!_mfem_devices.empty(),
   749                 "If we are a sub-application and we have an MFEM device object, then we must know "   750                 "its configuration string");
   760   if (_pars.have_parameter<
bool>(
"use_legacy_dirichlet_bc"))
   761     mooseDeprecated(
"The parameter 'use_legacy_dirichlet_bc' is no longer valid.\n\n",
   762                     "All Dirichlet boundary conditions are preset by default.\n\n",
   763                     "Remove said parameter in ",
   765                     " to remove this deprecation warning.");
   767   if (_test_restep && _test_checkpoint_half_transient)
   768     mooseError(
"Cannot use --test-restep and --test-checkpoint-half-transient together");
   770   registerCapabilities();
   772   Moose::out << std::flush;
   774 #ifdef MOOSE_KOKKOS_ENABLED   775 #ifdef MOOSE_ENABLE_KOKKOS_GPU   781 std::optional<MooseEnum>
   785     return getParam<MooseEnum>(
"compute_device");
   793   auto haveCapability = [](
const std::string & capability, 
const std::string & doc)
   794   { 
addCapability(capability, 
true, doc + 
" is available."); };
   796   auto missingCapability =
   797       [](
const std::string & capability, 
const std::string & doc, 
const std::string & 
help = 
"")
   800   auto haveCapabilityVersion =
   801       [](
const std::string & capability, 
const std::string & doc, 
const std::string & version)
   802   { 
addCapability(capability, version, doc + 
" version " + version + 
" is available."); };
   804   auto petscMissingCapability = [](
const std::string & capability, 
const std::string & doc)
   807         capability, 
false, doc + 
" is not available. Check your PETSc configure options.");
   810   auto libmeshMissingCapability =
   811       [](
const std::string & capability, 
const std::string & doc, 
const std::string & config_option)
   815                   doc + 
" is not available. It is controlled by the `" + config_option +
   816                       "` libMesh configure option.");
   823                   "Trapping floating point exceptions is enabled (in debug mode this "   824                   "can be disabled using the --no-trap-fpe option).");
   828                   "Trapping floating point exceptions is not enabled (enable them using "   829                   "the --trap-fpe option or by running a debug mode executable).");
   832     const auto doc = 
"LibTorch machine learning and parallel tensor algebra library";
   833 #ifdef MOOSE_LIBTORCH_ENABLED   836     missingCapability(
"libtorch",
   839                       "https://mooseframework.inl.gov/moose/getting_started/installation/"   840                       "install_libtorch.html for "   841                       "instructions on how to configure and build moose with libTorch.");
   846     const auto doc = 
"MFEM finite element library";
   847 #ifdef MOOSE_MFEM_ENABLED   848     haveCapability(
"mfem", doc);
   850     missingCapability(
"mfem",
   852                       "Install mfem using the scripts/update_and_rebuild_mfem.sh script after "   853                       "first running scripts/update_and_rebuild_conduit.sh. Finally, configure "   854                       "moose with ./configure --with-mfem");
   859     const auto doc = 
"New Engineering Material model Library, version 2";
   861     haveCapability(
"neml2", doc);
   863     missingCapability(
"neml2",
   865                       "Install neml2 using the scripts/update_and_rebuild_neml2.sh script, then "   866                       "configure moose with ./configure --with-neml2 --with-libtorch");
   871     const auto doc = 
"gperftools code performance analysis and profiling library";
   872 #ifdef HAVE_GPERFTOOLS   873     haveCapability(
"gperftools", doc);
   875     missingCapability(
"gperftools",
   877                       "Check https://mooseframework.inl.gov/application_development/profiling.html "   878                       "for instructions on profiling MOOSE based applications.");
   883     const auto doc = 
"libPNG portable network graphics format library";
   884 #ifdef MOOSE_HAVE_LIBPNG   885     haveCapability(
"libpng", doc);
   887     missingCapability(
"libpng",
   889                       "Install libpng through conda or your distribution and check that it gets "   890                       "detected through pkg-config, then reconfigure and rebuild MOOSE.");
   895     const auto doc = 
"NVIDIA GPU parallel computing platform";
   896 #ifdef PETSC_HAVE_CUDA   897     haveCapability(
"cuda", doc);
   899     missingCapability(
"cuda", doc, 
"Add the CUDA bin directory to your path and rebuild PETSc.");
   904     const auto doc = 
"Kokkos performance portability programming ecosystem";
   905 #ifdef MOOSE_KOKKOS_ENABLED   906     haveCapability(
"kokkos", doc);
   908     missingCapability(
"kokkos",
   910                       "Rebuild PETSc with Kokkos support and libMesh. Then, reconfigure MOOSE with "   916     const auto doc = 
"Kokkos support for PETSc";
   917 #ifdef PETSC_HAVE_KOKKOS   918     haveCapability(
"petsc_kokkos", doc);
   921         "kokkos", doc, 
"Rebuild PETSc with Kokkos support, then rebuild libMesh and MOOSE.");
   927       MOOSE_AD_MAX_DOFS_PER_ELEM,
   928       "MOOSE was configured and built with a dual number backing store size of " +
   930           ". Complex simulations with many variables or contact problems may require larger "   931           "values. Reconfigure MOOSE with the --with-derivative-size=<n> option in the root of the "   934     const std::string method = QUOTE(METHOD);
   935     addCapability(
"method", method, 
"The executable was built with METHOD=\"" + method + 
"\"");
   939     const std::string version = QUOTE(LIBMESH_DETECTED_PETSC_VERSION_MAJOR) 
"." QUOTE(
   940         LIBMESH_DETECTED_PETSC_VERSION_MINOR) 
"." QUOTE(LIBMESH_DETECTED_PETSC_VERSION_SUBMINOR);
   941     addCapability(
"petsc", version, 
"Using PETSc version " + version + 
".");
   944 #ifdef LIBMESH_PETSC_USE_DEBUG   945   addCapability(
"petsc_debug", 
true, 
"PETSc was built with debugging options.");
   947   addCapability(
"petsc_debug", 
false, 
"PETSc was built without debugging options.");
   951     const auto doc = 
"SuperLU direct solver";
   952 #ifdef LIBMESH_PETSC_HAVE_SUPERLU_DIST   953     haveCapability(
"superlu", doc);
   955     petscMissingCapability(
"superlu", doc);
   960     const auto doc = 
"MUltifrontal Massively Parallel sparse direct Solver (MUMPS)";
   961 #ifdef LIBMESH_PETSC_HAVE_MUMPS   962     haveCapability(
"mumps", doc);
   964     petscMissingCapability(
"mumps", doc);
   969     const auto doc = 
"STRUMPACK - STRUctured Matrix PACKage solver library";
   970 #ifdef LIBMESH_PETSC_HAVE_STRUMPACK   971     haveCapability(
"strumpack", doc);
   973     petscMissingCapability(
"strumpack", doc);
   978     const auto doc = 
"Parmetis partitioning library";
   979 #if defined(LIBMESH_PETSC_HAVE_PARMETIS) || defined(LIBMESH_HAVE_PARMETIS)   980     haveCapability(
"parmetis", doc);
   982     petscMissingCapability(
"parmetis", doc);
   987     const auto doc = 
"Chaco graph partitioning library";
   988 #ifdef LIBMESH_PETSC_HAVE_CHACO   989     haveCapability(
"chaco", doc);
   991     petscMissingCapability(
"chaco", doc);
   996     const auto doc = 
"Party matrix or graph partitioning library";
   997 #ifdef LIBMESH_PETSC_HAVE_PARTY   998     haveCapability(
"party", doc);
  1000     petscMissingCapability(
"party", doc);
  1005     const auto doc = 
"PT-Scotch graph partitioning library";
  1006 #ifdef LIBMESH_PETSC_HAVE_PTSCOTCH  1007     haveCapability(
"ptscotch", doc);
  1009     petscMissingCapability(
"ptscotch", doc);
  1014     const auto doc = 
"Scalable Library for Eigenvalue Problem Computations (SLEPc)";
  1015 #ifdef LIBMESH_HAVE_SLEPC  1016     const auto version = QUOTE(LIBMESH_DETECTED_SLEPC_VERSION_MAJOR) 
"." QUOTE(
  1017         LIBMESH_DETECTED_SLEPC_VERSION_MINOR) 
"." QUOTE(LIBMESH_DETECTED_SLEPC_VERSION_SUBMINOR);
  1018     haveCapabilityVersion(
"slepc", doc, version);
  1020     petscMissingCapability(
"slepc", doc);
  1025     const auto doc = 
"Exodus mesh file format library";
  1026 #ifdef LIBMESH_HAVE_EXODUS_API  1027     const std::string version = QUOTE(LIBMESH_DETECTED_EXODUS_VERSION_MAJOR) 
"." QUOTE(
  1028         LIBMESH_DETECTED_EXODUS_VERSION_MINOR);
  1029     haveCapabilityVersion(
"exodus", doc, version);
  1031     libmeshMissingCapability(
"exodus", doc, 
"--enable-exodus");
  1036     const auto doc = 
"Netgen meshing library";
  1037 #ifdef LIBMESH_HAVE_NETGEN  1038     haveCapability(
"netgen", doc);
  1040     libmeshMissingCapability(
"netgen", doc, 
"--enable-netgen");
  1045     const auto doc = 
"Visualization Toolkit (VTK)";
  1046 #ifdef LIBMESH_HAVE_VTK  1047     const std::string version = QUOTE(LIBMESH_DETECTED_VTK_VERSION_MAJOR) 
"." QUOTE(
  1048         LIBMESH_DETECTED_VTK_VERSION_MINOR) 
"." QUOTE(LIBMESH_DETECTED_VTK_VERSION_SUBMINOR);
  1049     haveCapabilityVersion(
"vtk", doc, version);
  1051     libmeshMissingCapability(
"vtk", doc, 
"--disable-vtk and --enable-vtk-required");
  1056     const auto doc = 
"libcurl - the multiprotocol file transfer library";
  1057 #ifdef LIBMESH_HAVE_CURL  1058     haveCapability(
"curl", doc);
  1060     libmeshMissingCapability(
"curl", doc, 
"--enable-curl");
  1065     const auto doc = 
"Tecplot post-processing tools API";
  1066 #ifdef LIBMESH_HAVE_TECPLOT_API  1067     haveCapability(
"tecplot", doc);
  1069     libmeshMissingCapability(
"tecplot", doc, 
"--enable-tecplot");
  1074     const auto doc = 
"Boost C++ library";
  1075 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST  1076     haveCapability(
"boost", doc);
  1078     libmeshMissingCapability(
"boost", doc, 
"--with-boost");
  1084     const auto doc = 
"Adaptive mesh refinement";
  1085 #ifdef LIBMESH_ENABLE_AMR  1086     haveCapability(
"amr", doc);
  1088     libmeshMissingCapability(
"amr", doc, 
"--disable-amr");
  1093     const auto doc = 
"nanoflann library for Nearest Neighbor (NN) search with KD-trees";
  1094 #ifdef LIBMESH_HAVE_NANOFLANN  1095     haveCapability(
"nanoflann", doc);
  1097     libmeshMissingCapability(
"nanoflann", doc, 
"--disable-nanoflann");
  1102     const auto doc = 
"sfcurves library for space filling curves (required by geometric "  1103                      "partitioners such as SFCurves, Hilbert and Morton -  not LGPL compatible)";
  1104 #ifdef LIBMESH_HAVE_SFCURVES  1105     haveCapability(
"sfcurves", doc);
  1107     libmeshMissingCapability(
"sfcurves", doc, 
"--disable-sfc");
  1111 #ifdef LIBMESH_HAVE_FPARSER  1112 #ifdef LIBMESH_HAVE_FPARSER_JIT  1113   addCapability(
"fparser", 
"jit", 
"FParser enabled with just in time compilation support.");
  1120                 "FParser is disabled, libMesh was likely configured with --disable-fparser.");
  1123 #ifdef LIBMESH_HAVE_DLOPEN  1125       "dlopen", 
true, 
"The dlopen() system call is available to dynamically load libraries.");
  1129                 "The dlopen() system call is not available. Dynamic library loading is "  1130                 "not supported on this system.");
  1134     const auto doc = 
"LibMesh support for threaded execution";
  1135 #ifdef LIBMESH_USING_THREADS  1136     haveCapability(
"threads", doc);
  1138     libmeshMissingCapability(
"threads", doc, 
"--with-thread-model=tbb,pthread,openmp,auto,none");
  1143     const auto doc = 
"OpenMP multi-platform shared-memory parallel programming API";
  1144 #ifdef LIBMESH_HAVE_OPENMP  1145     haveCapability(
"openmp", doc);
  1147     libmeshMissingCapability(
"openmp", doc, 
"--with-thread-model=tbb,pthread,openmp,auto,none");
  1151     const auto doc = 
"oneAPI Threading Building Blocks (TBB) API";
  1152 #ifdef LIBMESH_HAVE_TBB_API  1153     haveCapability(
"tbb", doc);
  1155     libmeshMissingCapability(
"tbb", doc, 
"--with-thread-model=tbb,pthread,openmp,auto,none");
  1160     const auto doc = 
"libMesh unique ID support";
  1161 #ifdef LIBMESH_ENABLE_UNIQUE_ID  1162     haveCapability(
"unique_id", doc);
  1164     libmeshMissingCapability(
"unique_id", doc, 
"--enable-unique-id");
  1169     const auto doc = 
"libMesh default mesh mode";
  1170 #ifdef LIBMESH_ENABLE_PARMESH  1180                     " bytes for storage. This is controlled by the "  1181                     "--with-dof-id-bytes=<1|2|4|8> libMesh configure option.");
  1185     const auto doc = 
"Compiler used to build the MOOSE framework.";
  1186 #if defined(__INTEL_LLVM_COMPILER)  1188 #elif defined(__clang__)  1190 #elif defined(__GNUC__) || defined(__GNUG__)  1192 #elif defined(_MSC_VER)  1201     const auto doc = 
"Operating system this executable is running on.";
  1208 #elif __unix__ // all unices not caught above  1216 #ifdef HAVE_GPERFTOOLS  1243 #ifdef LIBMESH_HAVE_DLOPEN  1246     dlclose(lib_pair.second.library_handle);
  1249 #ifdef MOOSE_KOKKOS_ENABLED  1257   return MOOSE_VERSION;
  1263   return MOOSE_VERSION;
  1275   TIME_SECTION(
"setupOptions", 5, 
"Setting Up Options");
  1278   if (
header().length() && !getParam<bool>(
"suppress_header"))
  1281   if (getParam<bool>(
"error_unused"))
  1283   else if (getParam<bool>(
"allow_unused"))
  1286   if (getParam<bool>(
"error_override"))
  1291   if (getParam<bool>(
"trap_fpe"))
  1295     if (getParam<bool>(
"no_trap_fpe"))
  1296       mooseError(
"Cannot use both \"--trap-fpe\" and \"--no-trap-fpe\" flags.");
  1298   else if (getParam<bool>(
"no_trap_fpe"))
  1310     auto color = getParam<MooseEnum>(
"color");
  1314       if (getParam<bool>(
"no_color"))
  1319         char * c_color = std::getenv(
"MOOSE_COLOR");
  1321           color.assign(std::string(c_color), 
"While assigning environment variable MOOSE_COLOR");
  1325     if (color == 
"auto")
  1327     else if (color == 
"on")
  1329     else if (color == 
"off")
  1332       mooseAssert(
false, 
"Should not hit");
  1335     if (getParam<bool>(
"no_color"))
  1336       mooseDeprecated(
"The --no-color flag is deprecated. Use '--color off' instead.");
  1345 #if !LIBMESH_USING_THREADS  1347     mooseError(
"You specified --n-threads > 1, but there is no threading model active!");
  1351   if (getParam<bool>(
"minimal"))
  1354   else if (getParam<bool>(
"display_version"))
  1361   else if (getParam<bool>(
"help"))
  1369     const std::string search =
  1370         isParamSetByUser(
"dump_search") ? getParam<std::string>(
"dump_search") : 
"";
  1375       TIME_SECTION(
"dump", 1, 
"Building Syntax Tree");
  1380     if ((tree.getRoot()).is_object())
  1386       Moose::out << 
"\n### START DUMP DATA ###\n"  1387                  << formatter.
toString(tree.getRoot()) << 
"\n### END DUMP DATA ###" << std::endl;
  1392       mooseError(
"Search parameter '", search, 
"' was not found in the registered syntax.");
  1394   else if (getParam<bool>(
"registry"))
  1398     Moose::out << 
"Label\tType\tName\tClass\tFile\n";
  1401     for (
auto & entry : objmap)
  1402       for (
auto & obj : entry.second)
  1403         Moose::out << entry.first << 
"\tobject\t" << obj->name() << 
"\t" << obj->_classname << 
"\t"  1404                    << obj->_file << 
"\n";
  1407     for (
auto & entry : actmap)
  1409       for (
auto & act : entry.second)
  1410         Moose::out << entry.first << 
"\taction\t" << act->_name << 
"\t" << act->_classname << 
"\t"  1411                    << act->_file << 
"\n";
  1416   else if (getParam<bool>(
"registry_hit"))
  1420     Moose::out << 
"### START REGISTRY DATA ###\n";
  1422     hit::Section root(
"");
  1423     auto sec = 
new hit::Section(
"registry");
  1425     auto objsec = 
new hit::Section(
"objects");
  1426     sec->addChild(objsec);
  1429     for (
auto & entry : objmap)
  1430       for (
auto & obj : entry.second)
  1432         auto ent = 
new hit::Section(
"entry");
  1433         objsec->addChild(ent);
  1434         ent->addChild(
new hit::Field(
"label", hit::Field::Kind::String, entry.first));
  1435         ent->addChild(
new hit::Field(
"type", hit::Field::Kind::String, 
"object"));
  1436         ent->addChild(
new hit::Field(
"name", hit::Field::Kind::String, obj->name()));
  1437         ent->addChild(
new hit::Field(
"class", hit::Field::Kind::String, obj->_classname));
  1438         ent->addChild(
new hit::Field(
"file", hit::Field::Kind::String, obj->_file));
  1441     auto actsec = 
new hit::Section(
"actions");
  1442     sec->addChild(actsec);
  1444     for (
auto & entry : actmap)
  1445       for (
auto & act : entry.second)
  1447         auto ent = 
new hit::Section(
"entry");
  1448         actsec->addChild(ent);
  1449         ent->addChild(
new hit::Field(
"label", hit::Field::Kind::String, entry.first));
  1450         ent->addChild(
new hit::Field(
"type", hit::Field::Kind::String, 
"action"));
  1451         ent->addChild(
new hit::Field(
"task", hit::Field::Kind::String, act->_name));
  1452         ent->addChild(
new hit::Field(
"class", hit::Field::Kind::String, act->_classname));
  1453         ent->addChild(
new hit::Field(
"file", hit::Field::Kind::String, act->_file));
  1456     Moose::out << root.render();
  1458     Moose::out << 
"\n### END REGISTRY DATA ###\n";
  1462   else if (getParam<bool>(
"definition"))
  1469     Moose::out << 
"%-START-SON-DEFINITION-%\n"  1470                << formatter.
toString(tree.
getRoot()) << 
"\n%-END-SON-DEFINITION-%\n";
  1476     const std::string search =
  1477         isParamSetByUser(
"yaml_search") ? getParam<std::string>(
"yaml_search") : 
"";
  1488     const std::string search =
  1489         isParamSetByUser(
"json_search") ? getParam<std::string>(
"json_search") : 
"";
  1496         "json", 
"**START JSON DATA**\n", 
"\n**END JSON DATA**", tree.
getRoot().dump(2));
  1500   else if (getParam<bool>(
"syntax"))
  1505     std::stringstream ss;
  1506     for (
const auto & it : 
syntax)
  1507       ss << it.first << 
"\n";
  1512   else if (getParam<bool>(
"show_type"))
  1516     Moose::out << 
"MooseApp Type: " << 
type() << std::endl;
  1520   else if (getParam<bool>(
"show_capabilities"))
  1524                               "**START JSON DATA**\n",
  1525                               "\n**END JSON DATA**",
  1532     const auto & capabilities = getParam<std::string>(
"check_capabilities");
  1535     _console << 
"Capabilities '" << capabilities << 
"' are " << (pass ? 
"" : 
"not ") << 
"fulfilled."  1549       const auto & recover = getParam<std::string>(
"recover");
  1560       const auto required_capabilities = getParam<std::string>(
"required_capabilities");
  1561       auto [
status, reason, doc] =
  1565         mooseInfo(
"Required capabilities '", required_capabilities, 
"' not fulfilled.");
  1573                    required_capabilities,
  1574                    "' are not specific enough. A comparison test is performed on an undefined "  1575                    "capability. Disambiguate this requirement by adding an existence/non-existence "  1576                    "requirement. Example: 'unknown<1.2.3' should become 'unknown & unknown<1.2.3' "  1577                    "or '!unknown | unknown<1.2.3'");
  1581     auto isExclusiveParamSetByUser =
  1582         [
this](
const std::vector<std::string> & group, 
const std::string & param)
  1586         for (
const auto & p : group)
  1588             mooseError(
"Parameters '" + p + 
"' and '" + param +
  1589                        "' are mutually exclusive. Please choose only one of them.");
  1594     const std::vector<std::string> final_task_params = {
  1595         "csg_only", 
"mesh_only", 
"split_mesh", 
"parse_neml2_only"};
  1596     if (isExclusiveParamSetByUser(final_task_params, 
"csg_only"))
  1600         mooseError(
"--csg-only cannot be used in conjunction with --distributed-mesh");
  1603         mooseError(
"--csg-only is not compatible with any mesh splitting options");
  1605         mooseError(
"--csg-only cannot be used in conjunction with -r refinements option");
  1607         mooseError(
"--csg-only option cannot be used as a Subapp");
  1609         mooseError(
"--csg-only option cannot be used in recovery mode");
  1620     else if (isExclusiveParamSetByUser(final_task_params, 
"mesh_only"))
  1634     else if (isExclusiveParamSetByUser(final_task_params, 
"split_mesh"))
  1642     else if (isExclusiveParamSetByUser(final_task_params, 
"parse_neml2_only"))
  1654       mooseAssert(common_actions.size() <= 1, 
"Should not be more than one CommonOutputAction");
  1655       const Action * common = common_actions.empty() ? nullptr : *common_actions.begin();
  1658       if (common && common->isParamValid(
"file_base"))
  1668         size_t pos = base.find_last_of(
'.');
  1683       mooseError(
"You specified --check-input, but did not provide an input file. Add -i "  1684                  "<inputfile> to your command line.");
  1686     mooseError(
"No input files specified. Add -i <inputfile> to your command line.");
  1688   else if (
isParamValid(
"language_server") && getParam<bool>(
"language_server"))
  1713 #ifdef MOOSE_KOKKOS_ENABLED  1715     if (action->isParamValid(
"_kokkos_action"))
  1719   Moose::out << std::flush;
  1722 const std::vector<std::string> &
  1725   mooseAssert(
_parser, 
"Parser is not set");
  1726   return _parser->getInputFileNames();
  1732   mooseAssert(
_parser, 
"Parser is not set");
  1733   return _parser->getLastInputFileName();
  1755     for (
auto & multi_app : 
feProblem().getMultiAppWarehouse().getObjects())
  1756       multi_app->setAppOutputFileBase();
  1764   TIME_SECTION(
"runInputFile", 3);
  1792   else if (getParam<bool>(
"list_constructed_objects"))
  1797     std::stringstream ss;
  1798     for (
const auto & obj : 
_factory.getConstructedObjects())
  1801         "list_constructed_objects", 
"**START OBJECT DATA**\n", 
"\n**END OBJECT DATA**", ss.str());
  1823                   "Something went wrong, we should only get here if _check_input is true.");
  1825           "Incompatible command line arguments provided. --check-input cannot be called with ",
  1830     mooseError(
"The Executor is being called without being initialized. This is likely "  1832                "incompatible command line arguments");
  1836   for (
auto app : apps)
  1837     for (
unsigned int i = 0; i < app->numLocalApps(); i++)
  1838       app->localApp(i)->errorCheck();
  1844   TIME_SECTION(
"executeExecutioner", 3);
  1857     if (!result.convergedAll())
  1870     mooseError(
"No executioner was specified (go fix your input file)");
  1901                   "MooseApp::hasRestartRecoverFileBase() instead.");
  1912     case RESTARTABLE_FILTER::RECOVERABLE:
  1920 std::vector<std::filesystem::path>
  1923   TIME_SECTION(
"backup", 2, 
"Backing Up Application to File");
  1928   return writer.
write(folder_base);
  1931 std::unique_ptr<Backup>
  1934   TIME_SECTION(
"backup", 2, 
"Backing Up Application");
  1940   auto backup = std::make_unique<Backup>();
  1949   TIME_SECTION(
"restore", 2, 
"Restoring Application from File");
  1962   TIME_SECTION(
"restore", 2, 
"Restoring Application");
  1967     mooseError(
"MooseApp::restore(): Provided backup is not initialized");
  1970   mooseAssert(
header, 
"Header not available");
  1972   auto data = std::move(
backup->data);
  1973   mooseAssert(data, 
"Data not available");
  1988 std::unique_ptr<Backup>
  1992     mooseError(
"MooseApp::finalizeRestore(): Not currently restoring");
  1997   std::unique_ptr<Backup> 
backup;
  2001   if (
auto header_string_input = dynamic_cast<StringInputStream *>(input_streams.header.get()))
  2003     auto data_string_input = 
dynamic_cast<StringInputStream *
>(input_streams.data.get());
  2004     mooseAssert(data_string_input, 
"Should also be a string input");
  2006     auto header_sstream = header_string_input->release();
  2007     mooseAssert(header_sstream, 
"Header not available");
  2009     auto data_sstream = data_string_input->release();
  2010     mooseAssert(data_sstream, 
"Data not available");
  2012     backup = std::make_unique<Backup>();
  2013     backup->header = std::move(header_sstream);
  2014     backup->data = std::move(data_sstream);
  2041                       const std::string & name,
  2047     mooseError(
"an executor with name '", executor->name(), 
"' already exists");
  2053                             const std::string & name,
  2062   mooseAssert(
_parser, 
"Not set");
  2069   return const_cast<Parser &
>(std::as_const(*this).parser());
  2074                                      std::list<std::string> & possible_roots,
  2075                                      std::list<std::string> & current_branch)
  2082   if (
std::find(current_branch.begin(), current_branch.end(), current_executor_name) !=
  2083       current_branch.end())
  2085     std::stringstream exec_names_string;
  2087     auto branch_it = current_branch.begin();
  2089     exec_names_string << *branch_it++;
  2091     for (; branch_it != current_branch.end(); ++branch_it)
  2092       exec_names_string << 
", " << *branch_it;
  2094     exec_names_string << 
", " << current_executor_name;
  2096     mooseError(
"Executor cycle detected: ", exec_names_string.str());
  2099   current_branch.push_back(current_executor_name);
  2104   for (
const auto & param : params)
  2106     if (params.have_parameter<ExecutorName>(param.first))
  2108       const auto & dependency_name = params.get<ExecutorName>(param.first);
  2110       possible_roots.remove(dependency_name);
  2112       if (!dependency_name.empty())
  2121   current_branch.pop_back();
  2132   std::list<std::string> possibly_root;
  2135   std::map<std::string, bool> already_built;
  2138   std::list<std::string> possible_roots;
  2141   std::list<std::string> current_branch;
  2145     auto params = 
_factory.getValidParams(
"NullExecutor");
  2151     const auto & 
name = params_entry.first;
  2157     possible_roots.emplace_back(
name);
  2163   if (possible_roots.size() > 1)
  2165     auto root_string_it = possible_roots.begin();
  2167     std::stringstream roots_string;
  2169     roots_string << *root_string_it++;
  2171     for (; root_string_it != possible_roots.end(); ++root_string_it)
  2172       roots_string << 
", " << *root_string_it;
  2174     mooseError(
"Multiple Executor roots found: ", roots_string.str());
  2189   if (fail_if_not_found)
  2210   TIME_SECTION(
"run", 3);
  2211   if (getParam<bool>(
"show_docs"))
  2215       mooseError(
"could not locate installed tests to run (unresolved binary/app name)");
  2218       mooseError(
"no installed documentation found");
  2224       std::ifstream ifs(docmsgfile);
  2225       std::string content((std::istreambuf_iterator<char>(ifs)),
  2226                           (std::istreambuf_iterator<char>()));
  2227       content.replace(content.find(
"$LOCAL_SITE_HOME"), content.length(), docmsg);
  2231     Moose::out << docmsg << 
"\n";
  2246     TIME_SECTION(
"setup", 2, 
"Setting Up");
  2252     mooseAssert(
_parser->getThrowOnError(), 
"Should be true");
  2260   catch (std::exception & 
err)
  2267     TIME_SECTION(
"execute", 2, 
"Executing");
  2274     Moose::err << 
"Syntax OK" << std::endl;
  2281   if (getParam<bool>(
"show_inputs"))
  2284     std::vector<std::string> dirs;
  2287     if (installable_inputs == 
"")
  2290           << 
"Show inputs has not been overriden in this application.\nContact the developers of "  2291              "this appication and request that they override \"MooseApp::getInstallableInputs\".\n";
  2295       mooseAssert(!show_inputs_syntax.empty(), 
"show_inputs sytnax should not be empty");
  2298       Moose::out << 
"The following directories are installable into a user-writeable directory:\n\n"  2299                  << installable_inputs << 
'\n'  2300                  << 
"\nTo install one or more directories of inputs, execute the binary with the \""  2301                  << show_inputs_syntax[0] << 
"\" flag. e.g.:\n$ "  2302                  << 
_command_line->getExecutableName() << 
' ' << show_inputs_syntax[0] << 
' '  2321     if (
comm().size() > 1)
  2322       mooseError(
"The --copy-inputs option should not be ran in parallel");
  2325     auto dir_to_copy = getParam<std::string>(
"copy_inputs");
  2327     if (dir_to_copy.empty())
  2328       mooseError(
"Error retrieving directory to copy");
  2329     if (dir_to_copy.back() != 
'/')
  2336       mooseError(
"could not locate installed tests to run (unresolved binary/app name)");
  2342             " to get a list of installable directories.");
  2346     auto dst_dir = 
_command_line->getExecutableNameBase() + 
"/" + dir_to_copy;
  2348     if (cmdname.find_first_of(
"/") != std::string::npos)
  2349       cmdname = cmdname.substr(cmdname.find_first_of(
"/") + 1, std::string::npos);
  2353           "The directory \"./",
  2355           "\" already exists.\nTo update/recopy the contents of this directory, rename (\"mv ",
  2357           " new_dir_name\") or remove (\"rm -r ",
  2359           "\") the existing directory.\nThen re-run \"",
  2365     std::string cmd = 
"mkdir -p " + dst_dir + 
"; rsync -av " + src_dir + 
" " + dst_dir;
  2367     TIME_SECTION(
"copy_inputs", 2, 
"Copying Inputs");
  2369     mooseAssert(
comm().size() == 1, 
"Should be run in serial");
  2370     const auto return_value = system(cmd.c_str());
  2371     if (!WIFEXITED(return_value))
  2375       Moose::out << 
"Directory successfully copied into ./" << dst_dir << 
'\n';
  2386     if (
comm().size() > 1)
  2387       mooseError(
"The --run option should not be ran in parallel");
  2390     const auto find_run_it = std::as_const(*_command_line).findCommandLineParam(
"run");
  2391     const auto & cl_entries = std::as_const(*_command_line).getEntries();
  2392     mooseAssert(find_run_it != cl_entries.end(), 
"Didn't find the option");
  2393     std::string test_args;
  2394     for (
auto it = std::next(find_run_it); it != cl_entries.end(); ++it)
  2395       for (
const auto & arg : it->raw_args)
  2397         test_args += 
" " + arg;
  2406         mooseError(
"Could not locate binary name relative to installed location");
  2410           "Could not locate installed tests from the current working directory:",
  2412           ".\nMake sure you are executing this command from within a writable installed inputs ",
  2413           "directory.\nRun \"",
  2415           " --copy-inputs <dir>\" to copy the contents of <dir> to a \"./",
  2417           "_<dir>\" directory.\nChange into that directory and try \"",
  2419           " --run <dir>\" again.");
  2423     setenv(
"MOOSE_TEST_RUNNER_APP_NAME", 
appBinaryName().c_str(), 
true);
  2426     Moose::out << 
"Working Directory: " << working_dir << 
"\nRunning Command: " << cmd << std::endl;
  2427     mooseAssert(
comm().size() == 1, 
"Should be run in serial");
  2428     const auto return_value = system(cmd.c_str());
  2429     if (!WIFEXITED(return_value))
  2443   static const std::set<std::string> reserved{
  2444       "scale_refine", 
"valgrind", 
"recover", 
"heavy", 
"mpi_procs", 
"num_threads", 
"compute_device"};
  2445   if (reserved.count(capability))
  2446     ::
mooseError(
"MooseApp::addCapability(): The capability \"",
  2448                  "\" is reserved and may not be registered by an application.");
  2462 std::list<std::string>
  2466   std::list<std::string> checkpoint_dirs;
  2473   for (
const auto & action : actions)
  2477     if (!moose_object_action)
  2481     if (moose_object_action->
getParam<std::string>(
"type") == 
"Checkpoint")
  2485       const std::string cp_dir =
  2488       checkpoint_dirs.push_back(cp_dir + 
"_cp");
  2491   return checkpoint_dirs;
  2494 std::list<std::string>
  2529   std::string library_name(app_name);
  2532   size_t pos = library_name.find(
"App");
  2533   if (pos != library_name.length() - 3)
  2534     mooseError(
"Invalid application name: ", library_name);
  2535   library_name.erase(pos);
  2539          QUOTE(METHOD) + 
".la";
  2545   std::string app_name(library_name);
  2548   if (pcrecpp::RE(
"lib(.+?)(?:-\\w+)?\\.la").Replace(
"\\1", &app_name) == 0)
  2549     mooseError(
"Invalid library name: ", app_name);
  2560   if (!metaname.empty() && tid != 0)
  2562         "The meta data storage for '", metaname, 
"' is not threaded, so the tid must be zero.");
  2564   mooseAssert(metaname.empty() ||
  2566               "The desired meta data name does not exist: " + metaname);
  2575     if (data->typeId() != stored_data->
typeId())
  2576       mooseError(
"Type mismatch found in RestartableData registration of '",
  2578                  "'\n\n  Stored type: ",
  2579                  stored_data->
type(),
  2584     stored_data = &data_map.addData(std::move(data));
  2589   return *stored_data;
  2594                                   std::unique_ptr<RestartableDataValue> data,
  2599   mooseDeprecated(
"The use of MooseApp::registerRestartableData with a data name is "  2600                   "deprecated.\n\nUse the call without a name instead.");
  2602   mooseAssert(
name == data->name(), 
"Inconsistent name");
  2613   return it->second.first.hasData(
name);
  2623         "The meta data storage for '", metaname, 
"' is not threaded, so the tid must be zero.");
  2629     mooseError(
"Unable to find RestartableDataValue object with name " + 
name +
  2630                " in RestartableDataMap");
  2637                                           const std::filesystem::path & folder_base)
  2645     reader.
setInput(meta_data_folder_base);
  2657 std::vector<std::filesystem::path>
  2659                                    const std::filesystem::path & folder_base)
  2662     mooseError(
"MooseApp::writeRestartableMetaData(): Should only run on processor 0");
  2668   return writer.
write(meta_data_folder_base);
  2671 std::vector<std::filesystem::path>
  2674   std::vector<std::filesystem::path> paths;
  2680       paths.insert(paths.end(), map_paths.begin(), map_paths.end());
  2688                                  std::string library_path,
  2689                                  const std::string & library_name,
  2692 #ifdef LIBMESH_HAVE_DLOPEN  2694   params.
set<std::string>(
"app_name") = app_name;
  2696   params.
set<std::string>(
"registration_method") = app_name + 
"__registerApps";
  2697   params.
set<std::string>(
"library_path") = library_path;
  2699   const auto effective_library_name =
  2701   params.
set<std::string>(
"library_name") = effective_library_name;
  2702   params.
set<
bool>(
"library_load_dependencies") = lib_load_deps;
  2705   std::ostringstream oss;
  2707   auto successfully_loaded = 
false;
  2709     oss << 
'"' << app_name << 
"\" is not a registered application name.\n"  2710         << 
"No search paths were set. We made no attempts to locate the corresponding library "  2719       oss << 
'"' << app_name << 
"\" is not a registered application name.\n"  2720           << 
"Unable to locate library archive for \"" << app_name
  2721           << 
"\".\nWe attempted to locate the library archive \"" << effective_library_name
  2722           << 
"\" in the following paths:\n\t";
  2723       std::copy(paths.begin(), paths.end(), infix_ostream_iterator<std::string>(oss, 
"\n\t"));
  2726       successfully_loaded = 
true;
  2729   if (!successfully_loaded)
  2731     oss << 
"\nMake sure you have compiled the library and either set the \"library_path\" "  2732            "variable in your input file or exported \"MOOSE_LIBRARY_PATH\".\n";
  2738   libmesh_ignore(app_name, library_path, library_name, lib_load_deps);
  2739   mooseError(
"Dynamic Loading is either not supported or was not detected by libMesh configure.");
  2748                                  std::string library_path,
  2749                                  const std::string & library_name)
  2751 #ifdef LIBMESH_HAVE_DLOPEN  2753   params.
set<std::string>(
"app_name") = app_name;
  2755   params.
set<std::string>(
"registration_method") = app_name + 
"__registerAll";
  2756   params.
set<std::string>(
"library_path") = library_path;
  2757   params.
set<std::string>(
"library_name") =
  2763   params.
set<
bool>(
"library_load_dependencies") = 
false;
  2768   mooseError(
"Dynamic Loading is either not supported or was not detected by libMesh configure.");
  2776   const auto library_name = params.
get<std::string>(
"library_name");
  2779   for (
const auto & path : paths)
  2782           path + 
'/' + library_name, params, params.
get<
bool>(
"library_load_dependencies"));
  2788                                      const bool load_dependencies)
  2791   std::string dl_lib_filename;
  2795   pcrecpp::RE re_deps(
"(/\\S*\\.la)");
  2797   std::ifstream la_handle(library_filename.c_str());
  2798   if (la_handle.is_open())
  2800     while (std::getline(la_handle, line))
  2803       if (line.find(
"dlname=") != std::string::npos)
  2806         dl_lib_filename = line.substr(8, line.size() - 9);
  2808       if (line.find(
"dependency_libs=") != std::string::npos)
  2810         if (load_dependencies)
  2812           pcrecpp::StringPiece input(line);
  2813           pcrecpp::StringPiece depend_library;
  2814           while (re_deps.FindAndConsume(&input, &depend_library))
  2828   if (dl_lib_filename.empty())
  2847 #ifdef LIBMESH_HAVE_DLOPEN  2848     void * 
const lib_handle = dlopen(dl_lib_full_path.c_str(), RTLD_LAZY);
  2850     void * 
const lib_handle = 
nullptr;
  2856                  "\" exists and has proper permissions, but cannot by dynamically loaded.\nThis "  2857                  "generally means that the loader was unable to load one or more of the "  2858                  "dependencies listed in the supplied library (see otool or ldd).\n",
  2865     auto insert_ret = 
_lib_handles.insert(std::make_pair(file_name, lib_info));
  2866     mooseAssert(insert_ret.second == 
true, 
"Error inserting into lib_handles map");
  2868     dyn_lib_it = insert_ret.first;
  2872   const auto registration_method = params.
get<std::string>(
"registration_method");
  2873   auto & entry_sym_from_curr_lib = dyn_lib_it->second.entry_symbols;
  2875   if (entry_sym_from_curr_lib.find(registration_method) == entry_sym_from_curr_lib.end())
  2881 #ifdef LIBMESH_HAVE_DLOPEN  2882     void * registration_handle =
  2883         dlsym(dyn_lib_it->second.library_handle, registration_method.c_str());
  2885     void * registration_handle = 
nullptr;
  2888     if (registration_handle)
  2894           using register_app_t = 
void (*)();
  2895           register_app_t * 
const reg_ptr = 
reinterpret_cast<register_app_t *
>(®istration_handle);
  2902           register_app_t * 
const reg_ptr = 
reinterpret_cast<register_app_t *
>(®istration_handle);
  2912       entry_sym_from_curr_lib.insert(registration_method);
  2917 #if defined(DEBUG) && defined(LIBMESH_HAVE_DLOPEN)  2921       if (!registration_handle)
  2923                      registration_method,
  2927                      "This doesn't necessarily indicate an error condition unless you believe that "  2928                      "the method should exist in that library.\n",
  2935 std::set<std::string>
  2939   std::set<std::string> paths;
  2941     paths.insert(it.first);
  2946 std::set<std::string>
  2949   std::set<std::string> paths;
  2951   if (!library_path.empty())
  2953     std::vector<std::string> tmp_paths;
  2956     paths.insert(tmp_paths.begin(), tmp_paths.end());
  2959   char * moose_lib_path_env = std::getenv(
"MOOSE_LIBRARY_PATH");
  2960   if (moose_lib_path_env)
  2962     std::string moose_lib_path(moose_lib_path_env);
  2963     std::vector<std::string> tmp_paths;
  2966     paths.insert(tmp_paths.begin(), tmp_paths.end());
  2981   return std::string(
"");
  2999   TIME_SECTION(
"createMinimalApp", 3, 
"Creating Minimal App");
  3005     action_params.
set<std::string>(
"type") = 
"GeneratedMesh";
  3008     std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<
MooseObjectAction>(
  3014     params.set<
unsigned int>(
"nx") = 1;
  3024     action_params.
set<std::string>(
"type") = 
"Transient";
  3027     std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<
MooseObjectAction>(
  3032     params.
set<
unsigned int>(
"num_steps") = 1;
  3033     params.set<
Real>(
"dt") = 1;
  3043     action_params.
set<
bool>(
"_solve") = 
false;
  3046     std::shared_ptr<Action> action = std::static_pointer_cast<
Action>(
  3057     action_params.
set<
bool>(
"console") = 
false;
  3060     std::shared_ptr<Action> action =
  3075                       [&
name](
const std::shared_ptr<RelationshipManager> & rm)
  3084   auto & existing_for_whom = acceptor.
forWhom();
  3087   for (
auto & fw : donor.
forWhom())
  3089     if (
std::find(existing_for_whom.begin(), existing_for_whom.end(), fw) ==
  3090         existing_for_whom.end())
  3114   std::set<std::shared_ptr<RelationshipManager>> rms_to_erase;
  3118     if (*existing_rm >= *new_rm)
  3121       donateForWhom(*new_rm, *existing_rm);
  3126     else if (*new_rm >= *existing_rm)
  3127       rms_to_erase.emplace(existing_rm);
  3133     for (
const auto & rm_to_erase : rms_to_erase)
  3135       donateForWhom(*rm_to_erase, *new_rm);
  3147   static const std::string suffix = 
"-mesh.cpa.gz";
  3151 std::filesystem::path
  3153                              const std::string & map_suffix)
  3156                                                   std::filesystem::path(
"meta_data" + map_suffix));
  3159 std::filesystem::path
  3162   auto folder = folder_base;
  3163   folder += 
"-restart-" + std::to_string(
processor_id());
  3171     return action->parameters().getHitNode();
  3188     mooseError(
"The template rm does not exist in our _template_to_clones map");
  3190   auto & mesh_to_clone_map = outer_it->second;
  3191   auto inner_it = mesh_to_clone_map.find(&
mesh);
  3192   if (inner_it == mesh_to_clone_map.end())
  3193     mooseError(
"We should have the mesh key in our mesh");
  3195   return *inner_it->second;
  3205   const MeshBase * 
const undisp_lm_mesh = 
mesh->getMeshPtr();
  3207   if (undisp_lm_mesh && 
hasRMClone(*rm, *undisp_lm_mesh))
  3209     undisp_clone = &
getRMClone(*rm, *undisp_lm_mesh);
  3210     const_cast<MeshBase *
>(undisp_lm_mesh)->remove_ghosting_functor(*undisp_clone);
  3214   MeshBase * 
const disp_lm_mesh = displaced_mesh ? &displaced_mesh->getMesh() : 
nullptr;
  3216   if (disp_lm_mesh && 
hasRMClone(*rm, *disp_lm_mesh))
  3218     disp_clone = &
getRMClone(*rm, *disp_lm_mesh);
  3227       problem.removeAlgebraicGhostingFunctor(*undisp_clone);
  3228       problem.removeCouplingGhostingFunctor(*undisp_clone);
  3231     auto * dp = problem.getDisplacedProblem().get();
  3232     if (dp && disp_clone)
  3233       dp->removeAlgebraicGhostingFunctor(*disp_clone);
  3236   _factory.releaseSharedObjects(*rm);
  3244                                       const DofMap * 
const dof_map)
  3247   auto it = mesh_to_clone.find(&
mesh);
  3248   if (it != mesh_to_clone.end())
  3251     auto & clone_rm = *it->second;
  3252     if (!clone_rm.dofMap() && dof_map)
  3254       clone_rm.init(moose_mesh, 
mesh, dof_map);
  3255     else if (clone_rm.dofMap() && dof_map && (clone_rm.dofMap() != dof_map))
  3256       mooseError(
"Attempting to create and initialize an existing clone with a different DofMap. "  3257                  "This should not happen.");
  3267   auto pr = mesh_to_clone.emplace(
  3268       std::make_pair(&const_cast<const MeshBase &>(
mesh),
  3269                      dynamic_pointer_cast<RelationshipManager>(template_rm.
clone())));
  3270   mooseAssert(pr.second, 
"An insertion should have happened");
  3271   auto & clone_rm = *pr.first->second;
  3272   clone_rm.init(moose_mesh, 
mesh, dof_map);
  3283       if (rm->attachGeometricEarly())
  3296           if (moose_mesh_base != &mesh)
  3297             mooseError(
"The MooseMesh MeshBase and the MeshBase we're trying to attach "  3298                        "relationship managers to are different");
  3311                                      bool attach_geometric_rm_final)
  3315     if (!rm->isType(rm_type))
  3329       if (!rm->attachGeometricEarly() && !attach_geometric_rm_final)
  3332         mesh->allowRemoteElementRemoval(
false);
  3336         const DofMap * 
const undisp_sys_dof_map =
  3344             attach_geometric_rm_final && disp_moose_mesh)
  3347           const DofMap * disp_sys_dof_map = 
nullptr;
  3354           mooseError(
"The displaced mesh should not yet exist at the time that we are attaching "  3355                      "early geometric relationship managers.");
  3365         mooseError(
"We must have an executioner by now or else we do not have to data to add "  3366                    "algebraic or coupling functors to in MooseApp::attachRelationshipManagers");
  3370       auto & undisp_moose_mesh = problem.mesh();
  3372       auto & undisp_sys_dof_map = undisp_sys.
dofMap();
  3373       auto & undisp_mesh = undisp_moose_mesh.getMesh();
  3375       if (rm->useDisplacedMesh() && problem.getDisplacedProblem())
  3389           problem.addCouplingGhostingFunctor(
  3397           auto & disp_mesh = disp_moose_mesh.getMesh();
  3407           problem.addCouplingGhostingFunctor(
  3412           problem.addAlgebraicGhostingFunctor(
  3424 std::vector<std::pair<std::string, std::string>>
  3427   std::vector<std::pair<std::string, std::string>> info_strings;
  3432     std::stringstream oss;
  3433     oss << rm->getInfo();
  3435     auto & for_whom = rm->forWhom();
  3437     if (!for_whom.empty())
  3441       std::copy(for_whom.begin(), for_whom.end(), infix_ostream_iterator<std::string>(oss, 
", "));
  3444     info_strings.emplace_back(std::make_pair(
Moose::stringify(rm->getType()), oss.str()));
  3455     std::map<std::string, unsigned int> counts;
  3463         counts[
demangle(
typeid(*gf).name())]++;
  3466     for (
const auto & pair : counts)
  3467       info_strings.emplace_back(std::make_pair(
  3468           "Default", pair.first + (pair.second > 1 ? 
" x " + std::to_string(pair.second) : 
"")));
  3479     std::map<std::string, unsigned int> counts;
  3481     for (
auto & gf : 
as_range(d_mesh->getMesh().ghosting_functors_begin(),
  3482                               d_mesh->getMesh().ghosting_functors_end()))
  3487         counts[
demangle(
typeid(*gf).name())]++;
  3490     for (
const auto & pair : counts)
  3491       info_strings.emplace_back(
  3492           std::make_pair(
"Default",
  3493                          pair.first + (pair.second > 1 ? 
" x " + std::to_string(pair.second) : 
"") +
  3494                              " for DisplacedMesh"));
  3497   return info_strings;
  3509     std::vector<std::string> not_declared;
  3511     for (
const auto & data : meta_data)
  3512       if (!data.declared())
  3513         not_declared.push_back(data.name());
  3515     if (!not_declared.empty())
  3517       std::ostringstream oss;
  3519           not_declared.begin(), not_declared.end(), infix_ostream_iterator<std::string>(oss, 
", "));
  3523                  "' meta-data properties were retrieved but never declared: ",
  3537     mooseError(
"Unable to find RestartableDataMap object for the supplied name '",
  3539                "', did you call registerRestartableDataMapName in the application constructor?");
  3540   return iter->second.first;
  3552   if (!suffix.empty())
  3553     std::transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);
  3554   suffix.insert(0, 
"_");
  3564     mooseError(
"MooseApp::getRestartableDataMapName: The name '", 
name, 
"' is not registered");
  3565   return it->second.second;
  3574       std::make_unique<RestartableData<PerfGraph>>(
"perf_graph",
  3578                                                    getParam<bool>(
"perf_graph_live_all"),
  3579                                                    !getParam<bool>(
"disable_perf_graph_live"));
  3591   auto solution_invalidity =
  3592       std::make_unique<RestartableData<SolutionInvalidity>>(
"solution_invalidity", 
nullptr, *
this);
  3606 #ifdef MOOSE_LIBTORCH_ENABLED  3610   const auto pname = 
"--compute-device";
  3611   if (device_enum == 
"cuda")
  3614     if (!torch::cuda::is_available())
  3615       mooseError(pname, 
"=cuda: CUDA support is not available in the linked libtorch library");
  3616     return torch::kCUDA;
  3618     mooseError(pname, 
"=cuda: CUDA is not supported on your platform");
  3621   else if (device_enum == 
"mps")
  3624     if (!torch::mps::is_available())
  3625       mooseError(pname, 
"=mps: MPS support is not available in the linked libtorch library");
  3628     mooseError(pname, 
"=mps: MPS is not supported on your platform");
  3632   else if (device_enum != 
"cpu")
  3635                "' is not currently supported by the MOOSE libtorch integration.");
  3642                                     const std::string & start_marker,
  3643                                     const std::string & end_marker,
  3644                                     const std::string & data)
 const  3649     Moose::out << start_marker << data << end_marker << std::endl;
  3654   const auto & filename = getParam<std::string>(param);
  3656   std::ofstream 
out(filename.c_str());
  3659     std::ofstream 
out(filename.c_str());
  3660     out << data << std::flush;
  3664     mooseError(
"Unable to open file `", filename, 
"` for writing ", param, 
" data to it.");
  3670                         const std::string & doc)
  3683 #ifdef MOOSE_MFEM_ENABLED  3688   auto string_set = std::set<std::string>(string_vec.begin(), string_vec.end());
  3691     _mfem_device = std::make_shared<mfem::Device>(device_string);
  3695   else if (!device_string.empty() && string_set != 
_mfem_devices)
  3696     mooseError(
"Attempted to configure with MFEM devices '",
  3698                "', but we have already configured the MFEM device object with the devices '",
 std::string name(const ElemQuality q)
GhostingFunctorIterator ghosting_functors_begin() const
std::list< std::string > getCheckpointFiles() const
Extract all possible checkpoint file names. 
virtual bool constructingMeshGenerators() const
Whether this app is constructing mesh generators. 
std::list< std::string > getCheckpointDirectories() const
Get all checkpoint directories. 
static const std::string & checkpointSuffix()
The file suffix for the checkpoint mesh. 
std::string getFileName(bool stripLeadingPath=true) const
Return the primary (first) filename that was parsed Note: When stripLeadingPath is false...
void mooseInfo(Args &&... args) const
std::string docsDir(const std::string &app_name)
Returns the directory of any installed docs/site. 
void build()
Parse an input file (or text string if provided) consisting of hit syntax and setup objects in the MO...
void addExecutorParams(const std::string &type, const std::string &name, const InputParameters ¶ms)
Adds the parameters for an Executor to the list of parameters. 
virtual std::string getPrintableName() const
Get printable name of the application. 
unsigned int _multiapp_level
Level of multiapp, the master is level 0. This used by the Console to indent output. 
virtual std::string getInstallableInputs() const
Method to retrieve the installable inputs from a given applications <app>Revision.h file. 
void write(std::ostream &header_stream, std::ostream &data_stream)
Writes the restartable data to header stream header_stream and data stream data_stream. 
PerfGraph & _perf_graph
The PerfGraph object for this application (recoverable) 
bool show_trace
Set to true (the default) to print the stack trace with error and warning messages - false to omit it...
void setOutputPosition(const Point &p)
Tell the app to output in a specific position. 
std::string join(Iterator begin, Iterator end, const std::string &delimiter)
Python-like join function for strings over an iterator range. 
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array. 
std::unordered_map< std::string, std::pair< std::string, std::unique_ptr< InputParameters > > > _executor_params
Used in building the Executors Maps the name of the Executor block to the <type, params> ...
bool isUltimateMaster() const
Whether or not this app is the ultimate master app. 
std::map< Moose::RelationshipManagerType, std::set< const RelationshipManager * > > _attached_relationship_managers
The relationship managers that have been attached (type -> RMs) 
const InputParameters & _pars
The object's parameters. 
Reader for restartable data written by the RestartableDataWriter. 
std::string _restart_recover_base
The base name to restart/recover from. If blank then we will find the newest checkpoint file...
void dynamicRegistration(const libMesh::Parameters ¶ms)
Helper method for dynamic loading of objects. 
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
bool hasRestartableMetaData(const std::string &name, const RestartableDataMapName &metaname) const
virtual void setupOptions()
Setup options based on InputParameters. 
PerfGraph & createRecoverablePerfGraph()
Creates a recoverable PerfGraph. 
std::shared_ptr< DisplacedProblem > displaced_problem
std::string libNameToAppName(const std::string &library_name) const
Converts a library name to an application name: 
const unsigned int invalid_uint
RelationshipManagerType
Main types of Relationship Managers. 
void registerCapabilities()
Register all base MooseApp capabilities to the Moose::Capabilities registry. 
const std::shared_ptr< Parser > _parser
Parser for parsing the input file (owns the root hit node) 
std::string getFrameworkVersion() const
Returns the framework version. 
Base class for everything in MOOSE with a name and a type. 
const std::multimap< std::string, ActionInfo > & getAssociatedActions() const
Return all Syntax to Action associations. 
void setRecover(bool value)
void buildFullTree(const std::string &search_string)
Use MOOSE Factories to construct a full parse tree for documentation or echoing input. 
std::vector< std::pair< std::string, std::string > > getRelationshipManagerInfo() const
Returns the Relationship managers info suitable for printing. 
const T & getParam(const std::string &name) const
Retrieve a parameter for the object. 
bool hasRMClone(const RelationshipManager &template_rm, const MeshBase &mesh) const
torch::DeviceType determineLibtorchDeviceType(const MooseEnum &device) const
Function to determine the device which should be used by libtorch on this application. 
bool _file_base_set_by_user
Whether or not file base is set through input or setOutputFileBase by MultiApp. 
const Action * getCurrentAction() const
bool _output_position_set
Whether or not an output position has been set for this app. 
void addDependency(const std::string &task, const std::string &pre_req)
std::unique_ptr< TheWarehouse > _the_warehouse
The combined warehouse for storing any MooseObject based object. 
InputParameters getValidParams(const std::string &name)
void setCheckUnusedFlag(bool warn_is_error=false)
Set a flag so that the parser will either warn or error when unused variables are seen after parsing ...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
bool hasInitialBackup() const
void setInput(std::unique_ptr< std::stringstream > header_stream, std::unique_ptr< std::stringstream > data_stream)
Sets the input stream for reading from the stringstreams header_stream and data_stream for the header...
static std::filesystem::path metaDataFolderBase(const std::filesystem::path &folder_base, const std::string &map_suffix)
The file suffix for meta data (header and data) 
bool _warnings_are_errors
Variable to toggle any warning into an error (includes deprecated code warnings) 
std::string installedInputsDir(const std::string &app_name, const std::string &dir_name, const std::string &extra_error_msg="")
Returns the directory of any installed inputs or the empty string if none are found. 
InputParameterWarehouse & getInputParameterWarehouse()
Get the InputParameterWarehouse for MooseObjects. 
bool tokenizeAndConvert(const std::string &str, std::vector< T > &tokenized_vector, const std::string &delimiter=" \\\)
tokenizeAndConvert splits a string using delimiter and then converts to type T. 
static const RestartableDataMapName MESH_META_DATA
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications. 
void registerTaskName(const std::string &task, bool should_auto_build=false)
Method to register a new task. 
virtual const std::type_info & typeId() const =0
The type ID of the underlying data. 
std::shared_ptr< MooseMesh > & displacedMesh()
static const std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > & allActions()
Returns a per-label keyed map of all Actions in the registry. 
virtual std::string appBinaryName() const
const InputParameters & parameters() const
Get the parameters of the object. 
const std::shared_ptr< MooseMesh > & getMesh() const
std::string getOutputFileBase(bool for_non_moose_build_output=false) const
Get the output file base name. 
static void addInputParam(InputParameters ¶ms)
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
RelationshipManager & getRMClone(const RelationshipManager &template_rm, const MeshBase &mesh) const
Return the relationship manager clone originally created from the provided template relationship mana...
void setFinalTask(const std::string &task)
void deallocateKokkosMemoryPool()
Deallocate Kokkos memory pool. 
bool runInputs()
Handles the run input parameter logic: Checks to see whether a directory exists in user space and lau...
void registerRestartableNameWithFilter(const std::string &name, Moose::RESTARTABLE_FILTER filter)
NOTE: This is an internal function meant for MOOSE use only! 
virtual void run()
Run the application. 
void removeRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Purge this relationship manager from meshes and DofMaps and finally from us. 
Real _start_time
The time at which to start the simulation. 
Writer for restartable data, to be read by the RestartableDataReader. 
This attribute describes sorting state. 
void createExecutors()
After adding all of the Executor Params - this function will actually cause all of them to be built...
void recursivelyCreateExecutors(const std::string ¤t_executor_name, std::list< std::string > &possible_roots, std::list< std::string > ¤t_branch)
Internal function used to recursively create the executor objects. 
bool forceRestart() const
Whether or not we are forcefully restarting (allowing the load of potentially incompatibie checkpoint...
std::filesystem::path restartFolderBase(const std::filesystem::path &folder_base) const
The file suffix for restartable data. 
const bool _use_split
Whether or not we are using a (pre-)split mesh (automatically DistributedMesh) 
std::pair< std::filesystem::path, std::filesystem::path > splitFileName(const T &full_file)
Function for splitting path and filename. 
void remove_ghosting_functor(GhostingFunctor &ghosting_functor)
bool hasRelationshipManager(const std::string &name) const
Returns a Boolean indicating whether a RelationshipManater exists with the same name. 
std::list< std::string > getFilesInDirs(const std::list< std::string > &directory_list, const bool files_only=true)
Retrieves the names of all of the files contained within the list of directories passed into the rout...
bool _check_input
true if we want to just check the input file 
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies. 
const Parallel::Communicator & comm() const
bool hasRestartableDataMap(const RestartableDataMapName &name) const
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse. 
std::set< std::string > _mfem_devices
MFEM supported devices based on user-provided config. 
Syntax _syntax
Syntax of the input file. 
Syntax & syntax()
Returns a writable reference to the syntax object. 
std::map< std::string, std::shared_ptr< Executor > > _executors
Pointers to all of the Executors for this run. 
std::vector< std::filesystem::path > writeRestartableMetaData(const RestartableDataMapName &name, const std::filesystem::path &folder_base)
Writes the restartable meta data for name with a folder base of folder_base. 
ExecuteMooseObjectWarehouse< MultiApp > & getMultiAppWarehouse()
bool _trap_fpe
Whether or not FPE trapping should be turned on. 
int exitCode() const
Get the shell exit code for the application. 
GhostingFunctorIterator ghosting_functors_end() const
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor. 
static const std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > & allObjects()
Returns a per-label keyed map of all MooseObjects in the registry. 
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Helper class to hold streams for Backup and Restore operations. 
const hit::Node * getCurrentActionHitNode() const
ActionWarehouse _action_warehouse
Where built actions are stored. 
std::string realpath(const std::string &path)
Wrapper around PetscGetRealPath, which is a cross-platform replacement for realpath. 
RestartableDataReader _rd_reader
void checkMetaDataIntegrity() const
Function to check the integrity of the restartable meta data structure. 
const std::list< Action * > & getActionListByName(const std::string &task) const
Retrieve a constant list of Action pointers associated with the passed in task. 
virtual const std::vector< std::string > & forWhom() const
The object (or Action) this RelationshipManager was built for. 
static InputParameters validParams()
bool isRestarting() const
Whether or not this is a "restart" calculation. 
bool isSplitMesh() const
Whether or not this is a split mesh operation. 
RestartableDataMap & getRestartableDataMap(const RestartableDataMapName &name)
Return a reference to restartable data for the specific type flag. 
Holds the syntax in a Json::Value tree. 
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations. 
std::string hostname()
Get the hostname the current process is running on. 
FEProblemBase & feProblem() const
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters ¶meters)
MooseApp(const InputParameters ¶meters)
Constructor is protected so that this object is constructed through the AppFactory object...
std::optional< MooseEnum > getComputeDevice() const
Get the device accelerated computations are supposed to be running on. 
void allowRemoteElementRemoval(bool allow_removal)
Set whether to allow remote element removal. 
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid) 
std::string camelCaseToUnderscore(const std::string &camel_case_name)
Function for converting a camel case name to a name containing underscores. 
RelationshipManager & createRMFromTemplateAndInit(const RelationshipManager &template_rm, MooseMesh &moose_mesh, MeshBase &mesh, const libMesh::DofMap *dof_map=nullptr)
Take an input relationship manager, clone it, and then initialize it with provided mesh and optional ...
void setOutputFileBase(const std::string &output_file_base)
Override the selection of the output file base name. 
std::vector< std::string > split(const std::string &str, const std::string &delimiter, std::size_t max_count=std::numeric_limits< std::size_t >::max())
Python like split functions for strings. 
This class wraps provides and tracks access to command line parameters. 
int _exit_code
The exit code. 
Storage for restartable data that is ordered based on insertion order. 
CapabilityUtils::Result check(const std::string &requested_capabilities) const
check if the given required capabilities are fulfilled, returns a bool, a reason, and a verbose docum...
std::shared_ptr< MooseMesh > & mesh()
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies. 
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators. 
void attachRelationshipManagers(Moose::RelationshipManagerType rm_type, bool attach_geometric_rm_final=false)
Attach the relationship managers of the given type Note: Geometric relationship managers that are sup...
const MeshBase * getMeshPtr() const
bool _start_time_set
Whether or not an start time has been set. 
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map. 
void allow_remote_element_removal(bool allow)
void libmesh_ignore(const Args &...)
void possiblyLoadRestartableMetaData(const RestartableDataMapName &name, const std::filesystem::path &folder_base)
Loads the restartable meta data for name if it is available with the folder base folder_base. 
const std::string & name() const
Get the name of the class. 
bool showInputs() const
Prints a message showing the installable inputs for a given application (if getInstallableInputs has ...
bool addRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Transfers ownership of a RelationshipManager to the application for lifetime management. 
RestartableDataValue & getRestartableMetaData(const std::string &name, const RestartableDataMapName &metaname, THREAD_ID tid)
std::shared_ptr< NullExecutor > _null_executor
Used to return an executor that does nothing. 
const T & get(std::string_view) const
const std::string & getLastInputFileName() const
virtual void preBackup()
Insertion point for other apps that is called before backup() 
InputParameters & getObjectParams()
Retrieve the parameters of the object to be created by this action. 
void setErrorOverridden()
Set a flag so that the parser will throw an error if overridden parameters are detected. 
void resetFileBase()
Resets the file base for all FileOutput objects. 
virtual void postRestore(const bool)
Insertion point for other apps that is called after restore() 
T command_line_value(const std::string &, T)
void loadLibraryAndDependencies(const std::string &library_filename, const libMesh::Parameters ¶ms, bool load_dependencies=true)
Recursively loads libraries and dependencies in the proper order to fully register a MOOSE applicatio...
virtual std::unique_ptr< Base > create()=0
Tracks the libmesh system number that a MooseObject is associated with. 
const std::vector< std::shared_ptr< T > > & getObjects(THREAD_ID tid=0) const
Retrieve complete vector to the all/block/boundary restricted objects for a given thread...
bool _restart
Whether or not this is a restart run. 
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
std::unique_ptr< Backup > backup()
Backs up the application memory in a Backup. 
bool _deprecated_is_error
Variable to toggle only deprecated warnings as errors. 
Generic AppFactory class for building Application objects. 
RESTARTABLE_FILTER
The filter type applied to a particular piece of "restartable" data. 
void clearAppParams(const InputParameters ¶ms, const ClearAppParamsKey)
Clears the stored parameters for the given application parameteres. 
void mooseDeprecated(Args &&... args) const
void meshChanged()
Calls the meshChanged method for every output object. 
void setErrorOnLoadWithDifferentNumberOfProcessors(bool value)
void setActive(bool active)
Turn on or off timing. 
RestartableDataValue & registerRestartableData(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
void initSyntaxFormatter(SyntaxFormatterType type, bool dump_mode)
Creates a syntax formatter for printing. 
Specialized factory for generic Action System objects. 
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true, bool check_for_git_lfs_pointer=true)
Checks to see if a file is readable (exists and permissions) 
void setRestart(bool value)
Sets the restart/recover flags. 
AttribBoundaries tracks all boundary IDs associated with an object. 
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions) 
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
ActionFactory _action_factory
The Factory responsible for building Actions. 
std::string runTestsExecutable()
Returns the location of either a local repo run_tests script - or an installed test executor script i...
void disableLivePrint()
Completely disables Live Print (cannot be restarted) 
const std::string & type() const
Get the type of this class. 
void restoreFromInitialBackup(const bool for_restart)
Restores from a "initial" backup, that is, one set in _initial_backup. 
std::string underscoreToCamelCase(const std::string &underscore_name, bool leading_upper_case)
Function for converting an underscore name to a camel case name. 
const Parser & parser() const
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
RegistrationType
Enumeration for holding the valid types of dynamic registrations allowed. 
Executioners are objects that do the actual work of solving your problem. 
enum MooseApp::UNUSED_CHECK _enable_unused_check
bool _recover
Whether or not this is a recovery run. 
void buildJsonSyntaxTree(JsonSyntaxTree &tree) const
Use MOOSE Factories to construct a parameter tree for documentation or echoing input. 
Point _output_position
The output position. 
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args. 
const std::shared_ptr< CommandLine > _command_line
The CommandLine object. 
void errorCheck(const libMesh::Parallel::Communicator &comm, bool warn_unused, bool err_unused)
const nlohmann::json & getRoot() const
Get the root of the tree. 
bool _error_overridden
Indicates whether warnings or errors are displayed when overridden parameters are detected...
virtual std::string getVersion() const
Returns the current version of the framework or application (default: framework version). 
SolutionInvalidity & createRecoverableSolutionInvalidity()
Creates a recoverable SolutionInvalidity. 
bool _heap_profiling
Memory profiling. 
std::string getPrimaryFileName(bool stripLeadingPath=true) const
Return the primary (first) filename that was parsed. 
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies. 
std::string stringify(const T &t)
conversion to string 
Class for storing and utilizing output objects. 
std::string demangle(const char *name)
void addForWhom(const std::string &for_whom)
Add another name to for_whom. 
Interface for objects interacting with the PerfGraph. 
Executioner * getExecutioner() const
Retrieve the Executioner for this App. 
std::set< std::string > getLibrarySearchPaths(const std::string &library_path_from_param) const
Return the paths searched by MOOSE when loading libraries. 
The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidit...
std::unordered_map< std::string, DynamicLibraryInfo > _lib_handles
The library archive (name only), registration method and the handle to the method. 
void outputMachineReadableData(const std::string ¶m, const std::string &start_marker, const std::string &end_marker, const std::string &data) const
Outputs machine readable data (JSON, YAML, etc.) either to the screen (if no filename was provided as...
static std::filesystem::path restartableDataFolder(const std::filesystem::path &folder_base)
virtual std::string type() const =0
String identifying the type of parameter stored. 
static AppFactory & instance()
Get the instance of the AppFactory. 
Residual objects have this attribute. 
const std::string & getCurrentTaskName() const
const std::string & getRestartableDataMapName(const RestartableDataMapName &name) const
static Capabilities & getCapabilityRegistry()
bool hasRecoverFileBase() const
std::map< const RelationshipManager *, std::map< const MeshBase *, std::unique_ptr< RelationshipManager > > > _template_to_clones
Map from a template relationship manager to a map in which the key-value pairs represent the MeshBase...
bool hasRestartRecoverFileBase() const
Return true if the recovery file base is set. 
void registerRestartableDataMapName(const RestartableDataMapName &name, std::string suffix="")
Reserve a location for storing custom RestartableDataMap objects. 
static void checkReservedCapability(const std::string &capability)
Helper that reports an error if the given capability is reserved and should not be added via addCapab...
void restore(const std::filesystem::path &folder_base, const bool for_restart)
Restore an application from file. 
bool _trap_fpe
Variable indicating whether we will enable FPE trapping for this run. 
void loadRestartableMetaData(const std::filesystem::path &folder_base)
Loads all available restartable meta data if it is available with the folder base folder_base...
std::filesystem::path pathjoin(const std::filesystem::path &p)
virtual void executeExecutioner()
Execute the Executioner that was built. 
bool _distributed_mesh_on_command_line
This variable indicates that DistributedMesh should be used for the libMesh mesh underlying MooseMesh...
void addExecutor(const std::string &type, const std::string &name, const InputParameters ¶ms)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
PetscErrorCode petscSetupOutput(CommandLine *cmd_line)
void add_command_line_name(const std::string &name)
Moose::Builder _builder
Builder for building app related parser tree. 
const std::shared_ptr< MooseMesh > & getDisplacedMesh() const
std::string RestartableDataMapName
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added. 
OutputWarehouse _output_warehouse
OutputWarehouse object for this App. 
std::string _output_file_base
The output file basename. 
std::streambuf * _output_buffer_cache
Cache output buffer so the language server can turn it off then back on. 
static void addAppParam(InputParameters ¶ms)
bool _cpu_profiling
CPU profiling. 
T & set(const std::string &)
const std::vector< std::shared_ptr< Action > > & allActionBlocks() const
Returns a reference to all of the actions. 
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
Concrete definition of a parameter value for a specified type. 
void build()
Builds all auto-buildable tasks. 
void registerAll(Factory &f, ActionFactory &af, Syntax &s)
Register objects that are in MOOSE. 
virtual void runInputFile()
Actually build everything in the input file. 
bool setColorConsole(bool use_color, bool force=false)
Turns color escape sequences on/off for info written to stdout. 
std::variant< bool, int, std::string > Type
A capability can have a bool, int, or string value. 
virtual std::string header() const
Returns a string to be printed at the beginning of a simulation. 
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type. 
Holding syntax for parsing input files. 
class infix_ostream_iterator if void
std::unordered_set< std::string > DataNames
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
bool _has_kokkos_objects
Flag whether there is any Kokkos object added by actions. 
static const std::string MESH_META_DATA_SUFFIX
SolverSystem & getSolverSystem(unsigned int sys_num)
Get non-constant reference to a solver system. 
void executeAllActions()
This method loops over all actions in the warehouse and executes them. 
std::unique_ptr< InputParameterWarehouse > _input_parameter_warehouse
Input parameter storage structure; unique_ptr so we can control its destruction order. 
virtual std::unique_ptr< GhostingFunctor > clone() const
std::string getCurrentWorkingDir()
Returns the current working directory as a string. 
const std::vector< std::string > & getInputFileNames() const
void setMFEMDevice(const std::string &device_string, Moose::PassKey< MFEMProblemSolve >)
Create/configure the MFEM device with the provided device_string. 
Tracks whether the object is on the displaced mesh. 
static void addCapability(const std::string &capability, CapabilityUtils::Type value, const std::string &doc)
register a new capability 
InputStreams clear()
Clears the contents of the reader (header stream, data stream, header) 
void makedirs(const std::string &dir_name, bool throw_on_failure=false)
Recursively make directories. 
std::unique_ptr< Backup > finalizeRestore()
Finalizes (closes) the restoration process done in restore(). 
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid. 
const ConsoleStream _console
An instance of helper class to write streams to the Console objects. 
bool appendingMeshGenerators() const
Whether or not mesh generators are currently being appended (append_mesh_generator task) ...
static const std::string allow_data_driven_param
The name of the boolean parameter on the MooseApp that will enable data driven generation. 
void restore(const DataNames &filter_names={})
Restores the restartable data. 
void dynamicAllRegistration(const std::string &app_name, Factory *factory, ActionFactory *action_factory, Syntax *syntax, std::string library_path, const std::string &library_name)
Thes methods are called to register applications or objects on demand. 
const DataNames & getRecoverableData() const
Return a reference to the recoverable data object. 
void setDeclared(const SetDeclaredKey)
Sets that this restartable value has been declared. 
const std::shared_ptr< libMesh::Parallel::Communicator > _comm
The MPI communicator this App is going to use. 
std::string getPrintableVersion() const
Non-virtual method for printing out the version string in a consistent format. 
std::shared_ptr< mfem::Device > _mfem_device
The MFEM Device object. 
std::vector< const T * > getActions()
Retrieve all actions in a specific type ordered by their names. 
bool pathExists(const std::string &path)
void createMinimalApp()
Method for creating the minimum required actions for an application (no input file) ...
void setExitCode(const int exit_code)
Sets the exit code that the application will exit with. 
Exception to be thrown whenever we have _throw_on_error set and a mooseError() is emitted...
bool isRecovering() const
Whether or not this is a "recover" calculation. 
DataNames _recoverable_data_names
Data names that will only be read from the restart file during RECOVERY. 
Executor * getExecutor() const
The PerfGraph will hold the master list of all registered performance segments and the head PerfNode...
bool copyInputs()
Handles the copy_inputs input parameter logic: Checks to see whether the passed argument is valid (a ...
bool _throw_on_error
Variable to turn on exceptions during mooseError(), should only be used within MOOSE unit tests or wh...
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default. 
void clear()
This method deletes all of the Actions in the warehouse. 
A scope guard that guarantees that whatever happens between when it gets created and when it is destr...
void disableCheckUnusedFlag()
Removes warnings and error checks for unrecognized variables in the input file. 
void add(const std::string &capability, CapabilityUtils::Type value, const std::string &doc)
register a new capability 
bool _split_mesh
Whether or not we are performing a split mesh operation (–split-mesh) 
void ErrorVector unsigned int
const bool _use_executor
Indicates whether we are operating in the new/experimental executor mode instead of using the legacy ...
Abstract definition of a RestartableData value. 
Class for parsing input files. 
Meta-action for creating common output object parameters This action serves two purpose, first it adds common output object parameters. 
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects. 
std::string getExecutableName()
Gets the name of the running executable on Mac OS X and linux. 
std::string appNameToLibName(const std::string &app_name) const
Converts an application name to a library name: Examples: AnimalApp -> libanimal-oprof.la (assuming METHOD=oprof) ThreeWordAnimalApp -> libthree_word_animal-dbg.la (assuming METHOD=dbg) 
static InputParameters validParams()
static char addKnownLabel(const std::string &label)
addKnownLabel whitelists a label as valid for purposes of the checkLabels function. 
void setStartTime(Real time)
Set the starting time for the simulation. 
std::shared_ptr< Executor > _executor
Pointer to the Executor of this run. 
The Executor class directs the execution flow of simulations. 
void add_ghosting_functor(GhostingFunctor &ghosting_functor)
std::string findTestRoot()
Searches in the current working directory and then recursively up in each parent directory looking fo...
void errorCheck()
Runs post-initialization error checking that cannot be run correctly unless the simulation has been f...
std::set< std::string > getLoadedLibraryPaths() const
Return the paths of loaded libraries. 
std::string _early_exit_param
Indicates if simulation is ready to exit, and keeps track of which param caused it to exit...
static bool isAvailable(const std::filesystem::path &folder_base)
void dynamicAppRegistration(const std::string &app_name, std::string library_path, const std::string &library_name, bool lib_load_deps)
std::unique_ptr< Backup > *const _initial_backup
The backup for use in initial setup; this will get set from the _initial_backup input parameter that ...