www.mooseframework.org
MooseApp.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #ifdef HAVE_GPERFTOOLS
11 #include "gperftools/profiler.h"
12 #endif
13 
14 // MOOSE includes
15 #include "MooseRevision.h"
16 #include "AppFactory.h"
17 #include "DisplacedProblem.h"
18 #include "NonlinearSystemBase.h"
19 #include "AuxiliarySystem.h"
20 #include "MooseSyntax.h"
21 #include "MooseInit.h"
22 #include "Executioner.h"
23 #include "PetscSupport.h"
24 #include "Conversion.h"
25 #include "CommandLine.h"
26 #include "InfixIterator.h"
27 #include "MultiApp.h"
28 #include "MeshModifier.h"
29 #include "MeshGenerator.h"
30 #include "DependencyResolver.h"
31 #include "MooseUtils.h"
32 #include "MooseObjectAction.h"
34 #include "SystemInfo.h"
35 #include "RestartableDataIO.h"
36 #include "MooseMesh.h"
37 #include "FileOutput.h"
38 #include "ConsoleUtils.h"
39 #include "JsonSyntaxTree.h"
40 #include "JsonInputFileFormatter.h"
41 #include "SONDefinitionFormatter.h"
42 #include "RelationshipManager.h"
43 #include "Registry.h"
44 #include "SerializerGuard.h"
45 #include "PerfGraphInterface.h" // For TIME_SECTIOn
46 #include "Attributes.h"
47 #include "MooseApp.h"
48 
49 // Regular expression includes
50 #include "pcrecpp.h"
51 
52 #include "libmesh/exodusII_io.h"
53 #include "libmesh/mesh_refinement.h"
54 #include "libmesh/string_to_enum.h"
55 #include "libmesh/checkpoint_io.h"
56 #include "libmesh/mesh_base.h"
57 
58 // System include for dynamic library methods
59 #include <dlfcn.h>
60 #include <sys/utsname.h> // utsname
61 
62 // C++ includes
63 #include <numeric> // std::accumulate
64 #include <fstream>
65 #include <sys/types.h>
66 #include <unistd.h>
67 #include <cstdlib> // for system()
68 #include <chrono>
69 #include <thread>
70 
71 #define QUOTE(macro) stringifyName(macro)
72 
74 
77 {
79 
80  params.addCommandLineParam<bool>(
81  "display_version", "-v --version", false, "Print application version");
82  params.addCommandLineParam<std::string>("input_file", "-i <input_file>", "Specify an input file");
83  params.addCommandLineParam<std::string>(
84  "mesh_only",
85  "--mesh-only [mesh_file_name]",
86  "Setup and Output the input mesh only (Default: \"<input_file_name>_in.e\")");
87 
88  params.addCommandLineParam<bool>("show_input",
89  "--show-input",
90  false,
91  "Shows the parsed input file before running the simulation.");
92  params.addCommandLineParam<bool>(
93  "show_outputs", "--show-outputs", false, "Shows the output execution time information.");
94  params.addCommandLineParam<bool>(
95  "show_controls", "--show-controls", false, "Shows the Control logic available and executed.");
96 
97  params.addCommandLineParam<bool>(
98  "no_color", "--no-color", false, "Disable coloring of all Console outputs.");
99  params.addCommandLineParam<std::string>("color",
100  "--color [auto,on,off]",
101  "default-on",
102  "Whether to use color in console output (default 'on').");
103 
104  params.addCommandLineParam<bool>("help", "-h --help", false, "Displays CLI usage statement.");
105  params.addCommandLineParam<bool>(
106  "minimal",
107  "--minimal",
108  false,
109  "Ignore input file and build a minimal application with Transient executioner.");
110 
111  params.addCommandLineParam<std::string>(
112  "definition", "--definition", "Shows a SON style input definition dump for input validation");
113  params.addCommandLineParam<std::string>(
114  "dump", "--dump [search_string]", "Shows a dump of available input file syntax.");
115  params.addCommandLineParam<bool>(
116  "registry", "--registry", "Lists all known objects and actions.");
117  params.addCommandLineParam<bool>(
118  "registry_hit", "--registry-hit", "Lists all known objects and actions in hit format.");
119 
120  params.addCommandLineParam<bool>(
121  "apptype", "--type", false, "Return the name of the application object.");
122  params.addCommandLineParam<std::string>(
123  "yaml", "--yaml", "Dumps input file syntax in YAML format.");
124  params.addCommandLineParam<std::string>(
125  "json", "--json", "Dumps input file syntax in JSON format.");
126  params.addCommandLineParam<bool>(
127  "syntax", "--syntax", false, "Dumps the associated Action syntax paths ONLY");
128  params.addCommandLineParam<bool>("check_input",
129  "--check-input",
130  false,
131  "Check the input file (i.e. requires -i <filename>) and quit.");
132  params.addCommandLineParam<bool>(
133  "list_constructed_objects",
134  "--list-constructed-objects",
135  false,
136  "List all moose object type names constructed by the master app factory.");
137 
138  params.addCommandLineParam<unsigned int>(
139  "n_threads", "--n-threads=<n>", 1, "Runs the specified number of threads per process");
140 
141  params.addCommandLineParam<bool>(
142  "warn_unused", "-w --warn-unused", false, "Warn about unused input file options");
143  params.addCommandLineParam<bool>("error_unused",
144  "-e --error-unused",
145  false,
146  "Error when encountering unused input file options");
147  params.addCommandLineParam<bool>(
148  "error_override",
149  "-o --error-override",
150  false,
151  "Error when encountering overridden or parameters supplied multiple times");
152  params.addCommandLineParam<bool>(
153  "error_deprecated", "--error-deprecated", false, "Turn deprecated code messages into Errors");
154 
155  params.addCommandLineParam<bool>(
156  "distributed_mesh",
157  "--distributed-mesh",
158  false,
159  "The libMesh Mesh underlying MooseMesh should always be a DistributedMesh");
160 
161  params.addCommandLineParam<std::string>(
162  "split_mesh",
163  "--split-mesh [splits]",
164  "comma-separated list of numbers of chunks to split the mesh into");
165 
166  params.addCommandLineParam<std::string>("split_file",
167  "--split-file [filename]",
168  "",
169  "optional name of split mesh file(s) to write/read");
170 
171  params.addCommandLineParam<bool>(
172  "use_split", "--use-split", false, "use split distributed mesh files");
173 
174  params.addCommandLineParam<unsigned int>(
175  "refinements",
176  "-r <n>",
177  0,
178  "Specify additional initial uniform refinements for automatic scaling");
179 
180  params.addCommandLineParam<std::string>("recover",
181  "--recover [file_base]",
182  "Continue the calculation. If file_base is omitted then "
183  "the most recent recovery file will be utilized");
184 
185  params.addCommandLineParam<std::string>("recoversuffix",
186  "--recoversuffix [suffix]",
187  "Use a different file extension, other than cpr, "
188  "for a recovery file");
189 
190  params.addCommandLineParam<bool>("half_transient",
191  "--half-transient",
192  false,
193  "When true the simulation will only run half of "
194  "its specified transient (ie half the "
195  "timesteps). This is useful for testing "
196  "recovery and restart");
197 
198  // No default on these two options, they must not both be valid
199  params.addCommandLineParam<bool>(
200  "trap_fpe",
201  "--trap-fpe",
202  "Enable Floating Point Exception handling in critical sections of "
203  "code. This is enabled automatically in DEBUG mode");
204  params.addCommandLineParam<bool>("no_trap_fpe",
205  "--no-trap-fpe",
206  "Disable Floating Point Exception handling in critical "
207  "sections of code when using DEBUG mode.");
208 
209  params.addCommandLineParam<bool>("error", "--error", false, "Turn all warnings into errors");
210 
211  params.addCommandLineParam<bool>(
212  "timing",
213  "-t --timing",
214  false,
215  "Enable all performance logging for timing purposes. This will disable all "
216  "screen output of performance logs for all Console objects.");
217  params.addCommandLineParam<bool>("no_timing",
218  "--no-timing",
219  false,
220  "Disabled performance logging. Overrides -t or --timing "
221  "if passed in conjunction with this flag");
222 
223  params.addCommandLineParam<bool>(
224  "allow_test_objects", "--allow-test-objects", false, "Register test objects and syntax.");
225 
226  // Options ignored by MOOSE but picked up by libMesh, these are here so that they are displayed in
227  // the application help
228  params.addCommandLineParam<bool>(
229  "keep_cout",
230  "--keep-cout",
231  false,
232  "Keep standard output from all processors when running in parallel");
233  params.addCommandLineParam<bool>(
234  "redirect_stdout",
235  "--redirect-stdout",
236  false,
237  "Keep standard output from all processors when running in parallel");
238 
239  // Options for debugging
240  params.addCommandLineParam<std::string>("start_in_debugger",
241  "--start-in-debugger <debugger>",
242  "Start the application and attach a debugger. This will "
243  "launch xterm windows using the command you specify for "
244  "'debugger'");
245 
246  params.addCommandLineParam<unsigned int>("stop_for_debugger",
247  "--stop-for-debugger [seconds]",
248  30,
249  "Pauses the application during startup for the "
250  "specified time to allow for connection of debuggers.");
251  params.addParam<bool>(
252  "automatic_automatic_scaling", false, "Whether to turn on automatic scaling by default.");
253 
254  params.addPrivateParam<std::string>("_app_name"); // the name passed to AppFactory::create
255  params.addPrivateParam<std::string>("_type");
256  params.addPrivateParam<int>("_argc");
257  params.addPrivateParam<char **>("_argv");
258  params.addPrivateParam<std::shared_ptr<CommandLine>>("_command_line");
259  params.addPrivateParam<std::shared_ptr<Parallel::Communicator>>("_comm");
260  params.addPrivateParam<unsigned int>("_multiapp_level");
261  params.addPrivateParam<unsigned int>("_multiapp_number");
262  params.addPrivateParam<const MooseMesh *>("_master_mesh");
263  params.addPrivateParam<const MooseMesh *>("_master_displaced_mesh");
264 
265  params.addParam<bool>(
266  "use_legacy_dirichlet_bc",
267  true,
268  "Set false to have MOOSE utilize the new and preferred method of setting preset = true as "
269  "default for all DirichletBC and derived objects, which is ideal for the majority of solves "
270  "utilizing this boundary condition type.\nThe old behavior (which is utilized if this is set "
271  "to true) is to set preset = false as the default for DirichletBC and derived objects.");
272 
273  return params;
274 }
275 
277  : ConsoleStreamInterface(*this),
278  ParallelObject(*parameters.get<std::shared_ptr<Parallel::Communicator>>(
279  "_comm")), // Can't call getParam() before pars is set
280  _name(parameters.get<std::string>("_app_name")),
281  _pars(parameters),
282  _type(getParam<std::string>("_type")),
283  _comm(getParam<std::shared_ptr<Parallel::Communicator>>("_comm")),
284  _perf_graph(type() + " (" + name() + ')'),
285  _rank_map(*_comm, _perf_graph),
286  _file_base_set_by_user(false),
287  _output_position_set(false),
288  _start_time_set(false),
289  _start_time(0.0),
290  _global_time_offset(0.0),
291  _output_warehouse(*this),
292  _input_parameter_warehouse(new InputParameterWarehouse()),
293  _action_factory(*this),
294  _action_warehouse(*this, _syntax, _action_factory),
295  _parser(*this, _action_warehouse),
296  _use_nonlinear(true),
297  _use_eigen_value(false),
298  _enable_unused_check(WARN_UNUSED),
299  _factory(*this),
300  _error_overridden(false),
301  _ready_to_exit(false),
302  _initial_from_file(false),
303  _distributed_mesh_on_command_line(false),
304  _recover(false),
305  _restart(false),
306  _split_mesh(false),
307  _use_split(parameters.get<bool>("use_split")),
308 #ifdef DEBUG
309  _trap_fpe(true),
310 #else
311  _trap_fpe(false),
312 #endif
313  _restart_recover_suffix("cpr"),
314  _half_transient(false),
315  _check_input(getParam<bool>("check_input")),
316  _restartable_data(libMesh::n_threads()),
317  _multiapp_level(
318  isParamValid("_multiapp_level") ? parameters.get<unsigned int>("_multiapp_level") : 0),
319  _multiapp_number(
320  isParamValid("_multiapp_number") ? parameters.get<unsigned int>("_multiapp_number") : 0),
321  _master_mesh(isParamValid("_master_mesh") ? parameters.get<const MooseMesh *>("_master_mesh")
322  : nullptr),
323  _master_displaced_mesh(isParamValid("_master_displaced_mesh")
324  ? parameters.get<const MooseMesh *>("_master_displaced_mesh")
325  : nullptr),
326  _setup_timer(_perf_graph.registerSection("MooseApp::setup", 2)),
327  _setup_options_timer(_perf_graph.registerSection("MooseApp::setupOptions", 5)),
328  _run_input_file_timer(_perf_graph.registerSection("MooseApp::runInputFile", 3)),
329  _execute_timer(_perf_graph.registerSection("MooseApp::execute", 2)),
330  _execute_executioner_timer(_perf_graph.registerSection("MooseApp::executeExecutioner", 3)),
331  _restore_timer(_perf_graph.registerSection("MooseApp::restore", 2)),
332  _run_timer(_perf_graph.registerSection("MooseApp::run", 3)),
333  _execute_mesh_modifiers_timer(_perf_graph.registerSection("MooseApp::executeMeshModifiers", 1)),
334  _execute_mesh_generators_timer(
335  _perf_graph.registerSection("MooseApp::executeMeshGenerators", 1)),
336  _restore_cached_backup_timer(_perf_graph.registerSection("MooseApp::restoreCachedBackup", 2)),
337  _create_minimal_app_timer(_perf_graph.registerSection("MooseApp::createMinimalApp", 3)),
338  _automatic_automatic_scaling(getParam<bool>("automatic_automatic_scaling")),
339  _popped_final_mesh_generator(false)
340 {
341 #ifdef HAVE_GPERFTOOLS
342  if (std::getenv("MOOSE_PROFILE_BASE"))
343  {
344  static std::string profile_file =
345  std::getenv("MOOSE_PROFILE_BASE") + std::to_string(_comm->rank()) + ".prof";
346  _profiling = true;
347  ProfilerStart(profile_file.c_str());
348  }
349 #endif
350 
353 
354  _the_warehouse = libmesh_make_unique<TheWarehouse>();
355  _the_warehouse->registerAttribute<AttribMatrixTags>("matrix_tags", 0);
356  _the_warehouse->registerAttribute<AttribVectorTags>("vector_tags", 0);
357  _the_warehouse->registerAttribute<AttribExecOns>("exec_ons", 0);
358  _the_warehouse->registerAttribute<AttribSubdomains>("subdomains", 0);
359  _the_warehouse->registerAttribute<AttribBoundaries>("boundaries", 0);
360  _the_warehouse->registerAttribute<AttribThread>("thread", 0);
361  _the_warehouse->registerAttribute<AttribPreIC>("pre_ic", 0);
362  _the_warehouse->registerAttribute<AttribPreAux>("pre_aux", 0);
363  _the_warehouse->registerAttribute<AttribName>("name", "dummy");
364  _the_warehouse->registerAttribute<AttribSystem>("system", "dummy");
365  _the_warehouse->registerAttribute<AttribVar>("variable", 0);
366  _the_warehouse->registerAttribute<AttribInterfaces>("interfaces", 0);
367 
368  if (isParamValid("_argc") && isParamValid("_argv"))
369  {
370  int argc = getParam<int>("_argc");
371  char ** argv = getParam<char **>("_argv");
372 
373  _sys_info = libmesh_make_unique<SystemInfo>(argc, argv);
374  }
375  if (isParamValid("_command_line"))
376  _command_line = getParam<std::shared_ptr<CommandLine>>("_command_line");
377  else
378  mooseError("Valid CommandLine object required");
379 
380  if (_check_input && isParamValid("recover"))
381  mooseError("Cannot run --check-input with --recover. Recover files might not exist");
382 
383  if (isParamValid("start_in_debugger") && _multiapp_level == 0)
384  {
385  auto command = getParam<std::string>("start_in_debugger");
386 
387  Moose::out << "Starting in debugger using: " << command << std::endl;
388 
390 
391  std::stringstream command_stream;
392 
393  // This will start XTerm and print out some info first... then run the debugger
394  command_stream << "xterm -e \"echo 'Rank: " << processor_id() << " Hostname: " << hostname
395  << " PID: " << getpid() << "'; echo ''; ";
396 
397  // Figure out how to run the debugger
398  if (command.find("lldb") != std::string::npos || command.find("gdb") != std::string::npos)
399  command_stream << command << " -p " << getpid();
400  else
401  mooseError("Unknown debugger: ",
402  command,
403  "\nIf this is truly what you meant then contact moose-users to have a discussion "
404  "about adding your debugger.");
405 
406  // Finish up the command
407  command_stream << "\""
408  << " & ";
409 
410  std::string command_string = command_stream.str();
411  Moose::out << "Running: " << command_string << std::endl;
412 
413  int ret = std::system(command_string.c_str());
414  libmesh_ignore(ret);
415 
416  // Sleep to allow time for the debugger to attach
417  std::this_thread::sleep_for(std::chrono::seconds(10));
418  }
419 
420  if (!parameters.isParamSetByAddParam("stop_for_debugger"))
421  {
422  Moose::out << "\nStopping for " << getParam<unsigned int>("stop_for_debugger")
423  << " seconds to allow attachment from a debugger.\n";
424 
425  Moose::out << "\nAll of the processes you can connect to:\n";
426  Moose::out << "rank - hostname - pid\n";
427 
429 
430  {
431  // The 'false' turns off the serialization warning
432  SerializerGuard sg(_communicator, false); // Guarantees that the processors print in order
433  Moose::err << processor_id() << " - " << hostname << " - " << getpid() << "\n";
434  }
435 
436  Moose::out << "\nWaiting...\n" << std::endl;
437 
438  // Sleep to allow time for the debugger to attach
439  std::this_thread::sleep_for(std::chrono::seconds(getParam<unsigned int>("stop_for_debugger")));
440  }
441 
442  if (_master_mesh && _multiapp_level == 0)
443  mooseError("Mesh can be passed in only for sub-apps");
444 
446  mooseError("_master_mesh should have been set when _master_displaced_mesh is set");
447 }
448 
449 void
451 {
453 }
454 
456 {
457 #ifdef HAVE_GPERFTOOLS
458  if (_profiling)
459  ProfilerStop();
460 #endif
462  _executioner.reset();
463  _the_warehouse.reset();
464 
466 
467 #ifdef LIBMESH_HAVE_DLOPEN
468  // Close any open dynamic libraries
469  for (const auto & it : _lib_handles)
470  dlclose(it.second);
471 #endif
472 }
473 
474 std::string
476 {
477  return MOOSE_VERSION;
478 }
479 
480 std::string
482 {
483  return MOOSE_VERSION;
484 }
485 
486 std::string
488 {
489  return getPrintableName() + " Version: " + getVersion();
490 }
491 
492 void
494 {
495  TIME_SECTION(_setup_options_timer);
496 
497  // MOOSE was updated to have the ability to register execution flags in similar fashion as
498  // objects. However, this change requires all *App.C/h files to be updated with the new
499  // registerExecFlags method. To avoid breaking all applications the default MOOSE flags
500  // are added if nothing has been added to this point. In the future this could go away or
501  // perhaps be a warning.
502  if (_execute_flags.items().empty())
504 
505  // Print the header, this is as early as possible
506  std::string hdr(header() + "\n");
507  if (multiAppLevel() > 0)
509  Moose::out << hdr << std::flush;
510 
511  if (getParam<bool>("error_unused"))
512  setCheckUnusedFlag(true);
513  else if (getParam<bool>("warn_unused"))
514  setCheckUnusedFlag(false);
515 
516  if (getParam<bool>("error_override"))
518 
519  _distributed_mesh_on_command_line = getParam<bool>("distributed_mesh");
520 
521  _half_transient = getParam<bool>("half_transient");
522 
523  // The no_timing flag takes precedence over the timing flag.
524  if (getParam<bool>("no_timing"))
525  {
526  _pars.set<bool>("timing") = false;
527 
528  _perf_graph.setActive(false);
529  }
530 
531  if (isParamValid("trap_fpe") && isParamValid("no_trap_fpe"))
532  mooseError("Cannot use both \"--trap-fpe\" and \"--no-trap-fpe\" flags.");
533  if (isParamValid("trap_fpe"))
534  _trap_fpe = true;
535  else if (isParamValid("no_trap_fpe"))
536  _trap_fpe = false;
537 
538  // Turn all warnings in MOOSE to errors (almost see next logic block)
539  Moose::_warnings_are_errors = getParam<bool>("error");
540 
541  // Deprecated messages can be toggled to errors independently from everything else.
542  Moose::_deprecated_is_error = getParam<bool>("error_deprecated");
543 
544  if (isUltimateMaster()) // makes sure coloring isn't reset incorrectly in multi-app settings
545  {
546  // Toggle the color console off
547  Moose::setColorConsole(true, true); // set default color condition
548  if (getParam<bool>("no_color"))
549  Moose::setColorConsole(false);
550 
551  char * c_color = std::getenv("MOOSE_COLOR");
552  std::string color = "on";
553  if (c_color)
554  color = c_color;
555  if (getParam<std::string>("color") != "default-on")
556  color = getParam<std::string>("color");
557 
558  if (color == "auto")
560  else if (color == "on")
561  Moose::setColorConsole(true, true);
562  else if (color == "off")
563  Moose::setColorConsole(false);
564  else
565  mooseWarning("ignoring invalid --color arg (want 'auto', 'on', or 'off')");
566  }
567 
568  // this warning goes below --color processing to honor that setting for
569  // the warning. And below settings for warnings/error setup.
570  if (getParam<bool>("no_color"))
571  mooseDeprecated("The --no-color flag is deprecated. Use '--color off' instead.");
572 
573 // If there's no threading model active, but the user asked for
574 // --n-threads > 1 on the command line, throw a mooseError. This is
575 // intended to prevent situations where the user has potentially
576 // built MOOSE incorrectly (neither TBB nor pthreads found) and is
577 // asking for multiple threads, not knowing that there will never be
578 // any threads launched.
579 #if !LIBMESH_USING_THREADS
580  if (libMesh::command_line_value("--n-threads", 1) > 1)
581  mooseError("You specified --n-threads > 1, but there is no threading model active!");
582 #endif
583 
584  // Build a minimal running application, ignoring the input file.
585  if (getParam<bool>("minimal"))
587 
588  else if (getParam<bool>("display_version"))
589  {
590  Moose::perf_log.disable_logging();
591  Moose::out << getPrintableVersion() << std::endl;
592  _ready_to_exit = true;
593  return;
594  }
595  else if (getParam<bool>("help"))
596  {
597  Moose::perf_log.disable_logging();
598 
599  _command_line->printUsage();
600  _ready_to_exit = true;
601  }
602  else if (isParamValid("dump"))
603  {
604  Moose::perf_log.disable_logging();
605 
606  // Get command line argument following --dump on command line
607  std::string following_arg = getParam<std::string>("dump");
608 
609  // The argument following --dump is a parameter search string,
610  // which can be empty.
611  std::string param_search;
612  if (!following_arg.empty() && (following_arg.find('-') != 0))
613  param_search = following_arg;
614 
615  JsonSyntaxTree tree(param_search);
617  JsonInputFileFormatter formatter;
618  Moose::out << "### START DUMP DATA ###\n"
619  << formatter.toString(tree.getRoot()) << "\n### END DUMP DATA ###\n";
620  _ready_to_exit = true;
621  }
622  else if (isParamValid("registry"))
623  {
624  Moose::out << "Label\tType\tName\tClass\tFile\n";
625 
626  auto & objmap = Registry::allObjects();
627  for (auto & entry : objmap)
628  {
629  for (auto & obj : entry.second)
630  {
631  std::string name = obj._name;
632  if (name.empty())
633  name = obj._alias;
634  if (name.empty())
635  name = obj._classname;
636 
637  Moose::out << entry.first << "\tobject\t" << name << "\t" << obj._classname << "\t"
638  << obj._file << "\n";
639  }
640  }
641 
642  auto & actmap = Registry::allActions();
643  for (auto & entry : actmap)
644  {
645  for (auto & act : entry.second)
646  Moose::out << entry.first << "\taction\t" << act._name << "\t" << act._classname << "\t"
647  << act._file << "\n";
648  }
649 
650  _ready_to_exit = true;
651  }
652  else if (isParamValid("registry_hit"))
653  {
654  Moose::out << "### START REGISTRY DATA ###\n";
655 
656  hit::Section root("");
657  auto sec = new hit::Section("registry");
658  root.addChild(sec);
659  auto objsec = new hit::Section("objects");
660  sec->addChild(objsec);
661 
662  auto & objmap = Registry::allObjects();
663  for (auto & entry : objmap)
664  {
665  for (auto & obj : entry.second)
666  {
667  std::string name = obj._name;
668  if (name.empty())
669  name = obj._alias;
670  if (name.empty())
671  name = obj._classname;
672 
673  auto ent = new hit::Section("entry");
674  objsec->addChild(ent);
675  ent->addChild(new hit::Field("label", hit::Field::Kind::String, entry.first));
676  ent->addChild(new hit::Field("type", hit::Field::Kind::String, "object"));
677  ent->addChild(new hit::Field("name", hit::Field::Kind::String, name));
678  ent->addChild(new hit::Field("class", hit::Field::Kind::String, obj._classname));
679  ent->addChild(new hit::Field("file", hit::Field::Kind::String, obj._file));
680  }
681  }
682 
683  auto actsec = new hit::Section("actions");
684  sec->addChild(actsec);
685  auto & actmap = Registry::allActions();
686  for (auto & entry : actmap)
687  {
688  for (auto & act : entry.second)
689  {
690  auto ent = new hit::Section("entry");
691  actsec->addChild(ent);
692  ent->addChild(new hit::Field("label", hit::Field::Kind::String, entry.first));
693  ent->addChild(new hit::Field("type", hit::Field::Kind::String, "action"));
694  ent->addChild(new hit::Field("task", hit::Field::Kind::String, act._name));
695  ent->addChild(new hit::Field("class", hit::Field::Kind::String, act._classname));
696  ent->addChild(new hit::Field("file", hit::Field::Kind::String, act._file));
697  }
698  }
699 
700  Moose::out << root.render();
701 
702  Moose::out << "\n### END REGISTRY DATA ###\n";
703  _ready_to_exit = true;
704  }
705  else if (isParamValid("definition"))
706  {
707  Moose::perf_log.disable_logging();
708  JsonSyntaxTree tree("");
710  SONDefinitionFormatter formatter;
711  Moose::out << formatter.toString(tree.getRoot()) << "\n";
712  _ready_to_exit = true;
713  }
714  else if (isParamValid("yaml"))
715  {
716  Moose::perf_log.disable_logging();
717 
719 
720  // Get command line argument following --yaml on command line
721  std::string yaml_following_arg = getParam<std::string>("yaml");
722 
723  // If the argument following --yaml is non-existent or begins with
724  // a dash, call buildFullTree() with an empty string, otherwise
725  // pass the argument following --yaml.
726  if (yaml_following_arg.empty() || (yaml_following_arg.find('-') == 0))
728  else
729  _parser.buildFullTree(yaml_following_arg);
730 
731  _ready_to_exit = true;
732  }
733  else if (isParamValid("json"))
734  {
735  Moose::perf_log.disable_logging();
736 
737  // Get command line argument following --json on command line
738  std::string json_following_arg = getParam<std::string>("json");
739 
740  // The argument following --json is a parameter search string,
741  // which can be empty.
742  std::string search;
743  if (!json_following_arg.empty() && (json_following_arg.find('-') != 0))
744  search = json_following_arg;
745 
746  JsonSyntaxTree tree(search);
748 
749  Moose::out << "**START JSON DATA**\n" << tree.getRoot() << "\n**END JSON DATA**\n";
750  _ready_to_exit = true;
751  }
752  else if (getParam<bool>("syntax"))
753  {
754  Moose::perf_log.disable_logging();
755 
756  std::multimap<std::string, Syntax::ActionInfo> syntax = _syntax.getAssociatedActions();
757  Moose::out << "**START SYNTAX DATA**\n";
758  for (const auto & it : syntax)
759  Moose::out << it.first << "\n";
760  Moose::out << "**END SYNTAX DATA**\n" << std::endl;
761  _ready_to_exit = true;
762  }
763  else if (getParam<bool>("apptype"))
764  {
765  Moose::perf_log.disable_logging();
766  Moose::out << "MooseApp Type: " << type() << std::endl;
767  _ready_to_exit = true;
768  }
769  else if (_input_filename != "" ||
770  isParamValid("input_file")) // They already specified an input filename
771  {
772  if (_input_filename == "")
773  _input_filename = getParam<std::string>("input_file");
774 
775  if (isParamValid("recover"))
776  {
777  // We need to set the flag manually here since the recover parameter is a string type (takes
778  // an optional filename)
779  _recover = true;
780 
781  // Get command line argument following --recover on command line
782  std::string recover_following_arg = getParam<std::string>("recover");
783 
784  // If the argument following --recover is non-existent or begins with
785  // a dash then we are going to eventually find the newest recovery file to use
786  if (!(recover_following_arg.empty() || (recover_following_arg.find('-') == 0)))
787  _restart_recover_base = recover_following_arg;
788  }
789 
790  // Optionally get command line argument following --recoversuffix
791  // on command line. Currently this argument applies to both
792  // recovery and restart files.
793  if (isParamValid("recoversuffix"))
794  {
795  _restart_recover_suffix = getParam<std::string>("recoversuffix");
796  }
797 
799 
800  if (isParamValid("mesh_only"))
801  {
802  _syntax.registerTaskName("mesh_only", true);
803  _syntax.addDependency("mesh_only", "setup_mesh_complete");
804  _action_warehouse.setFinalTask("mesh_only");
805  }
806  else if (isParamValid("split_mesh"))
807  {
808  _split_mesh = true;
809  _syntax.registerTaskName("split_mesh", true);
810  _syntax.addDependency("split_mesh", "setup_mesh_complete");
811  _action_warehouse.setFinalTask("split_mesh");
812  }
814 
815  // Setup the AppFileBase for use by the Outputs or other systems that need output file info
816  {
817  // Extract the CommonOutputAction
818  const auto & common_actions = _action_warehouse.getActionListByName("common_output");
819  mooseAssert(common_actions.size() == 1, "Should be only one common_output Action");
820 
821  const Action * common = *common_actions.begin();
822 
823  // If file_base is set in CommonOutputAction through parsing input, obtain the file_base
824  if (common->isParamValid("file_base"))
825  {
826  _output_file_base = common->getParamTempl<std::string>("file_base");
827  _file_base_set_by_user = true;
828  }
829  else if (isUltimateMaster())
830  {
831  // if this app is a master, we use the input file name as the default file base
832  std::string base = getInputFileName();
833  size_t pos = base.find_last_of('.');
834  _output_file_base = base.substr(0, pos);
835  // Note: we did not append "_out" in the file base here because we do not want to
836  // have it in betwen the input file name and the object name for Output/*
837  // syntax.
838  }
839  // default file base for multiapps is set by MultiApp
840  }
841  }
842  else /* The catch-all case for bad options or missing options, etc. */
843  {
844  Moose::perf_log.disable_logging();
845 
846  if (_check_input)
847  mooseError("You specified --check-input, but did not provide an input file. Add -i "
848  "<inputfile> to your command line.");
849 
850  _command_line->printUsage();
851  _ready_to_exit = true;
852  }
853 }
854 
855 void
856 MooseApp::setInputFileName(const std::string & input_filename)
857 {
858  _input_filename = input_filename;
859 }
860 
861 std::string
862 MooseApp::getOutputFileBase(bool for_non_moose_build_output) const
863 {
864  if (_file_base_set_by_user || for_non_moose_build_output || _multiapp_level)
865  return _output_file_base;
866  else
867  return _output_file_base + "_out";
868 }
869 
870 void
872 {
873  TIME_SECTION(_run_input_file_timer);
874 
875  // If ready to exit has been set, then just return
876  if (_ready_to_exit)
877  return;
878 
880 
881  if (isParamValid("mesh_only") || isParamValid("split_mesh"))
882  _ready_to_exit = true;
883  else if (getParam<bool>("list_constructed_objects"))
884  {
885  // TODO: ask multiapps for their constructed objects
886  _ready_to_exit = true;
887  std::vector<std::string> obj_list = _factory.getConstructedObjects();
888  Moose::out << "**START OBJECT DATA**\n";
889  for (const auto & name : obj_list)
890  Moose::out << name << "\n";
891  Moose::out << "**END OBJECT DATA**\n" << std::endl;
892  }
893 }
894 
895 void
897 {
898  bool warn = _enable_unused_check == WARN_UNUSED;
899  bool err = _enable_unused_check == ERROR_UNUSED;
900 
901  _parser.errorCheck(*_comm, warn, err);
902 
903  auto apps = _executioner->feProblem().getMultiAppWarehouse().getObjects();
904  for (auto app : apps)
905  for (unsigned int i = 0; i < app->numLocalApps(); i++)
906  app->localApp(i)->errorCheck();
907 }
908 
909 void
911 {
912  TIME_SECTION(_execute_executioner_timer);
913 
914  // If ready to exit has been set, then just return
915  if (_ready_to_exit)
916  return;
917 
918  // run the simulation
919  if (_executioner)
920  {
921 #ifdef LIBMESH_HAVE_PETSC
923 #endif
924 
925  _executioner->init();
926  errorCheck();
927  _executioner->execute();
928  }
929  else
930  mooseError("No executioner was specified (go fix your input file)");
931 }
932 
933 bool
935 {
936  return _recover;
937 }
938 
939 bool
941 {
942  return _restart;
943 }
944 
945 bool
947 {
948  return _split_mesh;
949 }
950 
951 bool
953 {
954  return _use_split;
955 }
956 
957 bool
959 {
960  return !_restart_recover_base.empty();
961 }
962 
963 bool
965 {
966  mooseDeprecated("MooseApp::hasRecoverFileBase is deprecated, use "
967  "MooseApp::hasRestartRecoverFileBase() instead.");
968  return !_restart_recover_base.empty();
969 }
970 
971 void
974 {
976  switch (filter)
977  {
978  case RESTARTABLE_FILTER::RECOVERABLE:
980  break;
981  default:
982  mooseError("Unknown filter");
983  }
984 }
985 
986 std::shared_ptr<Backup>
988 {
989  mooseAssert(_executioner, "Executioner is nullptr");
990  FEProblemBase & fe_problem = _executioner->feProblem();
991 
992  RestartableDataIO rdio(fe_problem);
993  return rdio.createBackup();
994 }
995 
996 void
997 MooseApp::restore(std::shared_ptr<Backup> backup, bool for_restart)
998 {
999  TIME_SECTION(_restore_timer);
1000 
1001  mooseAssert(_executioner, "Executioner is nullptr");
1002  FEProblemBase & fe_problem = _executioner->feProblem();
1003 
1004  RestartableDataIO rdio(fe_problem);
1005  rdio.restoreBackup(backup, for_restart);
1006 }
1007 
1008 void
1009 MooseApp::setCheckUnusedFlag(bool warn_is_error)
1010 {
1017  if (_enable_unused_check != ERROR_UNUSED || warn_is_error)
1018  _enable_unused_check = warn_is_error ? ERROR_UNUSED : WARN_UNUSED;
1019  else
1020  mooseInfo("Ignoring request to turn off or warn about unused parameters.\n");
1021 }
1022 
1023 void
1025 {
1027 }
1028 
1029 void
1031 {
1032  _error_overridden = true;
1033 }
1034 
1035 void
1037 {
1038  TIME_SECTION(_run_timer);
1039 
1040  try
1041  {
1042  TIME_SECTION(_setup_timer);
1043  setupOptions();
1044  runInputFile();
1045  }
1046  catch (std::exception & err)
1047  {
1048  mooseError(err.what());
1049  }
1050 
1051  if (!_check_input)
1052  {
1053  TIME_SECTION(_execute_timer);
1055  }
1056  else
1057  {
1058  errorCheck();
1059  // Output to stderr, so it is easier for peacock to get the result
1060  Moose::err << "Syntax OK" << std::endl;
1061  }
1062 }
1063 
1064 void
1066 {
1067  _output_position_set = true;
1068  _output_position = p;
1070 
1071  if (_executioner.get())
1072  _executioner->parentOutputPositionChanged();
1073 }
1074 
1075 std::list<std::string>
1077 {
1078  // Storage for the directory names
1079  std::list<std::string> checkpoint_dirs;
1080 
1081  // Add the directories added with Outputs/checkpoint=true input syntax
1082  checkpoint_dirs.push_back(getOutputFileBase() + "_cp");
1083 
1084  // Add the directories from any existing checkpoint output objects
1085  const auto & actions = _action_warehouse.getActionListByName("add_output");
1086  for (const auto & action : actions)
1087  {
1088  // Get the parameters from the MooseObjectAction
1089  MooseObjectAction * moose_object_action = dynamic_cast<MooseObjectAction *>(action);
1090  if (!moose_object_action)
1091  continue;
1092 
1093  const InputParameters & params = moose_object_action->getObjectParams();
1094  if (moose_object_action->getParamTempl<std::string>("type") == "Checkpoint")
1095  checkpoint_dirs.push_back(params.get<std::string>("file_base") + "_cp");
1096  }
1097 
1098  return checkpoint_dirs;
1099 }
1100 
1101 std::list<std::string>
1103 {
1104  auto checkpoint_dirs = getCheckpointDirectories();
1105  return MooseUtils::getFilesInDirs(checkpoint_dirs);
1106 }
1107 
1108 void
1110 {
1111  _start_time_set = true;
1112  _start_time = time;
1113 }
1114 
1115 std::string
1116 MooseApp::getFileName(bool stripLeadingPath) const
1117 {
1118  return _parser.getFileName(stripLeadingPath);
1119 }
1120 
1123 {
1124  return _output_warehouse;
1125 }
1126 
1127 std::string
1128 MooseApp::appNameToLibName(const std::string & app_name) const
1129 {
1130  std::string library_name(app_name);
1131 
1132  // Strip off the App part (should always be the last 3 letters of the name)
1133  size_t pos = library_name.find("App");
1134  if (pos != library_name.length() - 3)
1135  mooseError("Invalid application name: ", library_name);
1136  library_name.erase(pos);
1137 
1138  // Now get rid of the camel case, prepend lib, and append the method and suffix
1139  return std::string("lib") + MooseUtils::camelCaseToUnderscore(library_name) + '-' +
1140  QUOTE(METHOD) + ".la";
1141 }
1142 
1143 std::string
1144 MooseApp::libNameToAppName(const std::string & library_name) const
1145 {
1146  std::string app_name(library_name);
1147 
1148  // Strip off the leading "lib" and trailing ".la"
1149  if (pcrecpp::RE("lib(.+?)(?:-\\w+)?\\.la").Replace("\\1", &app_name) == 0)
1150  mooseError("Invalid library name: ", app_name);
1151 
1152  return MooseUtils::underscoreToCamelCase(app_name, true);
1153 }
1154 
1156 MooseApp::registerRestartableData(const std::string & name,
1157  std::unique_ptr<RestartableDataValue> data,
1158  THREAD_ID tid,
1159  bool mesh_meta_data,
1160  bool read_only)
1161 {
1162  // Select the data store for saving this piece of restartable data (mesh or everything else)
1163  auto & data_ref = mesh_meta_data ? _mesh_meta_data_map : _restartable_data[tid];
1164 
1165  auto insert_pair = data_ref.emplace(name, RestartableDataValuePair(std::move(data), !read_only));
1166 
1167  // Does the storage for this data already exist?
1168  if (!insert_pair.second)
1169  {
1170  auto & data = insert_pair.first->second;
1171 
1172  // Are we really declaring or just trying to get a reference to the data?
1173  if (!read_only)
1174  {
1175  if (data.declared)
1176  mooseError("Attempted to declare restartable mesh meta data twice with the same name: ",
1177  name);
1178  else
1179  // The data wasn't previously declared, but now it is!
1180  data.declared = true;
1181  }
1182  }
1183 
1184  return *insert_pair.first->second.value;
1185 }
1186 
1187 void
1188 MooseApp::dynamicAppRegistration(const std::string & app_name,
1189  std::string library_path,
1190  const std::string & library_name)
1191 {
1192 #ifdef LIBMESH_HAVE_DLOPEN
1193  Parameters params;
1194  params.set<std::string>("app_name") = app_name;
1195  params.set<RegistrationType>("reg_type") = APPLICATION;
1196  params.set<std::string>("registration_method") = app_name + "__registerApps";
1197  params.set<std::string>("library_path") = library_path;
1198  params.set<std::string>("library_name") = library_name;
1199 
1200  dynamicRegistration(params);
1201 
1202  // At this point the application should be registered so check it
1203  if (!AppFactory::instance().isRegistered(app_name))
1204  {
1205  std::ostringstream oss;
1206  std::set<std::string> paths = getLoadedLibraryPaths();
1207 
1208  oss << "Unable to locate library for \"" << app_name
1209  << "\".\nWe attempted to locate the library \"" << appNameToLibName(app_name)
1210  << "\" in the following paths:\n\t";
1211  std::copy(paths.begin(), paths.end(), infix_ostream_iterator<std::string>(oss, "\n\t"));
1212  oss << "\n\nMake sure you have compiled the library and either set the \"library_path\" "
1213  "variable "
1214  << "in your input file or exported \"MOOSE_LIBRARY_PATH\".\n"
1215  << "Compiled in debug mode to see the list of libraries checked for dynamic loading "
1216  "methods.";
1217  mooseError(oss.str());
1218  }
1219 #else
1220  mooseError("Dynamic Loading is either not supported or was not detected by libMesh configure.");
1221 #endif
1222 }
1223 
1224 void
1225 MooseApp::dynamicAllRegistration(const std::string & app_name,
1226  Factory * factory,
1227  ActionFactory * action_factory,
1228  Syntax * syntax,
1229  std::string library_path,
1230  const std::string & library_name)
1231 {
1232 #ifdef LIBMESH_HAVE_DLOPEN
1233  Parameters params;
1234  params.set<std::string>("app_name") = app_name;
1235  params.set<RegistrationType>("reg_type") = REGALL;
1236  params.set<std::string>("registration_method") = app_name + "__registerAll";
1237  params.set<std::string>("library_path") = library_path;
1238  params.set<std::string>("library_name") = library_name;
1239 
1240  params.set<Factory *>("factory") = factory;
1241  params.set<Syntax *>("syntax") = syntax;
1242  params.set<ActionFactory *>("action_factory") = action_factory;
1243 
1244  dynamicRegistration(params);
1245 #else
1246  mooseError("Dynamic Loading is either not supported or was not detected by libMesh configure.");
1247 #endif
1248 }
1249 
1250 void
1251 MooseApp::dynamicRegistration(const Parameters & params)
1252 {
1253  std::string library_name;
1254  // was library name provided by the user?
1255  if (params.get<std::string>("library_name").empty())
1256  library_name = appNameToLibName(params.get<std::string>("app_name"));
1257  else
1258  library_name = params.get<std::string>("library_name");
1259 
1260  // Create a vector of paths that we can search inside for libraries
1261  std::vector<std::string> paths;
1262 
1263  std::string library_path = params.get<std::string>("library_path");
1264 
1265  if (library_path != "")
1266  MooseUtils::tokenize(library_path, paths, 1, ":");
1267 
1268  char * moose_lib_path_env = std::getenv("MOOSE_LIBRARY_PATH");
1269  if (moose_lib_path_env)
1270  {
1271  std::string moose_lib_path(moose_lib_path_env);
1272  std::vector<std::string> tmp_paths;
1273 
1274  MooseUtils::tokenize(moose_lib_path, tmp_paths, 1, ":");
1275 
1276  // merge the two vectors together (all possible search paths)
1277  paths.insert(paths.end(), tmp_paths.begin(), tmp_paths.end());
1278  }
1279 
1280  // Attempt to dynamically load the library
1281  for (const auto & path : paths)
1282  if (MooseUtils::checkFileReadable(path + '/' + library_name, false, false))
1283  loadLibraryAndDependencies(path + '/' + library_name, params);
1284  else
1285  mooseWarning("Unable to open library file \"",
1286  path + '/' + library_name,
1287  "\". Double check for spelling errors.");
1288 }
1289 
1290 void
1291 MooseApp::loadLibraryAndDependencies(const std::string & library_filename,
1292  const Parameters & params)
1293 {
1294  std::string line;
1295  std::string dl_lib_filename;
1296 
1297  // This RE looks for absolute path libtool filenames (i.e. begins with a slash and ends with a
1298  // .la)
1299  pcrecpp::RE re_deps("(/\\S*\\.la)");
1300 
1301  std::ifstream handle(library_filename.c_str());
1302  if (handle.is_open())
1303  {
1304  while (std::getline(handle, line))
1305  {
1306  // Look for the system dependent dynamic library filename to open
1307  if (line.find("dlname=") != std::string::npos)
1308  // Magic numbers are computed from length of this string "dlname=' and line minus that
1309  // string plus quotes"
1310  dl_lib_filename = line.substr(8, line.size() - 9);
1311 
1312  if (line.find("dependency_libs=") != std::string::npos)
1313  {
1314  pcrecpp::StringPiece input(line);
1315  pcrecpp::StringPiece depend_library;
1316  while (re_deps.FindAndConsume(&input, &depend_library))
1317  // Recurse here to load dependent libraries in depth-first order
1318  loadLibraryAndDependencies(depend_library.as_string(), params);
1319 
1320  // There's only one line in the .la file containing the dependency libs so break after
1321  // finding it
1322  break;
1323  }
1324  }
1325  handle.close();
1326  }
1327 
1328  std::string registration_method_name = params.get<std::string>("registration_method");
1329  // Time to load the library, First see if we've already loaded this particular dynamic library
1330  if (_lib_handles.find(std::make_pair(library_filename, registration_method_name)) ==
1331  _lib_handles.end() && // make sure we haven't already loaded this library
1332  dl_lib_filename != "") // AND make sure we have a library name (we won't for static linkage)
1333  {
1334  std::pair<std::string, std::string> lib_name_parts =
1335  MooseUtils::splitFileName(library_filename);
1336 
1337  // Assemble the actual filename using the base path of the *.la file and the dl_lib_filename
1338  std::string dl_lib_full_path = lib_name_parts.first + '/' + dl_lib_filename;
1339 
1340  MooseUtils::checkFileReadable(dl_lib_full_path, false, /*throw_on_unreadable=*/true);
1341 
1342 #ifdef LIBMESH_HAVE_DLOPEN
1343  void * handle = dlopen(dl_lib_full_path.c_str(), RTLD_LAZY);
1344 #else
1345  void * handle = nullptr;
1346 #endif
1347 
1348  if (!handle)
1349  mooseError("The library file \"",
1350  dl_lib_full_path,
1351  "\" exists and has proper permissions, but cannot by dynamically loaded.\nThis "
1352  "generally means that the loader was unable to load one or more of the "
1353  "dependencies listed in the supplied library (see otool or ldd).\n");
1354 
1355 // get the pointer to the method in the library. The dlsym()
1356 // function returns a null pointer if the symbol cannot be found,
1357 // we also explicitly set the pointer to NULL if dlsym is not
1358 // available.
1359 #ifdef LIBMESH_HAVE_DLOPEN
1360  void * registration_method = dlsym(handle, registration_method_name.c_str());
1361 #else
1362  void * registration_method = nullptr;
1363 #endif
1364 
1365  if (!registration_method)
1366  {
1367 // We found a dynamic library that doesn't have a dynamic
1368 // registration method in it. This shouldn't be an error, so
1369 // we'll just move on.
1370 #ifdef DEBUG
1371  mooseWarning("Unable to find extern \"C\" method \"",
1372  registration_method_name,
1373  "\" in library: ",
1374  dl_lib_full_path,
1375  ".\n",
1376  "This doesn't necessarily indicate an error condition unless you believe that "
1377  "the method should exist in that library.\n");
1378 #endif
1379 
1380 #ifdef LIBMESH_HAVE_DLOPEN
1381  dlclose(handle);
1382 #endif
1383  }
1384  else // registration_method is valid!
1385  {
1386  // TODO: Look into cleaning this up
1387  switch (params.get<RegistrationType>("reg_type"))
1388  {
1389  case APPLICATION:
1390  {
1391  typedef void (*register_app_t)();
1392  register_app_t * reg_ptr = reinterpret_cast<register_app_t *>(&registration_method);
1393  (*reg_ptr)();
1394  break;
1395  }
1396  case REGALL:
1397  {
1398  typedef void (*register_app_t)(Factory *, ActionFactory *, Syntax *);
1399  register_app_t * reg_ptr = reinterpret_cast<register_app_t *>(&registration_method);
1400  (*reg_ptr)(params.get<Factory *>("factory"),
1401  params.get<ActionFactory *>("action_factory"),
1402  params.get<Syntax *>("syntax"));
1403  break;
1404  }
1405  default:
1406  mooseError("Unhandled RegistrationType");
1407  }
1408 
1409  // Store the handle so we can close it later
1410  _lib_handles.insert(
1411  std::make_pair(std::make_pair(library_filename, registration_method_name), handle));
1412  }
1413  }
1414 }
1415 
1416 std::set<std::string>
1418 {
1419  // Return the paths but not the open file handles
1420  std::set<std::string> paths;
1421  for (const auto & it : _lib_handles)
1422  paths.insert(it.first.first);
1423 
1424  return paths;
1425 }
1426 
1429 {
1431 }
1432 
1433 std::string
1435 {
1436  return std::string("");
1437 }
1438 
1439 void
1440 MooseApp::addMeshModifier(const std::string & modifier_name,
1441  const std::string & name,
1442  InputParameters parameters)
1443 {
1444  std::shared_ptr<MeshModifier> mesh_modifier =
1445  _factory.create<MeshModifier>(modifier_name, name, parameters);
1446 
1447  _mesh_modifiers.insert(std::make_pair(MooseUtils::shortName(name), mesh_modifier));
1448 }
1449 
1450 const MeshModifier &
1451 MooseApp::getMeshModifier(const std::string & name) const
1452 {
1453  return *_mesh_modifiers.find(MooseUtils::shortName(name))->second.get();
1454 }
1455 
1456 std::vector<std::string>
1458 {
1459  std::vector<std::string> names;
1460  for (auto & pair : _mesh_modifiers)
1461  names.push_back(pair.first);
1462  return names;
1463 }
1464 
1465 void
1467 {
1468  if (!_mesh_modifiers.empty())
1469  {
1470  TIME_SECTION(_execute_mesh_modifiers_timer);
1471 
1473 
1474  // Add all of the dependencies into the resolver and sort them
1475  for (const auto & it : _mesh_modifiers)
1476  {
1477  // Make sure an item with no dependencies comes out too!
1478  resolver.addItem(it.second);
1479 
1480  std::vector<std::string> & modifiers = it.second->getDependencies();
1481  for (const auto & depend_name : modifiers)
1482  {
1483  auto depend_it = _mesh_modifiers.find(depend_name);
1484 
1485  if (depend_it == _mesh_modifiers.end())
1486  mooseError("The MeshModifier \"",
1487  depend_name,
1488  "\" was not created, did you make a "
1489  "spelling mistake or forget to include it "
1490  "in your input file?");
1491 
1492  resolver.insertDependency(it.second, depend_it->second);
1493  }
1494  }
1495 
1496  const auto & ordered_modifiers = resolver.getSortedValues();
1497 
1498  if (ordered_modifiers.size())
1499  {
1500  MooseMesh * mesh = _action_warehouse.mesh().get();
1501  MooseMesh * displaced_mesh = _action_warehouse.displacedMesh().get();
1502 
1503  // Run the MeshModifiers in the proper order
1504  for (const auto & modifier : ordered_modifiers)
1505  modifier->modifyMesh(mesh, displaced_mesh);
1506 
1511  mesh->prepared(false);
1512  if (displaced_mesh)
1513  displaced_mesh->prepared(false);
1514  }
1515  }
1516 }
1517 
1518 void
1520 {
1521  _mesh_modifiers.clear();
1522 }
1523 
1524 void
1525 MooseApp::addMeshGenerator(const std::string & generator_name,
1526  const std::string & name,
1527  InputParameters parameters)
1528 {
1529  std::shared_ptr<MeshGenerator> mesh_generator =
1530  _factory.create<MeshGenerator>(generator_name, name, parameters);
1531 
1532  _mesh_generators.insert(std::make_pair(MooseUtils::shortName(name), mesh_generator));
1533 }
1534 
1535 const MeshGenerator &
1536 MooseApp::getMeshGenerator(const std::string & name) const
1537 {
1538  return *_mesh_generators.find(MooseUtils::shortName(name))->second.get();
1539 }
1540 
1541 std::vector<std::string>
1543 {
1544  std::vector<std::string> names;
1545  for (auto & pair : _mesh_generators)
1546  names.push_back(pair.first);
1547  return names;
1548 }
1549 
1550 std::unique_ptr<MeshBase> &
1551 MooseApp::getMeshGeneratorOutput(const std::string & name)
1552 {
1553  auto & outputs = _mesh_generator_outputs[name];
1554 
1555  outputs.push_back(nullptr);
1556 
1557  return outputs.back();
1558 }
1559 
1560 void
1562 {
1563  if (!_mesh_generators.empty())
1564  {
1565  TIME_SECTION(_execute_mesh_generators_timer);
1566 
1568 
1569  // Add all of the dependencies into the resolver and sort them
1570  for (const auto & it : _mesh_generators)
1571  {
1572  // Make sure an item with no dependencies comes out too!
1573  resolver.addItem(it.second);
1574 
1575  std::vector<std::string> & generators = it.second->getDependencies();
1576  for (const auto & depend_name : generators)
1577  {
1578  auto depend_it = _mesh_generators.find(depend_name);
1579 
1580  if (depend_it == _mesh_generators.end())
1581  mooseError("The MeshGenerator \"",
1582  depend_name,
1583  "\" was not created, did you make a "
1584  "spelling mistake or forget to include it "
1585  "in your input file?");
1586 
1587  resolver.insertDependency(it.second, depend_it->second);
1588  }
1589  }
1590 
1591  const auto & ordered_generators = resolver.getSortedValuesSets();
1592 
1593  if (ordered_generators.size())
1594  {
1595  auto & final_generators = ordered_generators.back();
1596 
1597  if (_final_generator_name.empty())
1598  {
1599  // If the _final_generated_mesh wasn't set from MeshGeneratorMesh, set it now
1600  _final_generator_name = final_generators.back()->name();
1601 
1602  // See if we have multiple independent trees of generators
1603  const auto ancestor_list = resolver.getAncestors(final_generators.back());
1604  if (ancestor_list.size() != resolver.size())
1605  {
1606  // Need to remove duplicates and possibly perform a difference so we'll import out list
1607  // into a set for these operations.
1608  std::set<std::shared_ptr<MeshGenerator>> ancestors(ancestor_list.begin(),
1609  ancestor_list.end());
1610  // Get all of the items from the resolver so we can compare against the tree from the
1611  // final generator we just pulled.
1612  const auto & allValues = resolver.getSortedValues();
1613  decltype(ancestors) all(allValues.begin(), allValues.end());
1614 
1615  decltype(ancestors) ind_tree;
1616  std::set_difference(all.begin(),
1617  all.end(),
1618  ancestors.begin(),
1619  ancestors.end(),
1620  std::inserter(ind_tree, ind_tree.end()));
1621 
1622  std::ostringstream oss;
1623  oss << "Your MeshGenerator tree contains multiple possible generator outputs :\n\""
1625  << " and one or more of the following from an independent set: \"";
1626  bool first = true;
1627  for (const auto & gen : ind_tree)
1628  {
1629  if (!first)
1630  oss << ", ";
1631  else
1632  first = false;
1633 
1634  oss << gen->name();
1635  }
1636  oss << "\"\n\nThis may be due to a missing dependency or may be intentional. Please "
1637  "select the final MeshGenerator in\nthe [Mesh] block with the \"final_generator\" "
1638  "parameter or add additional dependencies to remove the ambiguity.";
1639  mooseError(oss.str());
1640  }
1641  }
1642 
1643  // Grab the outputs from the final generator so MeshGeneratorMesh can pick them up
1645 
1646  // Need to grab two if we're going to be making a displaced mesh
1649 
1650  // Run the MeshGenerators in the proper order
1651  for (const auto & generator_set : ordered_generators)
1652  {
1653  for (const auto & generator : generator_set)
1654  {
1655  auto name = generator->name();
1656 
1657  auto current_mesh = generator->generate();
1658 
1659  // Now we need to possibly give this mesh to downstream generators
1660  auto & outputs = _mesh_generator_outputs[name];
1661 
1662  if (outputs.size())
1663  {
1664  auto & first_output = *outputs.begin();
1665 
1666  first_output = std::move(current_mesh);
1667 
1668  const auto & copy_from = *first_output;
1669 
1670  auto output_it = ++outputs.begin();
1671 
1672  // For all of the rest we need to make a copy
1673  for (; output_it != outputs.end(); ++output_it)
1674  (*output_it) = copy_from.clone();
1675  }
1676 
1677  // Once we hit the generator we want, we'll terminate the loops (this might be the last
1678  // iteration anyway)
1679  if (_final_generator_name == name)
1680  return;
1681  }
1682  }
1683  }
1684  }
1685 }
1686 
1687 void
1688 MooseApp::setFinalMeshGeneratorName(const std::string & generator_name)
1689 {
1690  _final_generator_name = generator_name;
1691 }
1692 
1693 void
1695 {
1696  _mesh_generators.clear();
1697 }
1698 
1699 std::unique_ptr<MeshBase>
1701 {
1702  if (_popped_final_mesh_generator == true)
1703  mooseError("MooseApp::getMeshGeneratorMesh is being called for a second time. You cannot do "
1704  "this because the final generated mesh was popped from its storage container the "
1705  "first time this method was called");
1706 
1707  if (_final_generated_meshes.empty())
1708  mooseError("No generated mesh to retrieve. Your input file should contain either a [Mesh] or "
1709  "[MeshGenerators] block.");
1710 
1711  auto mesh_unique_ptr_ptr = _final_generated_meshes.front();
1712  _final_generated_meshes.pop_front();
1714 
1715  if (check_unique && !_final_generated_meshes.empty())
1716  mooseError("Multiple generated meshes exist while retrieving the final Mesh. This means that "
1717  "the selection of the final mesh is non-deterministic.");
1718 
1719  return std::move(*mesh_unique_ptr_ptr);
1720 }
1721 
1722 void
1724 {
1725  _restart = value;
1726 }
1727 
1728 void
1730 {
1731  _recover = value;
1732 }
1733 
1734 void
1735 MooseApp::setBackupObject(std::shared_ptr<Backup> backup)
1736 {
1738 }
1739 
1740 void
1742 {
1743  if (!_cached_backup.get())
1744  mooseError("No cached Backup to restore!");
1745 
1746  TIME_SECTION(_restore_cached_backup_timer);
1747 
1749 
1750  // Release our hold on this Backup
1751  _cached_backup.reset();
1752 }
1753 
1754 void
1756 {
1757  TIME_SECTION(_create_minimal_app_timer);
1758 
1759  // SetupMeshAction
1760  {
1761  // Build the Action parameters
1762  InputParameters action_params = _action_factory.getValidParams("SetupMeshAction");
1763  action_params.set<std::string>("type") = "GeneratedMesh";
1764 
1765  // Create The Action
1766  std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<MooseObjectAction>(
1767  _action_factory.create("SetupMeshAction", "Mesh", action_params));
1768 
1769  // Set the object parameters
1770  InputParameters & params = action->getObjectParams();
1771  params.set<MooseEnum>("dim") = "1";
1772  params.set<unsigned int>("nx") = 1;
1773 
1774  // Add Action to the warehouse
1776  }
1777 
1778  // Executioner
1779  {
1780  // Build the Action parameters
1781  InputParameters action_params = _action_factory.getValidParams("CreateExecutionerAction");
1782  action_params.set<std::string>("type") = "Transient";
1783 
1784  // Create the action
1785  std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<MooseObjectAction>(
1786  _action_factory.create("CreateExecutionerAction", "Executioner", action_params));
1787 
1788  // Set the object parameters
1789  InputParameters & params = action->getObjectParams();
1790  params.set<unsigned int>("num_steps") = 1;
1791  params.set<Real>("dt") = 1;
1792 
1793  // Add Action to the warehouse
1795  }
1796 
1797  // Problem
1798  {
1799  // Build the Action parameters
1800  InputParameters action_params = _action_factory.getValidParams("CreateProblemDefaultAction");
1801  action_params.set<bool>("_solve") = false;
1802 
1803  // Create the action
1804  std::shared_ptr<Action> action = std::static_pointer_cast<Action>(
1805  _action_factory.create("CreateProblemDefaultAction", "Problem", action_params));
1806 
1807  // Add Action to the warehouse
1809  }
1810 
1811  // Outputs
1812  {
1813  // Build the Action parameters
1814  InputParameters action_params = _action_factory.getValidParams("CommonOutputAction");
1815  action_params.set<bool>("console") = false;
1816 
1817  // Create action
1818  std::shared_ptr<Action> action =
1819  _action_factory.create("CommonOutputAction", "Outputs", action_params);
1820 
1821  // Add Action to the warehouse
1823  }
1824 
1826 }
1827 
1828 void
1830 {
1831  if (flag.id() == MooseEnumItem::INVALID_ID)
1832  {
1833  // It is desired that users when creating ExecFlagTypes should not worry about needing
1834  // to assign a name and an ID. However, the ExecFlagTypes created by users are global
1835  // constants and the ID to be assigned can't be known at construction time of this global
1836  // constant, it is only known when it is added to this object (ExecFlagEnum). Therefore,
1837  // this const cast allows the ID to be set after construction. This was the lesser of two
1838  // evils: const_cast or friend class with mutable members.
1839  ExecFlagType & non_const_flag = const_cast<ExecFlagType &>(flag);
1840  auto it = _execute_flags.find(flag.name());
1841  if (it != _execute_flags.items().end())
1842  non_const_flag.setID(it->id());
1843  else
1844  non_const_flag.setID(_execute_flags.getNextValidID());
1845  }
1847 }
1848 
1849 bool
1850 MooseApp::hasRelationshipManager(const std::string & name) const
1851 {
1852  return std::find_if(_relationship_managers.begin(),
1853  _relationship_managers.end(),
1854  [&name](const std::shared_ptr<RelationshipManager> & rm) {
1855  return rm->name() == name;
1856  }) != _relationship_managers.end();
1857 }
1858 
1859 bool
1860 MooseApp::addRelationshipManager(std::shared_ptr<RelationshipManager> relationship_manager)
1861 {
1862  // We don't need Geometric-only RelationshipManagers when we run with
1863  // ReplicatedMesh unless we are splitting the mesh.
1864  if (!_action_warehouse.mesh()->isDistributedMesh() && !_split_mesh &&
1865  (relationship_manager->isType(Moose::RelationshipManagerType::GEOMETRIC) &&
1866  !(relationship_manager->isType(Moose::RelationshipManagerType::ALGEBRAIC) ||
1867  relationship_manager->isType(Moose::RelationshipManagerType::COUPLING))))
1868  return false;
1869 
1870  bool add = true;
1871  for (const auto & rm : _relationship_managers)
1872  {
1873  if (*rm == *relationship_manager)
1874  {
1875  add = false;
1876 
1877  auto & existing_for_whom = rm->forWhom();
1878 
1879  // Since the existing object is going to cover this one
1880  // Pass along who is needing it
1881  for (auto & fw : relationship_manager->forWhom())
1882  {
1883  if (std::find(existing_for_whom.begin(), existing_for_whom.end(), fw) ==
1884  existing_for_whom.end())
1885  rm->addForWhom(fw);
1886  }
1887 
1888  break;
1889  }
1890  }
1891 
1892  if (add)
1893  _relationship_managers.emplace_back(relationship_manager);
1894 
1895  // Inform the caller whether the object was added or not
1896  return add;
1897 }
1898 
1899 void
1901 {
1902  for (auto & rm : _relationship_managers)
1903  {
1904  if (rm->isType(rm_type))
1905  {
1906  // Will attach them later (during algebraic)
1907  if (rm_type == Moose::RelationshipManagerType::GEOMETRIC && !rm->attachGeometricEarly())
1908  continue;
1909 
1911  {
1912  // The problem is not built yet - so the ActionWarehouse currently owns the mesh
1913  auto & mesh = _action_warehouse.mesh();
1914 
1915  rm->init();
1916 
1917  if (rm->useDisplacedMesh() && _action_warehouse.displacedMesh())
1918  _action_warehouse.displacedMesh()->getMesh().add_ghosting_functor(*rm);
1919  else
1920  mesh->getMesh().add_ghosting_functor(*rm);
1921  }
1922 
1924  {
1925  // Now we've built the problem, so we can use it
1926  auto & problem = _executioner->feProblem();
1927 
1928  // Ensure that the relationship manager is initialized
1929  rm->init();
1930 
1931  // If it's also Geometric but didn't get attached early - then let's attach it now
1932  if (rm->isType(Moose::RelationshipManagerType::GEOMETRIC) && !rm->attachGeometricEarly())
1933  {
1934  if (rm->useDisplacedMesh() && _action_warehouse.displacedMesh())
1935  _action_warehouse.displacedMesh()->getMesh().add_ghosting_functor(*rm);
1936  else
1937  problem.mesh().getMesh().add_ghosting_functor(*rm);
1938  }
1939 
1940  if (rm->useDisplacedMesh() && problem.getDisplacedProblem())
1941  {
1943  {
1944  // We actually need to add this to the FEProblemBase NonlinearSystemBase's DofMap
1945  // because the DisplacedProblem "nonlinear" DisplacedSystem doesn't have any matrices
1946  // for which to do coupling
1947  auto & dof_map = problem.getNonlinearSystemBase().dofMap();
1948  dof_map.add_coupling_functor(*rm, /*to_mesh = */ false);
1949  rm->setDofMap(dof_map);
1950  }
1951  // If this rm is algebraic AND coupling, then in the case of the non-linear system there
1952  // is no reason to add it to the DofMap twice. In the case of any other system, it
1953  // actually would be disastrous to add this rm because it's going to set a coupling matrix
1954  // based on the non-linear system. So we don't add this rm at all here if its also
1955  // a coupling functor
1956  else if (rm_type == Moose::RelationshipManagerType::ALGEBRAIC &&
1958  problem.getDisplacedProblem()->addAlgebraicGhostingFunctor(*rm, /*to_mesh = */ false);
1959  }
1960  else // undisplaced
1961  {
1963  {
1964  auto & dof_map = problem.getNonlinearSystemBase().dofMap();
1965  dof_map.add_coupling_functor(*rm, /*to_mesh = */ false);
1966  rm->setDofMap(dof_map);
1967  }
1968  // If this rm is algebraic AND coupling, then in the case of the non-linear system there
1969  // is no reason to add it to the DofMap twice. In the case of any other system, it
1970  // actually would be disastrous to add this rm because it's going to set a coupling matrix
1971  // based on the non-linear system. So we don't add this rm at all here if its also
1972  // a coupling functor
1973  else if (rm_type == Moose::RelationshipManagerType::ALGEBRAIC &&
1975  problem.addAlgebraicGhostingFunctor(*rm, /*to_mesh = */ false);
1976  }
1977  }
1978  }
1979  }
1980 }
1981 
1982 std::vector<std::pair<std::string, std::string>>
1984 {
1985  std::vector<std::pair<std::string, std::string>> info_strings;
1986  info_strings.reserve(_relationship_managers.size());
1987 
1988  for (const auto & rm : _relationship_managers)
1989  {
1990  std::stringstream oss;
1991  oss << rm->getInfo();
1992 
1993  auto & for_whom = rm->forWhom();
1994 
1995  if (!for_whom.empty())
1996  {
1997  oss << " for ";
1998 
1999  std::copy(for_whom.begin(), for_whom.end(), infix_ostream_iterator<std::string>(oss, ", "));
2000  }
2001 
2002  info_strings.emplace_back(std::make_pair(Moose::stringify(rm->getType()), oss.str()));
2003  }
2004 
2005  // List the libMesh GhostingFunctors - Not that in libMesh all of the algebraic and coupling
2006  // Ghosting Functors are also attached to the mesh. This should catch them all.
2007  const auto & mesh = _action_warehouse.getMesh();
2008  if (mesh)
2009  {
2010  std::unordered_map<std::string, unsigned int> counts;
2011 
2012  for (auto & gf : as_range(mesh->getMesh().ghosting_functors_begin(),
2013  mesh->getMesh().ghosting_functors_end()))
2014  {
2015  const auto * gf_ptr = dynamic_cast<const RelationshipManager *>(gf);
2016  if (!gf_ptr)
2017  // Count how many occurances of the same Ghosting Functor types we are encountering
2018  counts[demangle(typeid(*gf).name())]++;
2019  }
2020 
2021  for (const auto pair : counts)
2022  info_strings.emplace_back(std::make_pair(
2023  "Default", pair.first + (pair.second > 1 ? " x " + std::to_string(pair.second) : "")));
2024  }
2025 
2026  return info_strings;
2027 }
2028 
2029 void
2031 {
2032  for (auto & rm : _relationship_managers)
2033  rm->dofmap_reinit();
2034 }
2035 
2036 void
2038 {
2039  for (auto & rm : _relationship_managers)
2040  rm->mesh_reinit();
2041 }
2042 
2043 void
2045 {
2046  std::vector<std::string> not_declared;
2047 
2048  for (const auto & pair : _mesh_meta_data_map)
2049  if (!pair.second.declared)
2050  not_declared.push_back(pair.first);
2051 
2052  if (!not_declared.empty())
2053  {
2054  std::ostringstream oss;
2055  std::copy(
2056  not_declared.begin(), not_declared.end(), infix_ostream_iterator<std::string>(oss, ", "));
2057 
2058  mooseError("The following Mesh meta-data properties were retrieved but never declared: ",
2059  oss.str());
2060  }
2061 }
MooseApp::checkMeshMetaDataIntegrity
void checkMeshMetaDataIntegrity() const
Function to check the integrity of the MeshMetaData data structure.
Definition: MooseApp.C:2044
MooseApp::RegistrationType
RegistrationType
Enumeration for holding the valid types of dynamic registrations allowed.
Definition: MooseApp.h:967
Moose::perf_log
PerfLog perf_log
Perflog to be used by applications.
RestartableDataIO::restoreBackup
void restoreBackup(std::shared_ptr< Backup > backup, bool for_restart=false)
Restore a Backup for the current system.
Definition: RestartableDataIO.C:345
MooseApp::getInputParameterWarehouse
InputParameterWarehouse & getInputParameterWarehouse()
Get the InputParameterWarehouse for MooseObjects.
Definition: MooseApp.C:1428
MooseApp::executeMeshModifiers
void executeMeshModifiers()
Execute and clear the Mesh Modifiers data structure.
Definition: MooseApp.C:1466
ConsoleStreamInterface
An inteface for the _console for outputting to the Console object.
Definition: ConsoleStreamInterface.h:21
MooseApp::_mesh_meta_data_map
RestartableDataMap _mesh_meta_data_map
Data specifically associated with the mesh (meta-data) that will read from the restart file early dur...
Definition: MooseApp.h:958
Moose::RESTARTABLE_FILTER
RESTARTABLE_FILTER
The filter type applied to a particular piece of "restartable" data.
Definition: MooseTypes.h:673
ExecFlagEnum::items
const std::set< ExecFlagType > & items() const
Reference the all the available items.
Definition: ExecFlagEnum.h:74
MooseMesh::prepared
bool prepared() const
Setter/getter for the _is_prepared flag.
Definition: MooseMesh.C:2313
Syntax::registerTaskName
void registerTaskName(const std::string &task, bool should_auto_build=false)
Method to register a new task.
Definition: Syntax.C:20
MooseApp::hasRecoverFileBase
bool hasRecoverFileBase() const
Definition: MooseApp.C:964
AttribName
Definition: Attributes.h:182
MooseUtils::getFilesInDirs
std::list< std::string > getFilesInDirs(const std::list< std::string > &directory_list)
Retrieves the names of all of the files contained within the list of directories passed into the rout...
Definition: MooseUtils.C:503
MooseApp::_final_generated_meshes
std::list< std::unique_ptr< MeshBase > * > _final_generated_meshes
The final Mesh that is generated by the generators.
Definition: MooseApp.h:1001
MooseApp::_perf_graph
PerfGraph _perf_graph
The PerfGraph object for this applciation.
Definition: MooseApp.h:805
Factory::create
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>())
Definition: Factory.C:93
defineLegacyParams
defineLegacyParams(MooseApp)
MooseApp::type
const std::string & type() const
Get the type of this object as a string.
Definition: MooseApp.h:97
DependencyResolver::insertDependency
void insertDependency(const T &key, const T &value)
Insert a dependency pair - the first value or the "key" depends on the second value or the "value".
Definition: DependencyResolver.h:223
type
MatType type
Definition: PetscDMMoose.C:1477
THREAD_ID
unsigned int THREAD_ID
Definition: MooseTypes.h:196
MooseApp::_parser
Parser _parser
Parser for parsing the input file.
Definition: MooseApp.h:853
NonlinearSystemBase.h
MooseApp::_split_mesh
bool _split_mesh
Whether or not we are performing a split mesh operation (–split-mesh)
Definition: MooseApp.h:894
MooseApp::run
virtual void run()
Run the application.
Definition: MooseApp.C:1036
SONDefinitionFormatter.h
MooseApp::setErrorOverridden
void setErrorOverridden()
Set a flag so that the parser will throw an error if overridden parameters are detected.
Definition: MooseApp.C:1030
MooseMesh.h
MooseApp::APPLICATION
Definition: MooseApp.h:969
MooseApp::_type
const std::string _type
The string representation of the type of this object as registered (see registerApp(AppName))
Definition: MooseApp.h:799
MooseApp::getOutputWarehouse
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
Definition: MooseApp.C:1122
MooseApp::executeExecutioner
virtual void executeExecutioner()
Execute the Executioner that was built.
Definition: MooseApp.C:910
MeshGenerator.h
MooseApp::setStartTime
void setStartTime(Real time)
Set the starting time for the simulation.
Definition: MooseApp.C:1109
AuxiliarySystem.h
ActionFactory::getValidParams
InputParameters getValidParams(const std::string &name)
Definition: ActionFactory.C:70
MooseApp::restore
virtual void restore(std::shared_ptr< Backup > backup, bool for_restart=false)
Restore a Backup.
Definition: MooseApp.C:997
MooseApp::_restart
bool _restart
Whether or not this is a restart run.
Definition: MooseApp.h:891
MooseApp::setFinalMeshGeneratorName
void setFinalMeshGeneratorName(const std::string &generator_name)
Set final mesh generator name.
Definition: MooseApp.C:1688
Moose::RelationshipManagerType::GEOMETRIC
RestartableDataIO.h
MooseApp::_ready_to_exit
bool _ready_to_exit
Definition: MooseApp.h:879
MooseApp::_comm
const std::shared_ptr< Parallel::Communicator > _comm
The MPI communicator this App is going to use.
Definition: MooseApp.h:802
MooseEnumBase::getNextValidID
int getNextValidID() const
Compute the next valid ID.
Definition: MooseEnumBase.C:102
Parser::YAML
Definition: Parser.h:103
MooseEnumItem::id
const int & id() const
Return the numeric, name, or raw name.
Definition: MooseEnumItem.h:36
MooseApp::runInputFile
virtual void runInputFile()
Actually build everything in the input file.
Definition: MooseApp.C:871
PerfGraphInterface.h
DependencyResolver::getSortedValues
const std::vector< T > & getSortedValues()
This function also returns dependency resolved values but with a simpler single vector interface.
Definition: DependencyResolver.h:459
FileOutput.h
ExecFlagEnum::addAvailableFlags
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Definition: ExecFlagEnum.h:85
MooseApp::dynamicAllRegistration
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.
Definition: MooseApp.C:1225
MooseApp::_start_time
Real _start_time
The time at which to start the simulation.
Definition: MooseApp.h:829
MooseApp::getCheckpointDirectories
std::list< std::string > getCheckpointDirectories() const
Get all checkpoint directories.
Definition: MooseApp.C:1076
MooseApp::meshReinitForRMs
void meshReinitForRMs()
Loop through RMs and call mesh_reinit.
Definition: MooseApp.C:2037
Registry::checkLabels
static void checkLabels(const std::set< std::string > &known_labels={})
This runs error checking to make sure that all objects and actions in the registry have valid labels.
Definition: Registry.C:137
ActionWarehouse::mesh
std::shared_ptr< MooseMesh > & mesh()
Definition: ActionWarehouse.h:213
MooseApp::restoreCachedBackup
void restoreCachedBackup()
Restore from a cached backup.
Definition: MooseApp.C:1741
MooseApp::setBackupObject
void setBackupObject(std::shared_ptr< Backup > backup)
Method for setting the backup object to be restored at a later time.
Definition: MooseApp.C:1735
libMesh
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Definition: AddPeriodicBCAction.h:16
Moose::setColorConsole
bool setColorConsole(bool use_color, bool force=false)
Turns color escape sequences on/off for info written to stdout.
Definition: Moose.C:563
MooseApp::loadLibraryAndDependencies
void loadLibraryAndDependencies(const std::string &library_filename, const Parameters &params)
Recursively loads libraries and dependencies in the proper order to fully register a MOOSE applicatio...
Definition: MooseApp.C:1291
MeshGenerator
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:32
MooseApp::_error_overridden
bool _error_overridden
Indicates whether warnings or errors are displayed when overridden parameters are detected.
Definition: MooseApp.h:878
MooseEnum
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
AttribBoundaries
Definition: Attributes.h:119
MooseApp::_mesh_generator_outputs
std::map< std::string, std::list< std::unique_ptr< MeshBase > > > _mesh_generator_outputs
Holds the output for each mesh generator - including duplicates needed downstream.
Definition: MooseApp.h:995
ActionWarehouse::build
void build()
Builds all auto-buildable tasks.
Definition: ActionWarehouse.C:47
emptyInputParameters
InputParameters emptyInputParameters()
Definition: InputParameters.C:24
JsonInputFileFormatter
This class produces produces a dump of the InputFileParameters that appears like the normal input fil...
Definition: JsonInputFileFormatter.h:19
MooseApp::_execute_mesh_generators_timer
const PerfID _execute_mesh_generators_timer
Definition: MooseApp.h:1018
MooseApp::_mesh_modifiers
std::map< std::string, std::shared_ptr< MeshModifier > > _mesh_modifiers
Holds the mesh modifiers until they have completed, then this structure is cleared.
Definition: MooseApp.h:989
MooseApp::clearMeshGenerators
void clearMeshGenerators()
Clear all mesh modifers.
Definition: MooseApp.C:1694
MooseApp::~MooseApp
virtual ~MooseApp()
Definition: MooseApp.C:455
MooseApp::getPrintableName
virtual std::string getPrintableName() const
Get printable name of the application.
Definition: MooseApp.h:84
MooseApp::_master_displaced_mesh
const MooseMesh * _master_displaced_mesh
The displaced mesh from master app.
Definition: MooseApp.h:986
MooseUtils::hostname
std::string hostname()
Get the hostname the current process is running on.
Definition: MooseUtils.C:387
AttribPreAux
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies.
Definition: Attributes.h:168
MooseApp::_restore_cached_backup_timer
const PerfID _restore_cached_backup_timer
Definition: MooseApp.h:1019
MooseApp::checkRegistryLabels
virtual void checkRegistryLabels()
Definition: MooseApp.C:450
MooseApp::clearMeshModifiers
void clearMeshModifiers()
Clear all mesh modifers.
Definition: MooseApp.C:1519
InputParameters::addParam
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object.
Definition: InputParameters.h:1198
MooseApp::getMeshGeneratorMesh
std::unique_ptr< MeshBase > getMeshGeneratorMesh(bool check_unique=true)
Get the generated mesh generated by executeMeshGenerators();.
Definition: MooseApp.C:1700
Parser::buildFullTree
void buildFullTree(const std::string &search_string)
Use MOOSE Factories to construct a full parse tree for documentation or echoing input.
Definition: Parser.C:776
MooseApp::_command_line
std::shared_ptr< CommandLine > _command_line
Command line object.
Definition: MooseApp.h:835
ActionWarehouse::addActionBlock
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse.
Definition: ActionWarehouse.C:73
Moose::registerExecFlags
void registerExecFlags(Factory &factory)
Definition: Moose.C:362
MooseApp::getFrameworkVersion
std::string getFrameworkVersion() const
Returns the framework version.
Definition: MooseApp.C:475
MooseApp::_start_time_set
bool _start_time_set
Whether or not an start time has been set.
Definition: MooseApp.h:826
Parser::getFileName
std::string getFileName(bool stripLeadingPath=true) const
Return the filename that was parsed.
Definition: Parser.C:290
MooseApp::getLoadedLibraryPaths
std::set< std::string > getLoadedLibraryPaths() const
Return the loaded library filenames in a std::set.
Definition: MooseApp.C:1417
MooseApp::_executioner
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:856
MooseUtils::underscoreToCamelCase
std::string underscoreToCamelCase(const std::string &underscore_name, bool leading_upper_case)
Function for converting an underscore name to a camel case name.
Definition: MooseUtils.C:343
CommandLine.h
MooseApp::_multiapp_level
unsigned int _multiapp_level
Level of multiapp, the master is level 0. This used by the Console to indent output.
Definition: MooseApp.h:977
MooseApp::isParamValid
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:123
MooseApp::_execute_mesh_modifiers_timer
const PerfID _execute_mesh_modifiers_timer
Definition: MooseApp.h:1017
ActionWarehouse::clear
void clear()
This method deletes all of the Actions in the warehouse.
Definition: ActionWarehouse.C:55
MooseApp::dynamicRegistration
void dynamicRegistration(const Parameters &params)
Helper method for dynamic loading of objects.
Definition: MooseApp.C:1251
MooseApp::getInputFileName
std::string getInputFileName() const
Returns the input file name that was set with setInputFileName.
Definition: MooseApp.h:173
MooseApp::_run_timer
const PerfID _run_timer
Definition: MooseApp.h:1016
Syntax::getAssociatedActions
const std::multimap< std::string, ActionInfo > & getAssociatedActions() const
Return all Syntax to Action associations.
Definition: Syntax.C:310
MooseApp::_distributed_mesh_on_command_line
bool _distributed_mesh_on_command_line
This variable indicates that DistributedMesh should be used for the libMesh mesh underlying MooseMesh...
Definition: MooseApp.h:885
MooseApp::isUseSplit
bool isUseSplit() const
Whether or not we are running with pre-split (distributed mesh)
Definition: MooseApp.C:952
MooseApp::_name
const std::string _name
The name of this object.
Definition: MooseApp.h:793
MooseApp::_action_factory
ActionFactory _action_factory
The Factory responsible for building Actions.
Definition: MooseApp.h:847
Action
Base class for actions.
Definition: Action.h:39
MooseApp::errorCheck
void errorCheck()
Runs post-initialization error checking that cannot be run correctly unless the simulation has been f...
Definition: MooseApp.C:896
MooseRevision.h
ConsoleUtils.h
Registry::allObjects
static const std::map< std::string, std::vector< RegistryEntry > > & allObjects()
Returns a per-label keyed map of all MooseObjects in the registry.
Definition: Registry.C:28
Moose::_trap_fpe
bool _trap_fpe
Variable indicating whether we will enable FPE trapping for this run.
MooseApp::_execute_flags
ExecFlagEnum _execute_flags
Execution flags for this App.
Definition: MooseApp.h:1007
MooseApp::_sys_info
std::unique_ptr< SystemInfo > _sys_info
System Information.
Definition: MooseApp.h:865
MooseApp::getMeshGeneratorNames
std::vector< std::string > getMeshGeneratorNames() const
Get names of all mesh generators Note: This function should be called after all mesh generators are a...
Definition: MooseApp.C:1542
MooseApp::processor_id
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor.
Definition: MooseApp.h:312
MooseApp::getMeshModifier
const MeshModifier & getMeshModifier(const std::string &name) const
Get a mesh modifier with its name.
Definition: MooseApp.C:1451
MooseApp::syntax
Syntax & syntax()
Returns a writable reference to the syntax object.
Definition: MooseApp.h:163
Action::getParamTempl
const T & getParamTempl(const std::string &name) const
Retrieve a parameter for the object.
Definition: Action.h:254
Moose::RelationshipManagerType::ALGEBRAIC
MooseApp::addMeshModifier
void addMeshModifier(const std::string &modifier_name, const std::string &name, InputParameters parameters)
Add a mesh modifier that will act on the meshes in the system.
Definition: MooseApp.C:1440
MooseApp::setRecover
void setRecover(bool value)
Definition: MooseApp.C:1729
Executioner.h
AttribThread
Definition: Attributes.h:138
MooseApp::getVersion
virtual std::string getVersion() const
Returns the current version of the framework or application (default: framework version).
Definition: MooseApp.C:481
Moose::PetscSupport::petscSetupOutput
PetscErrorCode petscSetupOutput(CommandLine *cmd_line)
Definition: PetscSupport.C:297
Moose::stringify
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:61
DependencyResolver::addItem
void addItem(const T &value)
Add an independent item to the set.
Definition: DependencyResolver.h:292
ActionWarehouse::getActionListByName
const std::list< Action * > & getActionListByName(const std::string &task) const
Retrieve a constant list of Action pointers associated with the passed in task.
Definition: ActionWarehouse.C:188
mooseInfo
void mooseInfo(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
Definition: MooseError.h:255
MooseApp::_restore_timer
const PerfID _restore_timer
Definition: MooseApp.h:1015
AttribExecOns
Definition: Attributes.h:85
MooseApp::_input_filename
std::string _input_filename
Input file name used.
Definition: MooseApp.h:811
mooseError
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition: MooseError.h:210
SONDefinitionFormatter
This class produces a dump of the InputFileParameters in the Standard Object Notation (SON) format fo...
Definition: SONDefinitionFormatter.h:23
RestartableDataValue
Abstract definition of a RestartableData value.
Definition: RestartableData.h:26
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
MooseUtils::tokenize
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 ...
Definition: MooseUtils.h:535
AttribVectorTags
Definition: Attributes.h:76
MooseApp::isUltimateMaster
bool isUltimateMaster()
Whether or not this app is the ultimate master app.
Definition: MooseApp.h:561
InputParameters::set
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Definition: InputParameters.h:987
MooseApp::_factory
Factory _factory
Definition: MooseApp.h:875
MooseApp::dofMapReinitForRMs
void dofMapReinitForRMs()
Loop through RMs and call dofmap_reinit.
Definition: MooseApp.C:2030
mooseWarning
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:222
MooseApp::_use_split
const bool _use_split
Whether or not we are using a (pre-)split mesh (automatically DistributedMesh)
Definition: MooseApp.h:897
Moose::_deprecated_is_error
bool _deprecated_is_error
Variable to toggle only deprecated warnings as errors.
Definition: Moose.C:570
InputParameters::addCommandLineParam
void addCommandLineParam(const std::string &name, const std::string &syntax, const std::string &doc_string)
Definition: InputParameters.h:1330
Registry::addKnownLabel
static char addKnownLabel(const std::string &label)
addKnownLabel whitelists a label as valid for purposes of the checkLabels function.
Definition: Registry.C:160
JsonSyntaxTree::getRoot
const moosecontrib::Json::Value & getRoot() const
Get the root of the tree.
Definition: JsonSyntaxTree.h:63
OutputWarehouse
Class for storing and utilizing output objects.
Definition: OutputWarehouse.h:22
MooseApp::_create_minimal_app_timer
const PerfID _create_minimal_app_timer
Definition: MooseApp.h:1020
MooseApp::ERROR_UNUSED
Definition: MooseApp.h:872
Factory::getConstructedObjects
std::vector< std::string > getConstructedObjects() const
Get a list of all constructed Moose Object types.
Definition: Factory.C:283
MooseApp::OFF
Definition: MooseApp.h:870
MooseEnumItem::setID
void setID(const int &id)
Method to change the ID of the item, but only if it is an INVALID_ID.
Definition: MooseEnumItem.C:81
MooseApp::_pars
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:796
RestartableDataIO
Class for doing restart.
Definition: RestartableDataIO.h:31
MeshModifier.h
MooseApp::hasRelationshipManager
bool hasRelationshipManager(const std::string &name) const
Returns a Boolean indicating whether a RelationshipManater exists with the same name.
Definition: MooseApp.C:1850
ActionFactory::create
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters &parameters)
Definition: ActionFactory.C:41
DependencyResolver.h
MooseApp::MooseApp
MooseApp(InputParameters parameters)
Constructor is protected so that this object is constructed through the AppFactory object.
Definition: MooseApp.C:276
MooseApp::_master_mesh
const MooseMesh * _master_mesh
The mesh from master app.
Definition: MooseApp.h:983
ActionWarehouse::setFinalTask
void setFinalTask(const std::string &task)
Definition: ActionWarehouse.C:39
MooseApp::_final_generator_name
std::string _final_generator_name
The final mesh generator name to use.
Definition: MooseApp.h:998
AttribInterfaces
Definition: Attributes.h:226
DependencyResolver::size
std::size_t size() const
Returns the number of unique items stored in the dependency resolver.
Definition: DependencyResolver.h:531
MooseApp.h
RestartableDataValuePair
Struct and Aliases for Restartable/Recoverable structures.
Definition: RestartableData.h:159
MooseUtils::shortName
std::string shortName(const std::string &name)
Function for stripping name after the file / in parser block.
Definition: MooseUtils.C:375
JsonSyntaxTree.h
MooseApp::_popped_final_mesh_generator
bool _popped_final_mesh_generator
Whether the mesh generator MeshBase has been popped off its storage container and is no longer access...
Definition: MooseApp.h:1027
MooseApp::setOutputPosition
void setOutputPosition(const Point &p)
Tell the app to output in a specific position.
Definition: MooseApp.C:1065
Moose::RelationshipManagerType
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:852
DependencyResolver::getSortedValuesSets
const std::vector< std::vector< T > > & getSortedValuesSets()
Returns a vector of sets that represent dependency resolved values.
Definition: DependencyResolver.h:314
MooseApp::multiAppLevel
unsigned int multiAppLevel() const
The MultiApp Level.
Definition: MooseApp.h:550
MooseApp::WARN_UNUSED
Definition: MooseApp.h:871
MooseApp::_the_warehouse
std::unique_ptr< TheWarehouse > _the_warehouse
The combined warehouse for storing any MooseObject based object.
Definition: MooseApp.h:974
MooseApp::_restart_recover_suffix
std::string _restart_recover_suffix
The file suffix to restart/recover from. If blank then we will use the binary restart suffix.
Definition: MooseApp.h:906
AppFactory.h
Moose::_warnings_are_errors
bool _warnings_are_errors
Variable to toggle any warning into an error (includes deprecated code warnings)
Definition: Moose.C:569
MooseApp::libNameToAppName
std::string libNameToAppName(const std::string &library_name) const
Converts a library name to an application name:
Definition: MooseApp.C:1144
MooseApp::getMeshGenerator
const MeshGenerator & getMeshGenerator(const std::string &name) const
Get a mesh generator with its name.
Definition: MooseApp.C:1536
MooseInit.h
MooseApp::appNameToLibName
std::string appNameToLibName(const std::string &app_name) const
Converts an application name to a library name: Examples: AnimalApp -> libanimal-oprof....
Definition: MooseApp.C:1128
MooseApp::name
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:77
AttribMatrixTags
Definition: Attributes.h:68
ActionWarehouse::getMesh
const std::shared_ptr< MooseMesh > & getMesh() const
Definition: ActionWarehouse.h:214
MooseEnumBase::find
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.
Definition: MooseEnumBase.C:190
MooseApp::getPrintableVersion
std::string getPrintableVersion() const
Non-virtual method for printing out the version string in a consistent format.
Definition: MooseApp.C:487
mooseDeprecated
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:239
MooseApp::_half_transient
bool _half_transient
Whether or not this simulation should only run half its transient (useful for testing recovery)
Definition: MooseApp.h:909
MooseApp::registerRestartableData
RestartableDataValue & registerRestartableData(const std::string &name, std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool mesh_meta_data, bool read_only)
Definition: MooseApp.C:1156
MooseEnumItem
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:21
MooseApp::_execute_executioner_timer
const PerfID _execute_executioner_timer
Definition: MooseApp.h:1014
MooseApp::getMeshModifierNames
std::vector< std::string > getMeshModifierNames() const
Get names of all mesh modifiers Note: This function should be called after all mesh modifiers are add...
Definition: MooseApp.C:1457
MooseApp::hasRestartRecoverFileBase
bool hasRestartRecoverFileBase() const
Return true if the recovery file base is set.
Definition: MooseApp.C:958
Factory
Generic factory class for build all sorts of objects.
Definition: Factory.h:153
MooseApp::getRelationshipManagerInfo
std::vector< std::pair< std::string, std::string > > getRelationshipManagerInfo() const
Returns the Relationship managers info suitable for printing.
Definition: MooseApp.C:1983
ActionFactory
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:64
MooseApp::getCheckpointFiles
std::list< std::string > getCheckpointFiles() const
Extract all possible checkpoint file names.
Definition: MooseApp.C:1102
MooseApp::_restart_recover_base
std::string _restart_recover_base
The base name to restart/recover from. If blank then we will find the newest checkpoint file.
Definition: MooseApp.h:903
MooseApp::_run_input_file_timer
const PerfID _run_input_file_timer
Definition: MooseApp.h:1012
MultiApp.h
MooseApp::_output_file_base
std::string _output_file_base
The output file basename.
Definition: MooseApp.h:814
MooseObjectAction.h
Syntax
Holding syntax for parsing input files.
Definition: Syntax.h:20
MooseApp::_profiling
bool _profiling
Definition: MooseApp.h:1029
MooseApp::_syntax
Syntax _syntax
Syntax of the input file.
Definition: MooseApp.h:838
PerfGraph::setActive
void setActive(bool active)
Turn on or off timing.
Definition: PerfGraph.h:107
JsonInputFileFormatter.h
MooseApp::_setup_options_timer
const PerfID _setup_options_timer
Definition: MooseApp.h:1011
InputParameterWarehouse.h
MooseApp::isRecovering
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition: MooseApp.C:934
MooseObjectAction::getObjectParams
InputParameters & getObjectParams()
Retreive the parameters of the object to be created by this action.
Definition: MooseObjectAction.h:34
Parser::initSyntaxFormatter
void initSyntaxFormatter(SyntaxFormatterType type, bool dump_mode)
Creates a syntax formatter for printing.
Definition: Parser.C:638
MooseApp::_recoverable_data_names
DataNames _recoverable_data_names
Data names that will only be read from the restart file during RECOVERY.
Definition: MooseApp.h:964
MooseUtils::camelCaseToUnderscore
std::string camelCaseToUnderscore(const std::string &camel_case_name)
Function for converting a camel case name to a name containing underscores.
Definition: MooseUtils.C:331
OutputWarehouse::meshChanged
void meshChanged()
Calls the meshChanged method for every output object.
Definition: OutputWarehouse.C:169
RelationshipManager.h
Conversion.h
InputParameters::isParamSetByAddParam
bool isParamSetByAddParam(const std::string &name) const
Returns whether or not the parameter was set due to addParam.
Definition: InputParameters.C:270
SerializerGuard.h
Registry.h
AttribPreIC
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies.
Definition: Attributes.h:153
MooseApp::getFileName
std::string getFileName(bool stripLeadingPath=true) const
Return the filename that was parsed Note: When stripLeadingPath is false, this function returns the s...
Definition: MooseApp.C:1116
SONDefinitionFormatter::toString
std::string toString(const JsonVal &root)
returns a string representation of the tree in input file format
Definition: SONDefinitionFormatter.C:23
Attributes.h
MooseUtils::splitFileName
std::pair< std::string, std::string > splitFileName(std::string full_file)
Function for splitting path and filename.
Definition: MooseUtils.C:301
Moose::registerAll
void registerAll(Factory &f, ActionFactory &af, Syntax &s)
Register objects that are in MOOSE.
Definition: Moose.C:53
MooseApp::REGALL
Definition: MooseApp.h:970
MooseApp::_relationship_managers
std::vector< std::shared_ptr< RelationshipManager > > _relationship_managers
Definition: MooseApp.h:917
DisplacedProblem.h
std
Definition: TheWarehouse.h:80
InputParameterWarehouse
Storage container for all InputParamter objects.
Definition: InputParameterWarehouse.h:32
MooseApp::backup
virtual std::shared_ptr< Backup > backup()
Create a Backup from the current App.
Definition: MooseApp.C:987
AppFactory::instance
static AppFactory & instance()
Get the instance of the AppFactory.
Definition: AppFactory.C:17
MooseApp::addRelationshipManager
bool addRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Transfers ownership of a RelationshipManager to the application for lifetime management.
Definition: MooseApp.C:1860
MooseUtils::checkFileReadable
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true)
Checks to see if a file is readable (exists and permissions)
Definition: MooseUtils.C:158
MooseSyntax.h
AttribSystem
Definition: Attributes.h:196
JsonSyntaxTree
Holds the syntax in a Json::Value tree.
Definition: JsonSyntaxTree.h:22
MooseMesh
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
MooseApp::header
virtual std::string header() const
Returns a string to be printed at the beginning of a simulation.
Definition: MooseApp.C:1434
MooseApp
Base class for MOOSE-based applications.
Definition: MooseApp.h:61
MooseApp::_action_warehouse
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:850
system
nl system()
Definition: PetscDMMoose.C:1287
MooseEnumItem::name
const std::string & name() const
Definition: MooseEnumItem.h:37
MooseApp::_execute_timer
const PerfID _execute_timer
Definition: MooseApp.h:1013
MooseApp::isSplitMesh
bool isSplitMesh() const
Whether or not this is a split mesh operation.
Definition: MooseApp.C:946
JsonInputFileFormatter::toString
std::string toString(const moosecontrib::Json::Value &root)
Returns a string representation of the tree in input file format.
Definition: JsonInputFileFormatter.C:18
MooseApp::setInputFileName
void setInputFileName(const std::string &input_file_name)
Set the input file name.
Definition: MooseApp.C:856
DependencyResolver
Definition: DependencyResolver.h:55
Parser::parse
void parse(const std::string &input_filename)
Parse an input file consisting of hit syntax and setup objects in the MOOSE derived application.
Definition: Parser.C:482
MooseApp::registerRestartableNameWithFilter
void registerRestartableNameWithFilter(const std::string &name, Moose::RESTARTABLE_FILTER filter)
NOTE: This is an internal function meant for MOOSE use only!
Definition: MooseApp.C:972
DependencyResolver::getAncestors
const std::list< T > getAncestors(const T &key)
Returns a list of all values that a given key depends on.
Definition: DependencyResolver.h:503
MooseApp::validParams
static InputParameters validParams()
Definition: MooseApp.C:76
MooseApp::setCheckUnusedFlag
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 ...
Definition: MooseApp.C:1009
AttribSubdomains
Definition: Attributes.h:102
InfixIterator.h
MooseApp::getMeshGeneratorOutput
std::unique_ptr< MeshBase > & getMeshGeneratorOutput(const std::string &name)
Get a refernce to a pointer that will be the output of the MeshGenerator named name.
Definition: MooseApp.C:1551
if
if(nl->nonlinearSolver() ->matvec &&nl->nonlinearSolver() ->residual_and_jacobian_object)
Definition: PetscDMMoose.C:1309
MooseObjectAction
Definition: MooseObjectAction.h:21
AttribVar
Definition: Attributes.h:212
MooseEnumItem::INVALID_ID
static const int INVALID_ID
Definition: MooseEnumItem.h:24
MooseApp::addExecFlag
void addExecFlag(const ExecFlagType &flag)
WARNING: This is an internal method for MOOSE, if you need the add new ExecFlagTypes then use the reg...
Definition: MooseApp.C:1829
MooseApp::setupOptions
virtual void setupOptions()
Setup options based on InputParameters.
Definition: MooseApp.C:493
MooseApp::disableCheckUnusedFlag
void disableCheckUnusedFlag()
Removes warnings and error checks for unrecognized variables in the input file.
Definition: MooseApp.C:1024
ActionWarehouse::executeAllActions
void executeAllActions()
This method loops over all actions in the warehouse and executes them.
Definition: ActionWarehouse.C:326
MooseApp::_restartable_data
RestartableDataMaps _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:950
dof_map
DofMap & dof_map
Definition: PetscDMMoose.C:1503
MooseUtils::indentMessage
void indentMessage(const std::string &prefix, std::string &message, const char *color=COLOR_CYAN)
Indents the supplied message given the prefix and color.
Definition: MooseUtils.C:443
Registry::allActions
static const std::map< std::string, std::vector< RegistryEntry > > & allActions()
Returns a per-label keyed map of all Actions in the registry.
Definition: Registry.C:33
InputParameters::addPrivateParam
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
Definition: InputParameters.h:1308
Parser::errorCheck
void errorCheck(const Parallel::Communicator &comm, bool warn_unused, bool err_unused)
Definition: Parser.C:588
SerializerGuard
A scope guard that guarantees that whatever happens between when it gets created and when it is destr...
Definition: SerializerGuard.h:24
MooseApp::parameters
InputParameters & parameters()
Get the parameters of the object.
Definition: MooseApp.h:90
MooseApp::isRestarting
bool isRestarting() const
Whether or not this is a "restart" calculation.
Definition: MooseApp.C:940
RestartableDataIO::createBackup
std::shared_ptr< Backup > createBackup()
Create a Backup for the current system.
Definition: RestartableDataIO.C:326
FEProblemBase
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: FEProblemBase.h:139
MooseApp::_enable_unused_check
enum MooseApp::UNUSED_CHECK _enable_unused_check
MooseApp::_recover
bool _recover
Whether or not this is a recovery run.
Definition: MooseApp.h:888
MooseUtils.h
MooseApp::_input_parameter_warehouse
InputParameterWarehouse * _input_parameter_warehouse
Input parameter storage structure (this is a raw pointer so the destruction time can be explicitly co...
Definition: MooseApp.h:844
MooseApp::_setup_timer
const PerfID _setup_timer
Timers.
Definition: MooseApp.h:1010
MooseApp::setRestart
void setRestart(bool value)
Sets the restart/recover flags.
Definition: MooseApp.C:1723
MooseApp::_output_position
Point _output_position
The output position.
Definition: MooseApp.h:823
MooseApp::addMeshGenerator
void addMeshGenerator(const std::string &generator_name, const std::string &name, InputParameters parameters)
Add a mesh generator that will act on the meshes in the system.
Definition: MooseApp.C:1525
Moose::RelationshipManagerType::COUPLING
MooseApp::dynamicAppRegistration
void dynamicAppRegistration(const std::string &app_name, std::string library_path, const std::string &library_name)
Definition: MooseApp.C:1188
Syntax::addDependency
void addDependency(const std::string &task, const std::string &pre_req)
Method to insert a new task in the list of existing tasks at the specified location.
Definition: Syntax.C:55
MooseApp::_output_position_set
bool _output_position_set
Whether or not an output position has been set for this app.
Definition: MooseApp.h:820
MooseApp::executeMeshGenerators
void executeMeshGenerators()
Execute and clear the Mesh Generators data structure.
Definition: MooseApp.C:1561
Parser::buildJsonSyntaxTree
void buildJsonSyntaxTree(JsonSyntaxTree &tree) const
Use MOOSE Factories to construct a parameter tree for documentation or echoing input.
Definition: Parser.C:655
MeshModifier
MeshModifiers are objects that can modify or add to an existing mesh.
Definition: MeshModifier.h:25
MooseApp::_trap_fpe
bool _trap_fpe
Whether or not FPE trapping should be turned on.
Definition: MooseApp.h:900
MooseApp::_mesh_generators
std::map< std::string, std::shared_ptr< MeshGenerator > > _mesh_generators
Holds the mesh generators until they have completed, then this structure is cleared.
Definition: MooseApp.h:992
MooseApp::getOutputFileBase
std::string getOutputFileBase(bool for_non_moose_build_output=false) const
Get the output file base name.
Definition: MooseApp.C:862
MooseApp::_cached_backup
std::shared_ptr< Backup > _cached_backup
Cache for a Backup to use for restart / recovery.
Definition: MooseApp.h:1004
MooseApp::_output_warehouse
OutputWarehouse _output_warehouse
OutputWarehouse object for this App.
Definition: MooseApp.h:841
MooseApp::_check_input
bool _check_input
true if we want to just check the input file
Definition: MooseApp.h:915
MooseApp::createMinimalApp
void createMinimalApp()
Method for creating the minimum required actions for an application (no input file)
Definition: MooseApp.C:1755
MooseApp::_file_base_set_by_user
bool _file_base_set_by_user
Whether or not file base is set through input or setOutputFileBase by MultiApp.
Definition: MooseApp.h:817
infix_ostream_iterator
Definition: InfixIterator.h:19
ActionWarehouse::displacedMesh
std::shared_ptr< MooseMesh > & displacedMesh()
Definition: ActionWarehouse.h:216
MooseApp::_lib_handles
std::map< std::pair< std::string, std::string >, void * > _lib_handles
The library, registration method and the handle to the method.
Definition: MooseApp.h:920
MooseApp::attachRelationshipManagers
void attachRelationshipManagers(Moose::RelationshipManagerType rm_type)
Attach the relationship managers of the given type Note: Geometric relationship managers that are sup...
Definition: MooseApp.C:1900
SystemInfo.h
PetscSupport.h