www.mooseframework.org
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
MooseApp Class Reference

Base class for MOOSE-based applications. More...

#include <MooseApp.h>

Inheritance diagram for MooseApp:
[legend]

Classes

struct  DynamicLibraryInfo
 
struct  FixedPointConfig
 Stores configuration options relating to the fixed-point solving capability. More...
 
struct  InterfaceRegistryObjects
 
struct  InterfaceRegistryObjectsBase
 

Public Member Functions

virtual ~MooseApp ()
 
TheWarehousetheWarehouse ()
 
const std::string & name () const
 Get the name of the object. More...
 
virtual std::string getPrintableName () const
 Get printable name of the application. More...
 
virtual std::string appBinaryName () const
 
InputParametersparameters ()
 Get the parameters of the object. More...
 
const std::string & type () const
 Get the type of this object as a string. More...
 
const RankMaprankMap ()
 The RankMap is a useful object for determining how the processes are laid out on the physical nodes of the cluster. More...
 
PerfGraphperfGraph ()
 Get the PerfGraph for this app. More...
 
SolutionInvaliditysolutionInvalidity ()
 Get the SolutionInvalidity for this app. More...
 
template<typename T >
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 Retrieve a renamed parameter for the object. More...
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
virtual void run ()
 Run the application. More...
 
std::string getFrameworkVersion () const
 Returns the framework version. More...
 
virtual std::string getVersion () const
 Returns the current version of the framework or application (default: framework version). More...
 
std::string getPrintableVersion () const
 Non-virtual method for printing out the version string in a consistent format. More...
 
virtual void setupOptions ()
 Setup options based on InputParameters. More...
 
ActionWarehouseactionWarehouse ()
 Return a writable reference to the ActionWarehouse associated with this app. More...
 
const ActionWarehouseactionWarehouse () const
 Return a const reference to the ActionWarehouse associated with this app. More...
 
Moose::Builderbuilder ()
 Returns a writable reference to the builder. More...
 
Syntaxsyntax ()
 Returns a writable reference to the syntax object. More...
 
const std::vector< std::string > & getInputFileNames () const
 
const std::string & getLastInputFileName () const
 
void setOutputFileBase (const std::string &output_file_base)
 Override the selection of the output file base name. More...
 
std::string getOutputFileBase (bool for_non_moose_build_output=false) const
 Get the output file base name. More...
 
void setOutputPosition (const Point &p)
 Tell the app to output in a specific position. More...
 
std::list< std::string > getCheckpointDirectories () const
 Get all checkpoint directories. More...
 
std::list< std::string > getCheckpointFiles () const
 Extract all possible checkpoint file names. More...
 
bool hasOutputPosition () const
 Whether or not an output position has been set. More...
 
Point getOutputPosition () const
 Get the output position. More...
 
void setStartTime (Real time)
 Set the starting time for the simulation. More...
 
bool hasStartTime () const
 
Real getStartTime () const
 
void setGlobalTimeOffset (Real offset)
 Each App has it's own local time. More...
 
Real getGlobalTimeOffset () const
 Each App has it's own local time. More...
 
std::string getFileName (bool stripLeadingPath=true) const
 Return the primary (first) filename that was parsed Note: When stripLeadingPath is false, this function returns the same name as getInputFileName() method when the input file is not a link. More...
 
void setErrorOverridden ()
 Set a flag so that the parser will throw an error if overridden parameters are detected. More...
 
void disableCheckUnusedFlag ()
 Removes warnings and error checks for unrecognized variables in the input file. More...
 
ExecutionergetExecutioner () const
 Retrieve the Executioner for this App. More...
 
ExecutorgetExecutor () const
 
NullExecutorgetNullExecutor () const
 
bool useExecutor () const
 
FEProblemBasefeProblem () const
 
void setExecutioner (std::shared_ptr< Executioner > &&executioner)
 Set the Executioner for this App. More...
 
void setExecutor (std::shared_ptr< Executor > &&executor)
 
void addExecutor (const std::string &type, const std::string &name, const InputParameters &params)
 
void addExecutorParams (const std::string &type, const std::string &name, const InputParameters &params)
 Adds the parameters for an Executor to the list of parameters. More...
 
Moose::Builderparser ()
 Deprecated helper function to link the new added Builder back to Parser. More...
 
void createExecutors ()
 After adding all of the Executor Params - this function will actually cause all of them to be built. More...
 
ExecutorgetExecutor (const std::string &name, bool fail_if_not_found=true)
 Get an Executor. More...
 
FixedPointConfigfixedPointConfig ()
 This info is stored here because we need a "globalish" place to put it in order to allow communication between a multiapp and solver-specific internals (i.e. More...
 
bool & useNonlinear ()
 Returns a writable Boolean indicating whether this app will use a Nonlinear or Eigen System. More...
 
bool & useEigenvalue ()
 Returns a writable Boolean indicating whether this app will use an eigenvalue executioner. More...
 
FactorygetFactory ()
 Retrieve a writable reference to the Factory associated with this App. More...
 
ActionFactorygetActionFactory ()
 Retrieve a writable reference to the ActionFactory associated with this App. More...
 
processor_id_type processor_id () const
 Returns the MPI processor ID of the current processor. More...
 
std::shared_ptr< CommandLinecommandLine () const
 Get the command line. More...
 
void setExodusFileRestart (bool flag)
 Set the flag to indicate whether or not we need to use a separate Exodus reader to read the mesh BEFORE we create the mesh. More...
 
bool getExodusFileRestart () const
 Whether or not we need to use a separate Exodus reader to read the mesh BEFORE we create the mesh. More...
 
void setExReaderForRestart (std::shared_ptr< ExodusII_IO > &&exreader)
 Set the Exodus reader to restart variables from an Exodus mesh file. More...
 
ExodusII_IO * getExReaderForRestart () const
 Get the Exodus reader to restart variables from an Exodus mesh file. More...
 
virtual void runInputFile ()
 Actually build everything in the input file. More...
 
virtual void executeExecutioner ()
 Execute the Executioner that was built. More...
 
bool getDistributedMeshOnCommandLine () const
 Returns true if the user specified –distributed-mesh (or –parallel-mesh, for backwards compatibility) on the command line and false otherwise. More...
 
bool isRecovering () const
 Whether or not this is a "recover" calculation. More...
 
bool isRestarting () const
 Whether or not this is a "restart" calculation. More...
 
bool isSplitMesh () const
 Whether or not this is a split mesh operation. More...
 
void setRestartRecoverFileBase (const std::string &file_base)
 mutator for recover_base (set by RecoverBaseAction) More...
 
bool testCheckpointHalfTransient () const
 Whether or not this simulation should only run half its transient (useful for testing recovery) More...
 
bool halfTransient () const
 
void setOutputFileNumbers (const std::map< std::string, unsigned int > &numbers)
 Store a map of outputter names and file numbers The MultiApp system requires this to get the file numbering to propagate down through the Multiapps. More...
 
const std::map< std::string, unsigned int > & getOutputFileNumbers () const
 Store a map of outputter names and file numbers The MultiApp system requires this to get the file numbering to propogate down through the multiapps. More...
 
OutputWarehousegetOutputWarehouse ()
 Get the OutputWarehouse objects. More...
 
const SystemInfogetSystemInfo () const
 Get SystemInfo object. More...
 
std::string appNameToLibName (const std::string &app_name) const
 Converts an application name to a library name: Examples: AnimalApp -> libanimal-oprof.la (assuming METHOD=oprof) ThreeWordAnimalApp -> libthree_word_animal-dbg.la (assuming METHOD=dbg) More...
 
std::string libNameToAppName (const std::string &library_name) const
 Converts a library name to an application name: More...
 
std::set< std::string > getLoadedLibraryPaths () const
 Return the paths of loaded libraries. More...
 
std::set< std::string > getLibrarySearchPaths (const std::string &library_path_from_param) const
 Return the paths searched by MOOSE when loading libraries. More...
 
InputParameterWarehousegetInputParameterWarehouse ()
 Get the InputParameterWarehouse for MooseObjects. More...
 
RestartableDataValueregisterRestartableData (std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
 
RestartableDataValueregisterRestartableData (const std::string &name, std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
 
bool hasRestartableMetaData (const std::string &name, const RestartableDataMapName &metaname) const
 
RestartableDataValuegetRestartableMetaData (const std::string &name, const RestartableDataMapName &metaname, THREAD_ID tid)
 
void possiblyLoadRestartableMetaData (const RestartableDataMapName &name, const std::filesystem::path &folder_base)
 Loads the restartable meta data for name if it is available with the folder base folder_base. More...
 
void loadRestartableMetaData (const std::filesystem::path &folder_base)
 Loads all available restartable meta data if it is available with the folder base folder_base. More...
 
std::vector< std::filesystem::path > writeRestartableMetaData (const RestartableDataMapName &name, const std::filesystem::path &folder_base)
 Writes the restartable meta data for name with a folder base of folder_base. More...
 
std::vector< std::filesystem::path > writeRestartableMetaData (const std::filesystem::path &folder_base)
 Writes all available restartable meta data with a file base of file_base. More...
 
RestartableDataMapgetRestartableDataMap (const RestartableDataMapName &name)
 Return a reference to restartable data for the specific type flag. More...
 
bool hasRestartableDataMap (const RestartableDataMapName &name) const
 
void registerRestartableDataMapName (const RestartableDataMapName &name, std::string suffix="")
 Reserve a location for storing custom RestartableDataMap objects. More...
 
const std::string & getRestartableDataMapName (const RestartableDataMapName &name) const
 
const DataNamesgetRecoverableData () const
 Return a reference to the recoverable data object. More...
 
std::vector< std::filesystem::path > backup (const std::filesystem::path &folder_base)
 Backs up the application to the folder folder_base. More...
 
std::unique_ptr< Backupbackup ()
 Backs up the application memory in a Backup. More...
 
virtual void preBackup ()
 Insertion point for other apps that is called before backup() More...
 
void restore (const std::filesystem::path &folder_base, const bool for_restart)
 Restore an application from file. More...
 
void restore (std::unique_ptr< Backup > backup, const bool for_restart)
 Restore an application from the backup backup. More...
 
virtual void postRestore (const bool)
 Insertion point for other apps that is called after restore() More...
 
void restoreFromInitialBackup (const bool for_restart)
 Restores from a "initial" backup, that is, one set in _initial_backup. More...
 
std::unique_ptr< BackupfinalizeRestore ()
 Finalizes (closes) the restoration process done in restore(). More...
 
virtual std::string header () const
 Returns a string to be printed at the beginning of a simulation. More...
 
unsigned int multiAppLevel () const
 The MultiApp Level. More...
 
unsigned int multiAppNumber () const
 The MultiApp number. More...
 
bool isUltimateMaster () const
 Whether or not this app is the ultimate master app. More...
 
const MooseMeshmasterMesh () const
 Returns a pointer to the master mesh. More...
 
const MooseMeshmasterDisplacedMesh () const
 Returns a pointer to the master displaced mesh. More...
 
MeshGeneratorSystemgetMeshGeneratorSystem ()
 Gets the system that manages the MeshGenerators. More...
 
void addMeshGenerator (const std::string &type, const std::string &name, const InputParameters &params)
 Add a mesh generator that will act on the meshes in the system. More...
 
bool hasMeshGenerator (const MeshGeneratorName &name) const
 
const MeshGeneratorgetMeshGenerator (const std::string &name) const
 
std::unique_ptr< MeshBase > getMeshGeneratorMesh ()
 
std::vector< std::string > getMeshGeneratorNames () const
 
const MeshGeneratorappendMeshGenerator (const std::string &type, const std::string &name, InputParameters params)
 Append a mesh generator that will act on the final mesh generator in the system. More...
 
virtual bool constructingMeshGenerators () const
 Whether this app is constructing mesh generators. More...
 
bool checkInput () const
 Returns whether the Application is running in check input mode. More...
 
bool getFPTrapFlag () const
 Returns whether FPE trapping is turned on (either because of debug or user requested) More...
 
bool hasRelationshipManager (const std::string &name) const
 Returns a Boolean indicating whether a RelationshipManater exists with the same name. More...
 
bool addRelationshipManager (std::shared_ptr< RelationshipManager > relationship_manager)
 Transfers ownership of a RelationshipManager to the application for lifetime management. More...
 
std::filesystem::path restartFolderBase (const std::filesystem::path &folder_base) const
 The file suffix for restartable data. More...
 
void attachRelationshipManagers (Moose::RelationshipManagerType rm_type, bool attach_geometric_rm_final=false)
 Attach the relationship managers of the given type Note: Geometric relationship managers that are supposed to be attached late will be attached when Algebraic are attached. More...
 
void attachRelationshipManagers (MeshBase &mesh, MooseMesh &moose_mesh)
 Attach geometric relationship managers to the given MeshBase object. More...
 
const std::vector< std::shared_ptr< RelationshipManager > > & getReleationshipManagers ()
 Retrieve the relationship managers. More...
 
std::vector< std::pair< std::string, std::string > > getRelationshipManagerInfo () const
 Returns the Relationship managers info suitable for printing. More...
 
const ExecFlagEnumgetExecuteOnEnum () const
 Return the app level ExecFlagEnum, this contains all the available flags for the app. More...
 
bool hasInitialBackup () const
 
bool defaultAutomaticScaling () const
 Whether to enable automatic scaling by default. More...
 
const std::shared_ptr< Parallel::Communicator > getCommunicator () const
 
const std::set< std::shared_ptr< RelationshipManager > > & relationshipManagers () const
 Return the container of relationship managers. More...
 
void checkMetaDataIntegrity () const
 Function to check the integrity of the restartable meta data structure. More...
 
virtual bool errorOnJacobianNonzeroReallocation () const
 Whether this application should by default error on Jacobian nonzero reallocations. More...
 
template<class T >
void registerInterfaceObject (T &interface)
 Registers an interface object for accessing with getInterfaceObjects. More...
 
template<class T >
const std::vector< T * > & getInterfaceObjects () const
 Gets the registered interface objects for a given interface. More...
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
template<typename T >
const T & getParam (const std::string &name)
 Retrieve a parameter for the object. More...
 
template<typename T >
const T & getParam (const std::string &name) const
 
bool hasRestartRecoverFileBase () const
 Return true if the recovery file base is set. More...
 
bool hasRecoverFileBase () const
 
std::string getRestartRecoverFileBase () const
 The file_base for the recovery file. More...
 
std::string getRecoverFileBase () const
 
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. More...
 
void dynamicAppRegistration (const std::string &app_name, std::string library_path, const std::string &library_name, bool lib_load_deps)
 
const std::vector< RestartableDataMap > & getRestartableData () const
 Return reference to the restartable data object. More...
 
std::vector< RestartableDataMap > & getRestartableData ()
 
void setRestart (bool value)
 Sets the restart/recover flags. More...
 
void setRecover (bool value)
 
auto getRestartableDataMapBegin ()
 Iterator based access to the extra RestartableDataMap objects; see Checkpoint.C for use case. More...
 
auto getRestartableDataMapEnd ()
 

Static Public Member Functions

static InputParameters validParams ()
 
static const std::string & checkpointSuffix ()
 The file suffix for the checkpoint mesh. More...
 
static std::filesystem::path metaDataFolderBase (const std::filesystem::path &folder_base, const std::string &map_suffix)
 The file suffix for meta data (header and data) More...
 
static void addAppParam (InputParameters &params)
 

Public Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 

Static Public Attributes

static const RestartableDataMapName MESH_META_DATA = "MeshMetaData"
 
static const std::string MESH_META_DATA_SUFFIX = "mesh"
 

Protected Types

enum  UNUSED_CHECK { OFF, WARN_UNUSED, ERROR_UNUSED }
 Indicates whether warnings, errors, or no output is displayed when unused parameters are detected. More...
 

Protected Member Functions

void dynamicRegistration (const Parameters &params)
 Helper method for dynamic loading of objects. More...
 
void loadLibraryAndDependencies (const std::string &library_filename, const Parameters &params, bool load_dependencies=true)
 Recursively loads libraries and dependencies in the proper order to fully register a MOOSE application that may have several dependencies. More...
 
 MooseApp (InputParameters parameters)
 Constructor is protected so that this object is constructed through the AppFactory object. More...
 
void registerRestartableNameWithFilter (const std::string &name, Moose::RESTARTABLE_FILTER filter)
 NOTE: This is an internal function meant for MOOSE use only! More...
 
void errorCheck ()
 Runs post-initialization error checking that cannot be run correctly unless the simulation has been fully set up and initialized. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 Call to register a named section for timing. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 Call to register a named section for timing. More...
 
std::string timedSectionName (const std::string &section_name) const
 

Protected Attributes

const std::string _name
 The name of this object. More...
 
InputParameters _pars
 Parameters of this object. More...
 
const std::string _type
 The string representation of the type of this object as registered (see registerApp(AppName)) More...
 
const std::shared_ptr< Parallel::Communicator > _comm
 The MPI communicator this App is going to use. More...
 
std::string _output_file_base
 The output file basename. More...
 
bool _file_base_set_by_user
 Whether or not file base is set through input or setOutputFileBase by MultiApp. More...
 
bool _output_position_set
 Whether or not an output position has been set for this app. More...
 
Point _output_position
 The output position. More...
 
bool _start_time_set
 Whether or not an start time has been set. More...
 
Real _start_time
 The time at which to start the simulation. More...
 
Real _global_time_offset
 Offset of the local App time to the "global" problem time. More...
 
std::shared_ptr< CommandLine_command_line
 Command line object. More...
 
Syntax _syntax
 Syntax of the input file. More...
 
std::unique_ptr< InputParameterWarehouse_input_parameter_warehouse
 Input parameter storage structure; unique_ptr so we can control its destruction order. More...
 
ActionFactory _action_factory
 The Factory responsible for building Actions. More...
 
ActionWarehouse _action_warehouse
 Where built actions are stored. More...
 
OutputWarehouse _output_warehouse
 OutputWarehouse object for this App. More...
 
const std::shared_ptr< Parser_parser
 Parser for parsing the input file. More...
 
Moose::Builder _builder
 Builder for building app related parser tree. More...
 
std::vector< RestartableDataMap_restartable_data
 Where the restartable data is held (indexed on tid) More...
 
DataNames _recoverable_data_names
 Data names that will only be read from the restart file during RECOVERY. More...
 
PerfGraph_perf_graph
 The PerfGraph object for this application (recoverable) More...
 
SolutionInvalidity_solution_invalidity
 The SolutionInvalidity object for this application. More...
 
const RankMap _rank_map
 The RankMap is a useful object for determining how the processes are laid out on the physical hardware. More...
 
std::shared_ptr< Executioner_executioner
 Pointer to the executioner of this run (typically build by actions) More...
 
std::shared_ptr< Executor_executor
 Pointer to the Executor of this run. More...
 
std::map< std::string, std::shared_ptr< Executor > > _executors
 Pointers to all of the Executors for this run. More...
 
std::unordered_map< std::string, std::pair< std::string, std::unique_ptr< InputParameters > > > _executor_params
 Used in building the Executors Maps the name of the Executor block to the <type, params> More...
 
FixedPointConfig _fixed_point_config
 Multiapp-related fixed point algorithm configuration details primarily intended to be passed to and used by the executioner/executor system. More...
 
const bool _use_executor
 Indicates whether we are operating in the new/experimental executor mode instead of using the legacy executioner system. More...
 
std::shared_ptr< NullExecutor_null_executor
 Used to return an executor that does nothing. More...
 
bool _use_nonlinear
 Boolean to indicate whether to use a Nonlinear or EigenSystem (inspected by actions) More...
 
bool _use_eigen_value
 Boolean to indicate whether to use an eigenvalue executioner. More...
 
std::unique_ptr< SystemInfo_sys_info
 System Information. More...
 
enum MooseApp::UNUSED_CHECK _enable_unused_check
 
Factory _factory
 
bool _error_overridden
 Indicates whether warnings or errors are displayed when overridden parameters are detected. More...
 
bool _ready_to_exit
 
bool _initial_from_file
 This variable indicates when a request has been made to restart from an Exodus file. More...
 
std::shared_ptr< ExodusII_IO > _ex_reader
 The Exodus reader when _initial_from_file is set to true. More...
 
bool _distributed_mesh_on_command_line
 This variable indicates that DistributedMesh should be used for the libMesh mesh underlying MooseMesh. More...
 
bool _recover
 Whether or not this is a recovery run. More...
 
bool _restart
 Whether or not this is a restart run. More...
 
bool _split_mesh
 Whether or not we are performing a split mesh operation (–split-mesh) More...
 
const bool _use_split
 Whether or not we are using a (pre-)split mesh (automatically DistributedMesh) More...
 
bool _trap_fpe
 Whether or not FPE trapping should be turned on. More...
 
std::string _restart_recover_base
 The base name to restart/recover from. If blank then we will find the newest checkpoint file. More...
 
bool _test_checkpoint_half_transient
 Whether or not this simulation should only run half its transient (useful for testing recovery) More...
 
std::map< std::string, unsigned int_output_file_numbers
 Map of outputer name and file number (used by MultiApps to propagate file numbers down through the multiapps) More...
 
bool _check_input
 true if we want to just check the input file More...
 
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
 The relationship managers that have been added. More...
 
std::map< Moose::RelationshipManagerType, std::set< const RelationshipManager * > > _attached_relationship_managers
 The relationship managers that have been attached (type -> RMs) More...
 
std::unordered_map< RelationshipManager *, std::shared_ptr< GhostingFunctor > > _undisp_to_disp_rms
 A map from undisplaced relationship managers to their displaced clone (stored as the base GhostingFunctor). More...
 
std::unordered_map< std::string, DynamicLibraryInfo_lib_handles
 The library archive (name only), registration method and the handle to the method. More...
 
MooseApp_pg_moose_app
 The MooseApp that owns the PerfGraph. More...
 
const std::string _prefix
 A prefix to use for all sections. More...
 
const Parallel::Communicator & _communicator
 

Private Types

enum  RegistrationType { APPLICATION, REGALL }
 Enumeration for holding the valid types of dynamic registrations allowed. More...
 

Private Member Functions

void recursivelyCreateExecutors (const std::string &current_executor_name, std::list< std::string > &possible_roots, std::list< std::string > &current_branch)
 Internal function used to recursively create the executor objects. More...
 
void removeRelationshipManager (std::shared_ptr< RelationshipManager > relationship_manager)
 Purge this relationship manager from meshes and DofMaps and finally from us. More...
 
void createMinimalApp ()
 Method for creating the minimum required actions for an application (no input file) More...
 
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 is complete. More...
 
bool hasRMClone (const RelationshipManager &template_rm, const MeshBase &mesh) const
 
RelationshipManagergetRMClone (const RelationshipManager &template_rm, const MeshBase &mesh) const
 Return the relationship manager clone originally created from the provided template relationship manager and mesh. More...
 
RelationshipManagercreateRMFromTemplateAndInit (const RelationshipManager &template_rm, MooseMesh &moose_mesh, MeshBase &mesh, const DofMap *dof_map=nullptr)
 Take an input relationship manager, clone it, and then initialize it with provided mesh and optional dof_map. More...
 
PerfGraphcreateRecoverablePerfGraph ()
 Creates a recoverable PerfGraph. More...
 
SolutionInvaliditycreateRecoverableSolutionInvalidity ()
 Creates a recoverable SolutionInvalidity. More...
 
bool showInputs () const
 Prints a message showing the installable inputs for a given application (if getInstallableInputs has been overridden for an application). More...
 
virtual std::string getInstallableInputs () const
 Method to retrieve the installable inputs from a given applications <app>Revision.h file. More...
 
bool copyInputs () const
 Handles the copy_inputs input parameter logic: Checks to see whether the passed argument is valid (a readable installed directory) and recursively copies those files into a read/writable location for the user. More...
 
bool runInputs () const
 Handles the run input parameter logic: Checks to see whether a directory exists in user space and launches the TestHarness to process the given directory. More...
 

Private Attributes

std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
 General storage for custom RestartableData that can be added to from outside applications. More...
 
std::unique_ptr< TheWarehouse_the_warehouse
 The combined warehouse for storing any MooseObject based object. More...
 
unsigned int _multiapp_level
 Level of multiapp, the master is level 0. This used by the Console to indent output. More...
 
unsigned int _multiapp_number
 Numbering in all the sub-apps on the same level. More...
 
const MooseMesh *const _master_mesh
 The mesh from master app. More...
 
const MooseMesh *const _master_displaced_mesh
 The displaced mesh from master app. More...
 
MeshGeneratorSystem _mesh_generator_system
 The system that manages the MeshGenerators. More...
 
RestartableDataReader _rd_reader
 
const ExecFlagEnum _execute_flags
 Execution flags for this App. More...
 
std::streambuf * _output_buffer_cache
 Cache output buffer so the language server can turn it off then back on. More...
 
const bool _automatic_automatic_scaling
 Whether to turn on automatic scaling by default. More...
 
bool _cpu_profiling = false
 CPU profiling. More...
 
bool _heap_profiling = false
 Memory profiling. More...
 
std::map< const RelationshipManager *, std::map< const MeshBase *, std::unique_ptr< RelationshipManager > > > _template_to_clones
 Map from a template relationship manager to a map in which the key-value pairs represent the MeshBase object and the clone of the template relationship manager, e.g. More...
 
std::map< std::type_index, std::unique_ptr< InterfaceRegistryObjectsBase > > _interface_registry
 Registration for interface objects. More...
 
std::unique_ptr< Backup > *const _initial_backup
 The backup for use in initial setup; this will get set from the _initial_backup input parameter that typically gets set from a MultiApp that has a backup This is a pointer to a pointer because at the time of construction of the app, the backup will not be filled yet. More...
 

Friends

class FEProblemBase
 
class Restartable
 
class SubProblem
 

Detailed Description

Base class for MOOSE-based applications.

This generic class for application provides:

Each application should register its own objects and register its own special syntax

Definition at line 69 of file MooseApp.h.

Member Enumeration Documentation

◆ RegistrationType

Enumeration for holding the valid types of dynamic registrations allowed.

Enumerator
APPLICATION 
REGALL 

Definition at line 1404 of file MooseApp.h.

1405  {
1406  APPLICATION,
1407  REGALL
1408  };

◆ UNUSED_CHECK

enum MooseApp::UNUSED_CHECK
protected

Indicates whether warnings, errors, or no output is displayed when unused parameters are detected.

Enumerator
OFF 
WARN_UNUSED 
ERROR_UNUSED 

Definition at line 1207 of file MooseApp.h.

1208  {
1209  OFF,
1210  WARN_UNUSED,
1211  ERROR_UNUSED
enum MooseApp::UNUSED_CHECK _enable_unused_check

Constructor & Destructor Documentation

◆ ~MooseApp()

MooseApp::~MooseApp ( )
virtual

Definition at line 629 of file MooseApp.C.

630 {
631 #ifdef HAVE_GPERFTOOLS
632  // CPU profiling stop
633  if (_cpu_profiling)
634  ProfilerStop();
635  // Heap profiling stop
636  if (_heap_profiling)
637  HeapProfilerStop();
638 #endif
640  _executioner.reset();
641  _the_warehouse.reset();
642 
643  // Don't wait for implicit destruction of input parameter storage
645 
646  // This is dirty, but I don't know what else to do. Obviously, others
647  // have had similar problems if you look above. In specific, the
648  // dlclose below on macs is destructing some data that does not
649  // belong to it in garbage collection. So... don't even give
650  // dlclose an option
651  _restartable_data.clear();
652 
653 #ifdef LIBMESH_HAVE_DLOPEN
654  // Close any open dynamic libraries
655  for (const auto & lib_pair : _lib_handles)
656  dlclose(lib_pair.second.library_handle);
657 #endif
658 }
std::unique_ptr< TheWarehouse > _the_warehouse
The combined warehouse for storing any MooseObject based object.
Definition: MooseApp.h:1411
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:1155
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:1173
bool _heap_profiling
Memory profiling.
Definition: MooseApp.h:1449
std::unordered_map< std::string, DynamicLibraryInfo > _lib_handles
The library archive (name only), registration method and the handle to the method.
Definition: MooseApp.h:1277
bool _cpu_profiling
CPU profiling.
Definition: MooseApp.h:1446
std::unique_ptr< InputParameterWarehouse > _input_parameter_warehouse
Input parameter storage structure; unique_ptr so we can control its destruction order.
Definition: MooseApp.h:1137
void clear()
This method deletes all of the Actions in the warehouse.

◆ MooseApp()

MooseApp::MooseApp ( InputParameters  parameters)
protected

Constructor is protected so that this object is constructed through the AppFactory object.

Definition at line 358 of file MooseApp.C.

359  : ConsoleStreamInterface(*this),
360  PerfGraphInterface(*this, "MooseApp"),
361  ParallelObject(*parameters.get<std::shared_ptr<Parallel::Communicator>>(
362  "_comm")), // Can't call getParam() before pars is set
363  _name(parameters.get<std::string>("_app_name")),
364  _pars(parameters),
365  _type(getParam<std::string>("_type")),
366  _comm(getParam<std::shared_ptr<Parallel::Communicator>>("_comm")),
367  _file_base_set_by_user(false),
368  _output_position_set(false),
369  _start_time_set(false),
370  _start_time(0.0),
371  _global_time_offset(0.0),
372  _input_parameter_warehouse(std::make_unique<InputParameterWarehouse>()),
373  _action_factory(*this),
375  _output_warehouse(*this),
376  _parser(parameters.get<std::shared_ptr<Parser>>("_parser")),
382  _use_executor(parameters.get<bool>("use_executor")),
383  _null_executor(NULL),
384  _use_nonlinear(true),
385  _use_eigen_value(false),
387  _factory(*this),
388  _error_overridden(false),
389  _ready_to_exit(false),
390  _initial_from_file(false),
392  _recover(false),
393  _restart(false),
394  _split_mesh(false),
395  _use_split(parameters.get<bool>("use_split")),
396 #ifdef DEBUG
397  _trap_fpe(true),
398 #else
399  _trap_fpe(false),
400 #endif
402  _check_input(getParam<bool>("check_input")),
404  isParamValid("_multiapp_level") ? parameters.get<unsigned int>("_multiapp_level") : 0),
406  isParamValid("_multiapp_number") ? parameters.get<unsigned int>("_multiapp_number") : 0),
407  _master_mesh(isParamValid("_master_mesh") ? parameters.get<const MooseMesh *>("_master_mesh")
408  : nullptr),
409  _master_displaced_mesh(isParamValid("_master_displaced_mesh")
410  ? parameters.get<const MooseMesh *>("_master_displaced_mesh")
411  : nullptr),
412  _mesh_generator_system(*this),
415  _output_buffer_cache(nullptr),
416  _automatic_automatic_scaling(getParam<bool>("automatic_automatic_scaling")),
417  _initial_backup(getParam<std::unique_ptr<Backup> *>("_initial_backup"))
418 {
419  // Set the TIMPI sync type via --timpi-sync
420  const auto & timpi_sync = parameters.get<std::string>("timpi_sync");
421  const_cast<Parallel::Communicator &>(comm()).sync_type(timpi_sync);
422 
423 #ifdef HAVE_GPERFTOOLS
424  if (isUltimateMaster())
425  {
426  bool has_cpu_profiling = false;
427  bool has_heap_profiling = false;
428  static std::string cpu_profile_file;
429  static std::string heap_profile_file;
430 
431  // For CPU profiling, users need to have environment 'MOOSE_PROFILE_BASE'
432  if (std::getenv("MOOSE_PROFILE_BASE"))
433  {
434  has_cpu_profiling = true;
435  cpu_profile_file =
436  std::getenv("MOOSE_PROFILE_BASE") + std::to_string(_comm->rank()) + ".prof";
437  // create directory if needed
438  auto name = MooseUtils::splitFileName(cpu_profile_file);
439  if (!name.first.empty())
440  {
441  if (processor_id() == 0)
442  MooseUtils::makedirs(name.first.c_str());
443  _comm->barrier();
444  }
445  }
446 
447  // For Heap profiling, users need to have 'MOOSE_HEAP_BASE'
448  if (std::getenv("MOOSE_HEAP_BASE"))
449  {
450  has_heap_profiling = true;
451  heap_profile_file = std::getenv("MOOSE_HEAP_BASE") + std::to_string(_comm->rank());
452  // create directory if needed
453  auto name = MooseUtils::splitFileName(heap_profile_file);
454  if (!name.first.empty())
455  {
456  if (processor_id() == 0)
457  MooseUtils::makedirs(name.first.c_str());
458  _comm->barrier();
459  }
460  }
461 
462  // turn on profiling only on selected ranks
463  if (isParamValid("gperf_profiler_on"))
464  {
465  auto rankstr = getParam<std::string>("gperf_profiler_on");
466  std::vector<processor_id_type> ranks;
467  bool success = MooseUtils::tokenizeAndConvert(rankstr, ranks, ", ");
468  if (!success)
469  mooseError("Invalid argument for --gperf-profiler-on: '", rankstr, "'");
470  for (auto & rank : ranks)
471  {
472  if (rank >= _comm->size())
473  mooseError("Invalid argument for --gperf-profiler-on: ",
474  rank,
475  " is greater than or equal to ",
476  _comm->size());
477  if (rank == _comm->rank())
478  {
479  _cpu_profiling = has_cpu_profiling;
480  _heap_profiling = has_heap_profiling;
481  }
482  }
483  }
484  else
485  {
486  _cpu_profiling = has_cpu_profiling;
487  _heap_profiling = has_heap_profiling;
488  }
489 
490  if (_cpu_profiling)
491  if (!ProfilerStart(cpu_profile_file.c_str()))
492  mooseError("CPU profiler is not started properly");
493 
494  if (_heap_profiling)
495  {
496  HeapProfilerStart(heap_profile_file.c_str());
497  if (!IsHeapProfilerRunning())
498  mooseError("Heap profiler is not started properly");
499  }
500  }
501 #else
502  if (std::getenv("MOOSE_PROFILE_BASE") || std::getenv("MOOSE_HEAP_BASE"))
503  mooseError("gperftool is not available for CPU or heap profiling");
504 #endif
505 
506  // If this will be a language server then turn off output until that starts
507  if (isParamValid("language_server"))
508  _output_buffer_cache = Moose::out.rdbuf(nullptr);
509 
512 
513  _the_warehouse = std::make_unique<TheWarehouse>();
514  _the_warehouse->registerAttribute<AttribMatrixTags>("matrix_tags", 0);
515  _the_warehouse->registerAttribute<AttribVectorTags>("vector_tags", 0);
516  _the_warehouse->registerAttribute<AttribExecOns>("exec_ons", 0);
517  _the_warehouse->registerAttribute<AttribSubdomains>("subdomains", 0);
518  _the_warehouse->registerAttribute<AttribBoundaries>("boundaries", 0);
519  _the_warehouse->registerAttribute<AttribThread>("thread", 0);
520  _the_warehouse->registerAttribute<AttribExecutionOrderGroup>("execution_order_group", 0);
521  _the_warehouse->registerAttribute<AttribPreIC>("pre_ic", 0);
522  _the_warehouse->registerAttribute<AttribPreAux>("pre_aux");
523  _the_warehouse->registerAttribute<AttribPostAux>("post_aux");
524  _the_warehouse->registerAttribute<AttribName>("name", "dummy");
525  _the_warehouse->registerAttribute<AttribSystem>("system", "dummy");
526  _the_warehouse->registerAttribute<AttribVar>("variable", -1);
527  _the_warehouse->registerAttribute<AttribInterfaces>("interfaces", 0);
528  _the_warehouse->registerAttribute<AttribSysNum>("sys_num", libMesh::invalid_uint);
529  _the_warehouse->registerAttribute<AttribResidualObject>("residual_object");
530  _the_warehouse->registerAttribute<AttribSorted>("sorted");
531  _the_warehouse->registerAttribute<AttribDisplaced>("displaced", -1);
532 
533  if (isParamValid("_argc") && isParamValid("_argv"))
534  {
535  int argc = getParam<int>("_argc");
536  char ** argv = getParam<char **>("_argv");
537 
538  _sys_info = std::make_unique<SystemInfo>(argc, argv);
539  }
540  if (isParamValid("_command_line"))
541  _command_line = getParam<std::shared_ptr<CommandLine>>("_command_line");
542  else
543  mooseError("Valid CommandLine object required");
544 
545  if (_check_input && isParamValid("recover"))
546  mooseError("Cannot run --check-input with --recover. Recover files might not exist");
547 
548  if (isParamValid("start_in_debugger") && _multiapp_level == 0)
549  {
550  auto command = getParam<std::string>("start_in_debugger");
551 
552  Moose::out << "Starting in debugger using: " << command << std::endl;
553 
555 
556  std::stringstream command_stream;
557 
558  // This will start XTerm and print out some info first... then run the debugger
559  command_stream << "xterm -e \"echo 'Rank: " << processor_id() << " Hostname: " << hostname
560  << " PID: " << getpid() << "'; echo ''; ";
561 
562  // Figure out how to run the debugger
563  if (command.find("lldb") != std::string::npos || command.find("gdb") != std::string::npos)
564  command_stream << command << " -p " << getpid();
565  else
566  mooseError("Unknown debugger: ",
567  command,
568  "\nIf this is truly what you meant then contact moose-users to have a discussion "
569  "about adding your debugger.");
570 
571  // Finish up the command
572  command_stream << "\""
573  << " & ";
574 
575  std::string command_string = command_stream.str();
576  Moose::out << "Running: " << command_string << std::endl;
577 
578  int ret = std::system(command_string.c_str());
579  libmesh_ignore(ret);
580 
581  // Sleep to allow time for the debugger to attach
582  std::this_thread::sleep_for(std::chrono::seconds(10));
583  }
584 
585  if (!parameters.isParamSetByAddParam("stop_for_debugger"))
586  {
587  Moose::out << "\nStopping for " << getParam<unsigned int>("stop_for_debugger")
588  << " seconds to allow attachment from a debugger.\n";
589 
590  Moose::out << "\nAll of the processes you can connect to:\n";
591  Moose::out << "rank - hostname - pid\n";
592 
594 
595  {
596  // The 'false' turns off the serialization warning
597  SerializerGuard sg(_communicator, false); // Guarantees that the processors print in order
598  Moose::err << processor_id() << " - " << hostname << " - " << getpid() << "\n";
599  }
600 
601  Moose::out << "\nWaiting...\n" << std::endl;
602 
603  // Sleep to allow time for the debugger to attach
604  std::this_thread::sleep_for(std::chrono::seconds(getParam<unsigned int>("stop_for_debugger")));
605  }
606 
607  if (_master_mesh && _multiapp_level == 0)
608  mooseError("Mesh can be passed in only for sub-apps");
609 
611  mooseError("_master_mesh should have been set when _master_displaced_mesh is set");
612 
613  // Data specifically associated with the mesh (meta-data) that will read from the restart
614  // file early during the simulation setup so that they are available to Actions and other objects
615  // that need them during the setup process. Most of the restartable data isn't made available
616  // until all objects have been created and all Actions have been executed (i.e. initialSetup).
618 
619  if (parameters.have_parameter<bool>("use_legacy_dirichlet_bc"))
620  mooseDeprecated("The parameter 'use_legacy_dirichlet_bc' is no longer valid.\n\n",
621  "All Dirichlet boundary conditions are preset by default.\n\n",
622  "Remove said parameter in ",
623  name(),
624  " to remove this deprecation warning.");
625 
626  Moose::out << std::flush;
627 }
ParallelObject(const Parallel::Communicator &comm_in)
bool _use_eigen_value
Boolean to indicate whether to use an eigenvalue executioner.
Definition: MooseApp.h:1201
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
unsigned int _multiapp_level
Level of multiapp, the master is level 0. This used by the Console to indent output.
Definition: MooseApp.h:1414
PerfGraph & _perf_graph
The PerfGraph object for this application (recoverable)
Definition: MooseApp.h:1164
const std::string _type
The string representation of the type of this object as registered (see registerApp(AppName)) ...
Definition: MooseApp.h:1103
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
Definition: MooseApp.h:823
bool _initial_from_file
This variable indicates when a request has been made to restart from an Exodus file.
Definition: MooseApp.h:1221
unsigned int n_threads()
PerfGraph & createRecoverablePerfGraph()
Creates a recoverable PerfGraph.
Definition: MooseApp.C:2809
const unsigned int invalid_uint
const std::shared_ptr< Parser > _parser
Parser for parsing the input file.
Definition: MooseApp.h:1149
Real _global_time_offset
Offset of the local App time to the "global" problem time.
Definition: MooseApp.h:1127
bool _file_base_set_by_user
Whether or not file base is set through input or setOutputFileBase by MultiApp.
Definition: MooseApp.h:1112
bool _output_position_set
Whether or not an output position has been set for this app.
Definition: MooseApp.h:1115
std::unique_ptr< TheWarehouse > _the_warehouse
The combined warehouse for storing any MooseObject based object.
Definition: MooseApp.h:1411
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
InputParameters & parameters()
Get the parameters of the object.
Definition: MooseApp.h:126
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
bool tokenizeAndConvert(const std::string &str, std::vector< T > &tokenized_vector, const std::string &delimiter=" \\\)
tokenizeAndConvert splits a string using delimiter and then converts to type T.
Definition: MooseUtils.h:806
bool _use_nonlinear
Boolean to indicate whether to use a Nonlinear or EigenSystem (inspected by actions) ...
Definition: MooseApp.h:1198
static const RestartableDataMapName MESH_META_DATA
Definition: MooseApp.h:90
Real _start_time
The time at which to start the simulation.
Definition: MooseApp.h:1124
This attribute describes sorting state.
Definition: TheWarehouse.h:112
const bool _use_split
Whether or not we are using a (pre-)split mesh (automatically DistributedMesh)
Definition: MooseApp.h:1239
std::pair< std::filesystem::path, std::filesystem::path > splitFileName(const T &full_file)
Function for splitting path and filename.
Definition: MooseUtils.h:231
const std::string _name
The name of this object.
Definition: MooseApp.h:1097
bool _check_input
true if we want to just check the input file
Definition: MooseApp.h:1254
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies.
Definition: Attributes.h:313
const Parallel::Communicator & comm() const
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:174
Syntax _syntax
Syntax of the input file.
Definition: MooseApp.h:1133
bool _trap_fpe
Whether or not FPE trapping should be turned on.
Definition: MooseApp.h:1242
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor.
Definition: MooseApp.h:418
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
RestartableDataReader _rd_reader
Definition: MooseApp.h:1428
static ExecFlagRegistry & getExecFlagRegistry()
Return Singleton instance.
std::unique_ptr< SystemInfo > _sys_info
System Information.
Definition: MooseApp.h:1204
SolutionInvalidity & _solution_invalidity
The SolutionInvalidity object for this application.
Definition: MooseApp.h:1167
std::string hostname()
Get the hostname the current process is running on.
Definition: MooseUtils.C:607
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:1155
const RankMap _rank_map
The RankMap is a useful object for determining how the processes are laid out on the physical hardwar...
Definition: MooseApp.h:1170
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies.
Definition: Attributes.h:294
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426
bool _start_time_set
Whether or not an start time has been set.
Definition: MooseApp.h:1121
bool isParamSetByAddParam(const std::string &name) const
Returns whether or not the parameter was set due to addParam.
void libmesh_ignore(const Args &...)
std::shared_ptr< NullExecutor > _null_executor
Used to return an executor that does nothing.
Definition: MooseApp.h:1195
Tracks the libmesh system number that a MooseObject is associated with.
Definition: Attributes.h:275
std::shared_ptr< CommandLine > _command_line
Command line object.
Definition: MooseApp.h:1130
bool _restart
Whether or not this is a restart run.
Definition: MooseApp.h:1233
AttribBoundaries tracks all boundary IDs associated with an object.
Definition: Attributes.h:188
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
ActionFactory _action_factory
The Factory responsible for building Actions.
Definition: MooseApp.h:1140
ConsoleStreamInterface(MooseApp &app)
A class for providing a helper stream object for writting message to all the Output objects...
enum MooseApp::UNUSED_CHECK _enable_unused_check
bool _recover
Whether or not this is a recovery run.
Definition: MooseApp.h:1230
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:313
bool _error_overridden
Indicates whether warnings or errors are displayed when overridden parameters are detected...
Definition: MooseApp.h:1217
SolutionInvalidity & createRecoverableSolutionInvalidity()
Creates a recoverable SolutionInvalidity.
Definition: MooseApp.C:2827
bool _heap_profiling
Memory profiling.
Definition: MooseApp.h:1449
const MooseMesh *const _master_displaced_mesh
The displaced mesh from master app.
Definition: MooseApp.h:1423
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies.
Definition: Attributes.h:344
Residual objects have this attribute.
Definition: Attributes.h:411
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
const ExecFlagEnum _execute_flags
Execution flags for this App.
Definition: MooseApp.h:1437
void registerRestartableDataMapName(const RestartableDataMapName &name, std::string suffix="")
Reserve a location for storing custom RestartableDataMap objects.
Definition: MooseApp.C:2790
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100
const T & getParam(const std::string &name)
Retrieve a parameter for the object.
Definition: MooseApp.h:1474
bool _distributed_mesh_on_command_line
This variable indicates that DistributedMesh should be used for the libMesh mesh underlying MooseMesh...
Definition: MooseApp.h:1227
Moose::Builder _builder
Builder for building app related parser tree.
Definition: MooseApp.h:1152
bool _test_checkpoint_half_transient
Whether or not this simulation should only run half its transient (useful for testing recovery) ...
Definition: MooseApp.h:1248
OutputWarehouse _output_warehouse
OutputWarehouse object for this App.
Definition: MooseApp.h:1146
std::streambuf * _output_buffer_cache
Cache output buffer so the language server can turn it off then back on.
Definition: MooseApp.h:1440
const std::shared_ptr< Parallel::Communicator > _comm
The MPI communicator this App is going to use.
Definition: MooseApp.h:1106
bool _cpu_profiling
CPU profiling.
Definition: MooseApp.h:1446
void registerAll(Factory &f, ActionFactory &af, Syntax &s)
Register objects that are in MOOSE.
static const std::string MESH_META_DATA_SUFFIX
Definition: MooseApp.h:91
const bool _automatic_automatic_scaling
Whether to turn on automatic scaling by default.
Definition: MooseApp.h:1443
Factory _factory
Definition: MooseApp.h:1214
std::unique_ptr< InputParameterWarehouse > _input_parameter_warehouse
Input parameter storage structure; unique_ptr so we can control its destruction order.
Definition: MooseApp.h:1137
Tracks whether the object is on the displaced mesh.
Definition: Attributes.h:481
void makedirs(const std::string &dir_name, bool throw_on_failure=false)
Recursively make directories.
Definition: MooseUtils.C:432
PerfGraphInterface(const MooseObject *moose_object)
For objects that are MooseObjects with a default prefix of type()
unsigned int _multiapp_number
Numbering in all the sub-apps on the same level.
Definition: MooseApp.h:1417
bool _ready_to_exit
Definition: MooseApp.h:1218
const MooseMesh *const _master_mesh
The mesh from master app.
Definition: MooseApp.h:1420
A scope guard that guarantees that whatever happens between when it gets created and when it is destr...
bool _split_mesh
Whether or not we are performing a split mesh operation (–split-mesh)
Definition: MooseApp.h:1236
const bool _use_executor
Indicates whether we are operating in the new/experimental executor mode instead of using the legacy ...
Definition: MooseApp.h:1192
static char addKnownLabel(const std::string &label)
addKnownLabel whitelists a label as valid for purposes of the checkLabels function.
Definition: Registry.C:82
std::unique_ptr< Backup > *const _initial_backup
The backup for use in initial setup; this will get set from the _initial_backup input parameter that ...
Definition: MooseApp.h:1464

Member Function Documentation

◆ actionWarehouse() [1/2]

ActionWarehouse& MooseApp::actionWarehouse ( )
inline

◆ actionWarehouse() [2/2]

const ActionWarehouse& MooseApp::actionWarehouse ( ) const
inline

Return a const reference to the ActionWarehouse associated with this app.

Definition at line 210 of file MooseApp.h.

210 { return _action_warehouse; }
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143

◆ addAppParam()

void MooseApp::addAppParam ( InputParameters params)
static

Definition at line 85 of file MooseApp.C.

Referenced by AppFactory::createAppShared(), and validParams().

86 {
87  params.addCommandLineParam<std::string>(
88  "app_to_run",
89  "--app <AppName>",
90  "Specify the application that should be used to run the input file. This must match an "
91  "application name registered to the application factory. Note that this option is "
92  "case-sensitive.");
93 }
void addCommandLineParam(const std::string &name, const std::string &syntax, const std::string &doc_string)

◆ addExecutor()

void MooseApp::addExecutor ( const std::string &  type,
const std::string &  name,
const InputParameters params 
)

Definition at line 1332 of file MooseApp.C.

Referenced by recursivelyCreateExecutors().

1335 {
1336  std::shared_ptr<Executor> executor = _factory.create<Executor>(type, name, params);
1337 
1338  if (_executors.count(executor->name()) > 0)
1339  mooseError("an executor with name '", executor->name(), "' already exists");
1340  _executors[executor->name()] = executor;
1341 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const 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:86
std::map< std::string, std::shared_ptr< Executor > > _executors
Pointers to all of the Executors for this run.
Definition: MooseApp.h:1179
const std::string & type() const
Get the type of this object as a string.
Definition: MooseApp.C:1050
Factory _factory
Definition: MooseApp.h:1214
The Executor class directs the execution flow of simulations.
Definition: Executor.h:26

◆ addExecutorParams()

void MooseApp::addExecutorParams ( const std::string &  type,
const std::string &  name,
const InputParameters params 
)

Adds the parameters for an Executor to the list of parameters.

This is done so that the Executors can be created in exactly the correct order.

Definition at line 1344 of file MooseApp.C.

Referenced by ReadExecutorParamsAction::act().

1347 {
1348  _executor_params[name] = std::make_pair(type, std::make_unique<InputParameters>(params));
1349 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
std::unordered_map< std::string, std::pair< std::string, std::unique_ptr< InputParameters > > > _executor_params
Used in building the Executors Maps the name of the Executor block to the <type, params> ...
Definition: MooseApp.h:1184
const std::string & type() const
Get the type of this object as a string.
Definition: MooseApp.C:1050

◆ addMeshGenerator()

void MooseApp::addMeshGenerator ( const std::string &  type,
const std::string &  name,
const InputParameters params 
)
inline

Add a mesh generator that will act on the meshes in the system.

Parameters
typeThe type of MeshGenerator
nameThe name of the MeshGenerator
paramsThe params used to construct the MeshGenerator

See MeshGeneratorSystem::addMeshGenerator()

Definition at line 849 of file MooseApp.h.

Referenced by AddMeshGeneratorAction::act(), and MeshGenerator::addMeshSubgenerator().

852  {
854  }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void addMeshGenerator(const std::string &type, const std::string &name, const InputParameters &params)
Add a mesh generator that will act on the meshes in the system.
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426
const std::string & type() const
Get the type of this object as a string.
Definition: MooseApp.C:1050

◆ addRelationshipManager()

bool MooseApp::addRelationshipManager ( std::shared_ptr< RelationshipManager relationship_manager)

Transfers ownership of a RelationshipManager to the application for lifetime management.

The RelationshipManager will NOT be duplicately added if an equivalent RelationshipManager is already active. In that case, it's possible that the object will be destroyed if the reference count drops to zero.

Definition at line 2348 of file MooseApp.C.

Referenced by AdaptivityAction::act(), SetAdaptivityOptionsAction::act(), AddPeriodicBCAction::act(), CreateDisplacedProblemAction::addProxyRelationshipManagers(), Action::addRelationshipManager(), FVFluxKernel::adjustRMGhostLayers(), and FunctorSmootherTempl< T >::FunctorSmootherTempl().

2349 {
2350  // We prefer to always add geometric RMs. There is no hurt to add RMs for replicated mesh
2351  // since MeshBase::delete_remote_elements{} is a no-op (empty) for replicated mesh.
2352  // The motivation here is that MooseMesh::_use_distributed_mesh may not be properly set
2353  // at the time we are adding geometric relationship managers. We deleted the following
2354  // old logic to add all geometric RMs regardless of there is a distributed mesh or not.
2355  // Otherwise, all geometric RMs will be improperly ignored for a distributed mesh generator.
2356 
2357  // if (!_action_warehouse.mesh()->isDistributedMesh() && !_split_mesh &&
2358  // (relationship_manager->isType(Moose::RelationshipManagerType::GEOMETRIC) &&
2359  // !(relationship_manager->isType(Moose::RelationshipManagerType::ALGEBRAIC) ||
2360  // relationship_manager->isType(Moose::RelationshipManagerType::COUPLING))))
2361  // return false;
2362 
2363  bool add = true;
2364 
2365  std::set<std::shared_ptr<RelationshipManager>> rms_to_erase;
2366 
2367  for (const auto & existing_rm : _relationship_managers)
2368  {
2369  if (*existing_rm >= *new_rm)
2370  {
2371  add = false;
2372  donateForWhom(*new_rm, *existing_rm);
2373  break;
2374  }
2375  // The new rm did not provide less or the same amount/type of ghosting as the existing rm, but
2376  // what about the other way around?
2377  else if (*new_rm >= *existing_rm)
2378  rms_to_erase.emplace(existing_rm);
2379  }
2380 
2381  if (add)
2382  {
2383  _relationship_managers.emplace(new_rm);
2384  for (const auto & rm_to_erase : rms_to_erase)
2385  {
2386  donateForWhom(*rm_to_erase, *new_rm);
2387  removeRelationshipManager(rm_to_erase);
2388  }
2389  }
2390 
2391  // Inform the caller whether the object was added or not
2392  return add;
2393 }
void removeRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Purge this relationship manager from meshes and DofMaps and finally from us.
Definition: MooseApp.C:2442
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added.
Definition: MooseApp.h:1257

◆ appBinaryName()

virtual std::string MooseApp::appBinaryName ( ) const
inlinevirtual

Definition at line 113 of file MooseApp.h.

Referenced by copyInputs(), run(), and runInputs().

114  {
116  name = name.substr(0, name.find_last_of("-"));
117  if (name.find_first_of("/") != std::string::npos)
118  name = name.substr(name.find_first_of("/") + 1, std::string::npos);
119  return name;
120  }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
std::string getExecutableName()
This function returns the name of the running executable.

◆ appendMeshGenerator()

const MeshGenerator& MooseApp::appendMeshGenerator ( const std::string &  type,
const std::string &  name,
InputParameters  params 
)
inline

Append a mesh generator that will act on the final mesh generator in the system.

Parameters
typeThe type of MeshGenerator
nameThe name of the MeshGenerator
paramsThe params used to construct the MeshGenerator

See MeshGeneratorSystem::appendMeshGenerator()

Definition at line 900 of file MooseApp.h.

901  {
903  }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
const MeshGenerator & appendMeshGenerator(const std::string &type, const std::string &name, InputParameters params)
Append a mesh generator that will act on the current final mesh generator in the system.
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426
const std::string & type() const
Get the type of this object as a string.
Definition: MooseApp.C:1050

◆ appNameToLibName()

std::string MooseApp::appNameToLibName ( const std::string &  app_name) const

Converts an application name to a library name: Examples: AnimalApp -> libanimal-oprof.la (assuming METHOD=oprof) ThreeWordAnimalApp -> libthree_word_animal-dbg.la (assuming METHOD=dbg)

Definition at line 1778 of file MooseApp.C.

Referenced by dynamicAllRegistration(), and dynamicAppRegistration().

1779 {
1780  std::string library_name(app_name);
1781 
1782  // Strip off the App part (should always be the last 3 letters of the name)
1783  size_t pos = library_name.find("App");
1784  if (pos != library_name.length() - 3)
1785  mooseError("Invalid application name: ", library_name);
1786  library_name.erase(pos);
1787 
1788  // Now get rid of the camel case, prepend lib, and append the method and suffix
1789  return std::string("lib") + MooseUtils::camelCaseToUnderscore(library_name) + '-' +
1790  QUOTE(METHOD) + ".la";
1791 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::string camelCaseToUnderscore(const std::string &camel_case_name)
Function for converting a camel case name to a name containing underscores.
Definition: MooseUtils.C:551

◆ attachRelationshipManagers() [1/2]

void MooseApp::attachRelationshipManagers ( Moose::RelationshipManagerType  rm_type,
bool  attach_geometric_rm_final = false 
)

Attach the relationship managers of the given type Note: Geometric relationship managers that are supposed to be attached late will be attached when Algebraic are attached.

Definition at line 2550 of file MooseApp.C.

Referenced by AddRelationshipManager::act(), CouplingFunctorCheckAction::act(), and MooseMesh::buildTypedMesh().

2552 {
2553  for (auto & rm : _relationship_managers)
2554  {
2555  if (!rm->isType(rm_type))
2556  continue;
2557 
2558  // RM is already attached (this also handles the geometric early case)
2559  if (_attached_relationship_managers[rm_type].count(rm.get()))
2560  continue;
2561 
2563  {
2564  // The problem is not built yet - so the ActionWarehouse currently owns the mesh
2565  MooseMesh * const mesh = _action_warehouse.mesh().get();
2566 
2567  // "attach_geometric_rm_final = true" inidicate that it is the last chance to attach
2568  // geometric RMs. Therefore, we need to attach them.
2569  if (!rm->attachGeometricEarly() && !attach_geometric_rm_final)
2570  // Will attach them later (during algebraic). But also, we need to tell the mesh that we
2571  // shouldn't be deleting remote elements yet
2572  mesh->allowRemoteElementRemoval(false);
2573  else
2574  {
2575  MeshBase & undisp_mesh_base = mesh->getMesh();
2576  const DofMap * const undisp_nl_dof_map =
2577  _executioner ? &feProblem().systemBaseNonlinear(0).dofMap() : nullptr;
2578  undisp_mesh_base.add_ghosting_functor(
2579  createRMFromTemplateAndInit(*rm, *mesh, undisp_mesh_base, undisp_nl_dof_map));
2580 
2581  // In the final stage, if there is a displaced mesh, we need to
2582  // clone ghosting functors for displacedMesh
2583  if (auto & disp_moose_mesh = _action_warehouse.displacedMesh();
2584  attach_geometric_rm_final && disp_moose_mesh)
2585  {
2586  MeshBase & disp_mesh_base = disp_moose_mesh->getMesh();
2587  const DofMap * disp_nl_dof_map = nullptr;
2588  if (_executioner && feProblem().getDisplacedProblem())
2589  disp_nl_dof_map = &feProblem().getDisplacedProblem()->systemBaseNonlinear(0).dofMap();
2590  disp_mesh_base.add_ghosting_functor(
2591  createRMFromTemplateAndInit(*rm, *disp_moose_mesh, disp_mesh_base, disp_nl_dof_map));
2592  }
2593  else if (_action_warehouse.displacedMesh())
2594  mooseError("The displaced mesh should not yet exist at the time that we are attaching "
2595  "early geometric relationship managers.");
2596 
2597  // Mark this RM as attached
2598  mooseAssert(!_attached_relationship_managers[rm_type].count(rm.get()), "Already attached");
2599  _attached_relationship_managers[rm_type].insert(rm.get());
2600  }
2601  }
2602  else // rm_type is algebraic or coupling
2603  {
2604  if (!_executioner && !_executor)
2605  mooseError("We must have an executioner by now or else we do not have to data to add "
2606  "algebraic or coupling functors to in MooseApp::attachRelationshipManagers");
2607 
2608  // Now we've built the problem, so we can use it
2609  auto & problem = feProblem();
2610  auto & undisp_moose_mesh = problem.mesh();
2611  auto & undisp_nl = problem.systemBaseNonlinear(0);
2612  auto & undisp_nl_dof_map = undisp_nl.dofMap();
2613  auto & undisp_mesh = undisp_moose_mesh.getMesh();
2614 
2615  if (rm->useDisplacedMesh() && problem.getDisplacedProblem())
2616  {
2618  // We actually need to add this to the FEProblemBase NonlinearSystemBase's DofMap
2619  // because the DisplacedProblem "nonlinear" DisplacedSystem doesn't have any matrices
2620  // for which to do coupling. It's actually horrifying to me that we are adding a
2621  // coupling functor, that is going to determine its couplings based on a displaced
2622  // MeshBase object, to a System associated with the undisplaced MeshBase object (there
2623  // is only ever one EquationSystems object per MeshBase object and visa versa). So here
2624  // I'm left with the choice of whether to pass in a MeshBase object that is *not* the
2625  // MeshBase object that will actually determine the couplings or to pass in the MeshBase
2626  // object that is inconsistent with the System DofMap that we are adding the coupling
2627  // functor for! Let's err on the side of *libMesh* consistency and pass properly paired
2628  // MeshBase-DofMap
2629  problem.addCouplingGhostingFunctor(
2630  createRMFromTemplateAndInit(*rm, undisp_moose_mesh, undisp_mesh, &undisp_nl_dof_map),
2631  /*to_mesh = */ false);
2632 
2633  else if (rm_type == Moose::RelationshipManagerType::ALGEBRAIC)
2634  {
2635  auto & displaced_problem = *problem.getDisplacedProblem();
2636  auto & disp_moose_mesh = displaced_problem.mesh();
2637  auto & disp_mesh = disp_moose_mesh.getMesh();
2638  const DofMap * const disp_nl_dof_map = &displaced_problem.systemBaseNonlinear(0).dofMap();
2639  displaced_problem.addAlgebraicGhostingFunctor(
2640  createRMFromTemplateAndInit(*rm, disp_moose_mesh, disp_mesh, disp_nl_dof_map),
2641  /*to_mesh = */ false);
2642  }
2643  }
2644  else // undisplaced
2645  {
2647  problem.addCouplingGhostingFunctor(
2648  createRMFromTemplateAndInit(*rm, undisp_moose_mesh, undisp_mesh, &undisp_nl_dof_map),
2649  /*to_mesh = */ false);
2650 
2651  else if (rm_type == Moose::RelationshipManagerType::ALGEBRAIC)
2652  problem.addAlgebraicGhostingFunctor(
2653  createRMFromTemplateAndInit(*rm, undisp_moose_mesh, undisp_mesh, &undisp_nl_dof_map),
2654  /*to_mesh = */ false);
2655  }
2656 
2657  // Mark this RM as attached
2658  mooseAssert(!_attached_relationship_managers[rm_type].count(rm.get()), "Already attached");
2659  _attached_relationship_managers[rm_type].insert(rm.get());
2660  }
2661  }
2662 }
RelationshipManager & createRMFromTemplateAndInit(const RelationshipManager &template_rm, MooseMesh &moose_mesh, MeshBase &mesh, const DofMap *dof_map=nullptr)
Take an input relationship manager, clone it, and then initialize it with provided mesh and optional ...
Definition: MooseApp.C:2484
std::map< Moose::RelationshipManagerType, std::set< const RelationshipManager * > > _attached_relationship_managers
The relationship managers that have been attached (type -> RMs)
Definition: MooseApp.h:1261
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::shared_ptr< MooseMesh > & displacedMesh()
MeshBase & mesh
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
FEProblemBase & feProblem() const
Definition: MooseApp.C:1326
std::shared_ptr< MooseMesh > & mesh()
virtual DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1131
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:1173
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
virtual const SystemBase & systemBaseNonlinear(const unsigned int sys_num) const override
Return the nonlinear system object as a base class reference given the system number.
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added.
Definition: MooseApp.h:1257
std::shared_ptr< Executor > _executor
Pointer to the Executor of this run.
Definition: MooseApp.h:1176

◆ attachRelationshipManagers() [2/2]

void MooseApp::attachRelationshipManagers ( MeshBase &  mesh,
MooseMesh moose_mesh 
)

Attach geometric relationship managers to the given MeshBase object.

This API is designed to work with MeshGenerators which are executed at the very beginning of a simulation. No attempt will be made to add relationship managers to a displaced mesh, because it doesn't exist yet.

Definition at line 2520 of file MooseApp.C.

2521 {
2522  for (auto & rm : _relationship_managers)
2523  {
2525  {
2526  if (rm->attachGeometricEarly())
2527  mesh.add_ghosting_functor(createRMFromTemplateAndInit(*rm, moose_mesh, mesh));
2528  else
2529  {
2530  // If we have a geometric ghosting functor that can't be attached early, then we have to
2531  // prevent the mesh from deleting remote elements
2532  moose_mesh.allowRemoteElementRemoval(false);
2533 
2534  if (const MeshBase * const moose_mesh_base = moose_mesh.getMeshPtr())
2535  {
2536  if (moose_mesh_base != &mesh)
2537  mooseError("The MooseMesh MeshBase and the MeshBase we're trying to attach "
2538  "relationship managers to are different");
2539  }
2540  else
2541  // The MeshBase isn't attached to the MooseMesh yet, so have to tell it not to remove
2542  // remote elements independently
2543  mesh.allow_remote_element_removal(false);
2544  }
2545  }
2546  }
2547 }
RelationshipManager & createRMFromTemplateAndInit(const RelationshipManager &template_rm, MooseMesh &moose_mesh, MeshBase &mesh, const DofMap *dof_map=nullptr)
Take an input relationship manager, clone it, and then initialize it with provided mesh and optional ...
Definition: MooseApp.C:2484
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
MeshBase & mesh
void allowRemoteElementRemoval(bool allow_removal)
Set whether to allow remote element removal.
Definition: MooseMesh.C:3663
const MeshBase * getMeshPtr() const
Definition: MooseMesh.C:3192
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added.
Definition: MooseApp.h:1257

◆ backup() [1/2]

std::vector< std::filesystem::path > MooseApp::backup ( const std::filesystem::path &  folder_base)

Backs up the application to the folder folder_base.

Returns
The files that are written in the backup

Definition at line 1214 of file MooseApp.C.

Referenced by Checkpoint::output().

1215 {
1216  TIME_SECTION("backup", 2, "Backing Up Application to File");
1217 
1218  preBackup();
1219 
1221  return writer.write(folder_base);
1222 }
Writer for restartable data, to be read by the RestartableDataReader.
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:1155
virtual void preBackup()
Insertion point for other apps that is called before backup()
Definition: MooseApp.h:742

◆ backup() [2/2]

std::unique_ptr< Backup > MooseApp::backup ( )

Backs up the application memory in a Backup.

Returns
The backup

Definition at line 1225 of file MooseApp.C.

Referenced by finalizeRestore(), and restore().

1226 {
1227  TIME_SECTION("backup", 2, "Backing Up Application");
1228 
1230 
1231  preBackup();
1232 
1233  auto backup = std::make_unique<Backup>();
1234  writer.write(*backup->header, *backup->data);
1235 
1236  return backup;
1237 }
Writer for restartable data, to be read by the RestartableDataReader.
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:1155
virtual void preBackup()
Insertion point for other apps that is called before backup()
Definition: MooseApp.h:742
std::unique_ptr< Backup > backup()
Backs up the application memory in a Backup.
Definition: MooseApp.C:1225

◆ builder()

Moose::Builder& MooseApp::builder ( )
inline

Returns a writable reference to the builder.

Definition at line 215 of file MooseApp.h.

Referenced by MeshOnlyAction::act(), SetupMeshAction::act(), and MultiApp::createLocalApp().

215 { return _builder; }
Moose::Builder _builder
Builder for building app related parser tree.
Definition: MooseApp.h:1152

◆ checkInput()

bool MooseApp::checkInput ( ) const
inline

Returns whether the Application is running in check input mode.

Definition at line 923 of file MooseApp.h.

923 { return _check_input; }
bool _check_input
true if we want to just check the input file
Definition: MooseApp.h:1254

◆ checkMetaDataIntegrity()

void MooseApp::checkMetaDataIntegrity ( ) const

Function to check the integrity of the restartable meta data structure.

Definition at line 2741 of file MooseApp.C.

Referenced by SetupRecoverFileBaseAction::act().

2742 {
2743  for (auto map_iter = _restartable_meta_data.begin(); map_iter != _restartable_meta_data.end();
2744  ++map_iter)
2745  {
2746  const RestartableDataMapName & name = map_iter->first;
2747  const RestartableDataMap & meta_data = map_iter->second.first;
2748 
2749  std::vector<std::string> not_declared;
2750 
2751  for (const auto & data : meta_data)
2752  if (!data.declared())
2753  not_declared.push_back(data.name());
2754 
2755  if (!not_declared.empty())
2756  {
2757  std::ostringstream oss;
2758  std::copy(
2759  not_declared.begin(), not_declared.end(), infix_ostream_iterator<std::string>(oss, ", "));
2760 
2761  mooseError("The following '",
2762  name,
2763  "' meta-data properties were retrieved but never declared: ",
2764  oss.str());
2765  }
2766  }
2767 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401
Storage for restartable data that is ordered based on insertion order.
std::string RestartableDataMapName
Definition: MooseTypes.h:203

◆ checkpointSuffix()

const std::string & MooseApp::checkpointSuffix ( )
static

The file suffix for the checkpoint mesh.

Definition at line 2396 of file MooseApp.C.

Referenced by SetupRecoverFileBaseAction::act(), MooseMesh::init(), and Checkpoint::output().

2397 {
2398  static const std::string suffix = "-mesh.cpr";
2399  return suffix;
2400 }

◆ commandLine()

std::shared_ptr<CommandLine> MooseApp::commandLine ( ) const
inline

Get the command line.

Returns
The reference to the command line object Setup options based on InputParameters.

Definition at line 425 of file MooseApp.h.

Referenced by FEProblemBase::addMultiApp(), Moose::Builder::build(), MultiApp::createApp(), MultiApp::createLocalApp(), Moose::Builder::errorCheck(), Moose::Builder::hitCLIFilter(), and ExodusFormatter::printInputFile().

425 { return _command_line; }
std::shared_ptr< CommandLine > _command_line
Command line object.
Definition: MooseApp.h:1130

◆ constructingMeshGenerators()

bool MooseApp::constructingMeshGenerators ( ) const
virtual

Whether this app is constructing mesh generators.

This is virtual to allow MooseUnitApp to override it so that we can construct MeshGenerators in unit tests

Definition at line 2840 of file MooseApp.C.

Referenced by MeshGenerator::addChildMeshGenerator(), MeshGeneratorSystem::addMeshGenerator(), MeshGenerator::addMeshSubgenerator(), MeshGenerator::addParentMeshGenerator(), MeshGenerator::checkGetMesh(), MeshGeneratorSystem::createMeshGenerator(), MeshGeneratorSystem::createMeshGeneratorOrder(), MeshGenerator::declareMeshProperty(), MeshGenerator::declareNullMeshName(), and MeshGeneratorSystem::getMeshGeneratorOutput().

2841 {
2842  return _action_warehouse.getCurrentTaskName() == "create_added_mesh_generators" ||
2844 }
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426
const std::string & getCurrentTaskName() const
bool appendingMeshGenerators() const
Whether or not mesh generators are currently being appended (append_mesh_generator task) ...

◆ copyInputs()

bool MooseApp::copyInputs ( ) const
private

Handles the copy_inputs input parameter logic: Checks to see whether the passed argument is valid (a readable installed directory) and recursively copies those files into a read/writable location for the user.

Returns
a Boolean value used to indicate whether the application should exit early

Definition at line 1590 of file MooseApp.C.

Referenced by run().

1591 {
1592  if (isParamValid("copy_inputs"))
1593  {
1594  // Get command line argument following --copy-inputs on command line
1595  auto dir_to_copy = getParam<std::string>("copy_inputs");
1596 
1597  if (dir_to_copy.empty())
1598  mooseError("Error retrieving directory to copy");
1599  if (dir_to_copy.back() != '/')
1600  dir_to_copy += '/';
1601 
1602  // This binary name is the actual binary. That is, if we called a symlink it'll
1603  // be the name of what the symlink points to
1604  auto binname = appBinaryName();
1605  if (binname == "")
1606  mooseError("could not locate installed tests to run (unresolved binary/app name)");
1607 
1608  auto src_dir = MooseUtils::installedInputsDir(binname,
1609  dir_to_copy,
1610  "Rerun binary with " +
1611  _pars.getCommandLineSyntax("show_inputs")[0] +
1612  " to get a list of installable directories.");
1613 
1614  // Use the command line here because if we have a symlink to another binary,
1615  // we want to dump into a directory that is named after the symlink not the true binary
1616  auto dst_dir = _command_line->getExecutableNameBase() + "/" + dir_to_copy;
1617  auto cmdname = _command_line->getExecutableName();
1618  if (cmdname.find_first_of("/") != std::string::npos)
1619  cmdname = cmdname.substr(cmdname.find_first_of("/") + 1, std::string::npos);
1620 
1621  if (MooseUtils::pathExists(dst_dir))
1622  mooseError(
1623  "The directory \"./",
1624  dst_dir,
1625  "\" already exists.\nTo update/recopy the contents of this directory, rename (\"mv ",
1626  dst_dir,
1627  " new_dir_name\") or remove (\"rm -r ",
1628  dst_dir,
1629  "\") the existing directory.\nThen re-run \"",
1630  cmdname,
1631  " --copy-inputs ",
1632  dir_to_copy,
1633  "\".");
1634 
1635  std::string cmd = "mkdir -p " + dst_dir + "; rsync -av " + src_dir + " " + dst_dir;
1636 
1637  TIME_SECTION("copy_inputs", 2, "Copying Inputs");
1638 
1639  // Only perform the copy on the root processor
1640  int return_value = 0;
1641  if (processor_id() == 0)
1642  return_value = system(cmd.c_str());
1643  _communicator.broadcast(return_value);
1644 
1645  if (WIFEXITED(return_value) && WEXITSTATUS(return_value) != 0)
1646  mooseError("Failed to copy the requested directory.");
1647  Moose::out << "Directory successfully copied into ./" << dst_dir << '\n';
1648  return true;
1649  }
1650  return false;
1651 }
const std::vector< std::string > & getCommandLineSyntax(const std::string &name) const
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::string installedInputsDir(const std::string &app_name, const std::string &dir_name, const std::string &extra_error_msg="")
Returns the directory of any installed inputs or the empty string if none are found.
Definition: MooseUtils.C:98
virtual std::string appBinaryName() const
Definition: MooseApp.h:113
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:174
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor.
Definition: MooseApp.h:418
std::shared_ptr< CommandLine > _command_line
Command line object.
Definition: MooseApp.h:1130
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100
bool pathExists(const std::string &path)
Definition: MooseUtils.C:240

◆ createExecutors()

void MooseApp::createExecutors ( )

After adding all of the Executor Params - this function will actually cause all of them to be built.

Definition at line 1411 of file MooseApp.C.

Referenced by AddExecutorAction::act().

1412 {
1413  // Do we have any?
1414  if (_executor_params.empty())
1415  return;
1416 
1417  // Holds the names of Executors that may be the root executor
1418  std::list<std::string> possibly_root;
1419 
1420  // What is already built
1421  std::map<std::string, bool> already_built;
1422 
1423  // The Executors that are currently candidates for being roots
1424  std::list<std::string> possible_roots;
1425 
1426  // The current line of dependencies - used for finding cycles
1427  std::list<std::string> current_branch;
1428 
1429  // Build the NullExecutor
1430  {
1431  auto params = _factory.getValidParams("NullExecutor");
1432  _null_executor = _factory.create<NullExecutor>("NullExecutor", "_null_executor", params);
1433  }
1434 
1435  for (const auto & params_entry : _executor_params)
1436  {
1437  const auto & name = params_entry.first;
1438 
1439  // Did we already make this one?
1440  if (_executors.find(name) != _executors.end())
1441  continue;
1442 
1443  possible_roots.emplace_back(name);
1444 
1445  recursivelyCreateExecutors(name, possible_roots, current_branch);
1446  }
1447 
1448  // If there is more than one possible root - error
1449  if (possible_roots.size() > 1)
1450  {
1451  auto root_string_it = possible_roots.begin();
1452 
1453  std::stringstream roots_string;
1454 
1455  roots_string << *root_string_it++;
1456 
1457  for (; root_string_it != possible_roots.end(); ++root_string_it)
1458  roots_string << ", " << *root_string_it;
1459 
1460  mooseError("Multiple Executor roots found: ", roots_string.str());
1461  }
1462 
1463  // Set the root executor
1464  _executor = _executors[possible_roots.front()];
1465 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
std::unordered_map< std::string, std::pair< std::string, std::unique_ptr< InputParameters > > > _executor_params
Used in building the Executors Maps the name of the Executor block to the <type, params> ...
Definition: MooseApp.h:1184
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const 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:86
void recursivelyCreateExecutors(const std::string &current_executor_name, std::list< std::string > &possible_roots, std::list< std::string > &current_branch)
Internal function used to recursively create the executor objects.
Definition: MooseApp.C:1359
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
Definition: Factory.C:67
std::map< std::string, std::shared_ptr< Executor > > _executors
Pointers to all of the Executors for this run.
Definition: MooseApp.h:1179
std::shared_ptr< NullExecutor > _null_executor
Used to return an executor that does nothing.
Definition: MooseApp.h:1195
Factory _factory
Definition: MooseApp.h:1214
std::shared_ptr< Executor > _executor
Pointer to the Executor of this run.
Definition: MooseApp.h:1176

◆ createMinimalApp()

void MooseApp::createMinimalApp ( )
private

Method for creating the minimum required actions for an application (no input file)

Mimics the following input file:

[Mesh] type = GeneratedMesh dim = 1 nx = 1 []

[Executioner] type = Transient num_steps = 1 dt = 1 []

[Problem] solve = false []

[Outputs] console = false []

Definition at line 2248 of file MooseApp.C.

Referenced by setupOptions().

2249 {
2250  TIME_SECTION("createMinimalApp", 3, "Creating Minimal App");
2251 
2252  // SetupMeshAction
2253  {
2254  // Build the Action parameters
2255  InputParameters action_params = _action_factory.getValidParams("SetupMeshAction");
2256  action_params.set<std::string>("type") = "GeneratedMesh";
2257 
2258  // Create The Action
2259  std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<MooseObjectAction>(
2260  _action_factory.create("SetupMeshAction", "Mesh", action_params));
2261 
2262  // Set the object parameters
2263  InputParameters & params = action->getObjectParams();
2264  params.set<MooseEnum>("dim") = "1";
2265  params.set<unsigned int>("nx") = 1;
2266 
2267  // Add Action to the warehouse
2269  }
2270 
2271  // Executioner
2272  {
2273  // Build the Action parameters
2274  InputParameters action_params = _action_factory.getValidParams("CreateExecutionerAction");
2275  action_params.set<std::string>("type") = "Transient";
2276 
2277  // Create the action
2278  std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<MooseObjectAction>(
2279  _action_factory.create("CreateExecutionerAction", "Executioner", action_params));
2280 
2281  // Set the object parameters
2282  InputParameters & params = action->getObjectParams();
2283  params.set<unsigned int>("num_steps") = 1;
2284  params.set<Real>("dt") = 1;
2285 
2286  // Add Action to the warehouse
2288  }
2289 
2290  // Problem
2291  {
2292  // Build the Action parameters
2293  InputParameters action_params = _action_factory.getValidParams("CreateProblemDefaultAction");
2294  action_params.set<bool>("_solve") = false;
2295 
2296  // Create the action
2297  std::shared_ptr<Action> action = std::static_pointer_cast<Action>(
2298  _action_factory.create("CreateProblemDefaultAction", "Problem", action_params));
2299 
2300  // Add Action to the warehouse
2302  }
2303 
2304  // Outputs
2305  {
2306  // Build the Action parameters
2307  InputParameters action_params = _action_factory.getValidParams("CommonOutputAction");
2308  action_params.set<bool>("console") = false;
2309 
2310  // Create action
2311  std::shared_ptr<Action> action =
2312  _action_factory.create("CommonOutputAction", "Outputs", action_params);
2313 
2314  // Add Action to the warehouse
2316  }
2317 
2319 }
InputParameters getValidParams(const std::string &name)
Definition: ActionFactory.C:76
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse.
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
Base class for actions.
Definition: Action.h:38
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters &parameters)
Definition: ActionFactory.C:39
ActionFactory _action_factory
The Factory responsible for building Actions.
Definition: MooseApp.h:1140
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void build()
Builds all auto-buildable tasks.

◆ createRecoverablePerfGraph()

PerfGraph & MooseApp::createRecoverablePerfGraph ( )
private

Creates a recoverable PerfGraph.

This is a separate method so that it can be used in the constructor (multiple calls are required to declare it).

Definition at line 2809 of file MooseApp.C.

2810 {
2812 
2813  auto perf_graph =
2814  std::make_unique<RestartableData<PerfGraph>>("perf_graph",
2815  this,
2816  type() + " (" + name() + ')',
2817  *this,
2818  getParam<bool>("perf_graph_live_all"),
2819  !getParam<bool>("disable_perf_graph_live"));
2820 
2821  return dynamic_cast<RestartableData<PerfGraph> &>(
2822  registerRestartableData(std::move(perf_graph), 0, false))
2823  .set();
2824 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void registerRestartableNameWithFilter(const std::string &name, Moose::RESTARTABLE_FILTER filter)
NOTE: This is an internal function meant for MOOSE use only!
Definition: MooseApp.C:1199
RestartableDataValue & registerRestartableData(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
Definition: MooseApp.C:1806
Concrete definition of a parameter value for a specified type.
const std::string & type() const
Get the type of this object as a string.
Definition: MooseApp.C:1050

◆ createRecoverableSolutionInvalidity()

SolutionInvalidity & MooseApp::createRecoverableSolutionInvalidity ( )
private

Creates a recoverable SolutionInvalidity.

This is a separate method so that it can be used in the constructor (multiple calls are required to declare it).

Definition at line 2827 of file MooseApp.C.

2828 {
2830 
2831  auto solution_invalidity =
2832  std::make_unique<RestartableData<SolutionInvalidity>>("solution_invalidity", nullptr, *this);
2833 
2834  return dynamic_cast<RestartableData<SolutionInvalidity> &>(
2835  registerRestartableData(std::move(solution_invalidity), 0, false))
2836  .set();
2837 }
void registerRestartableNameWithFilter(const std::string &name, Moose::RESTARTABLE_FILTER filter)
NOTE: This is an internal function meant for MOOSE use only!
Definition: MooseApp.C:1199
RestartableDataValue & registerRestartableData(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
Definition: MooseApp.C:1806
Concrete definition of a parameter value for a specified type.

◆ createRMFromTemplateAndInit()

RelationshipManager & MooseApp::createRMFromTemplateAndInit ( const RelationshipManager template_rm,
MooseMesh moose_mesh,
MeshBase &  mesh,
const DofMap *  dof_map = nullptr 
)
private

Take an input relationship manager, clone it, and then initialize it with provided mesh and optional dof_map.

Parameters
template_rmThe relationship manager template from which we will clone
moose_meshThe moose mesh to use for initialization
meshThe mesh to use for initialization
dof_mapAn optional parameter that, if provided, will be used to help init the cloned relationship manager
Returns
a reference to the cloned and initialized relationship manager

Definition at line 2484 of file MooseApp.C.

Referenced by attachRelationshipManagers().

2488 {
2489  auto & mesh_to_clone = _template_to_clones[&template_rm];
2490  auto it = mesh_to_clone.find(&mesh);
2491  if (it != mesh_to_clone.end())
2492  {
2493  // We've already created a clone for this mesh
2494  auto & clone_rm = *it->second;
2495  if (!clone_rm.dofMap() && dof_map)
2496  // We didn't have a DofMap before, but now we do, so we should re-init
2497  clone_rm.init(moose_mesh, mesh, dof_map);
2498  else if (clone_rm.dofMap() && dof_map && (clone_rm.dofMap() != dof_map))
2499  mooseError("Attempting to create and initialize an existing clone with a different DofMap. "
2500  "This should not happen.");
2501 
2502  return clone_rm;
2503  }
2504 
2505  // It's possible that this method is going to get called for multiple different MeshBase
2506  // objects. If that happens, then we *cannot* risk having a MeshBase object with a ghosting
2507  // functor that is init'd with another MeshBase object. So the safe thing to do is to make a
2508  // different RM for every MeshBase object that gets called here. Then the
2509  // RelationshipManagers stored here in MooseApp are serving as a template only
2510  auto pr = mesh_to_clone.emplace(
2511  std::make_pair(&const_cast<const MeshBase &>(mesh),
2512  dynamic_pointer_cast<RelationshipManager>(template_rm.clone())));
2513  mooseAssert(pr.second, "An insertion should have happened");
2514  auto & clone_rm = *pr.first->second;
2515  clone_rm.init(moose_mesh, mesh, dof_map);
2516  return clone_rm;
2517 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::map< const RelationshipManager *, std::map< const MeshBase *, std::unique_ptr< RelationshipManager > > > _template_to_clones
Map from a template relationship manager to a map in which the key-value pairs represent the MeshBase...
Definition: MooseApp.h:1455
virtual std::unique_ptr< GhostingFunctor > clone() const

◆ defaultAutomaticScaling()

bool MooseApp::defaultAutomaticScaling ( ) const
inline

Whether to enable automatic scaling by default.

Definition at line 1007 of file MooseApp.h.

1007 { return _automatic_automatic_scaling; }
const bool _automatic_automatic_scaling
Whether to turn on automatic scaling by default.
Definition: MooseApp.h:1443

◆ disableCheckUnusedFlag()

void MooseApp::disableCheckUnusedFlag ( )

Removes warnings and error checks for unrecognized variables in the input file.

Definition at line 1320 of file MooseApp.C.

1321 {
1323 }
enum MooseApp::UNUSED_CHECK _enable_unused_check

◆ dynamicAllRegistration()

void MooseApp::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.

This method attempts to load a dynamic library and register it when it is needed. Throws an error if no suitable library is found that contains the app_name in question.

Definition at line 1995 of file MooseApp.C.

Referenced by DynamicObjectRegistrationAction::DynamicObjectRegistrationAction().

2001 {
2002 #ifdef LIBMESH_HAVE_DLOPEN
2003  Parameters params;
2004  params.set<std::string>("app_name") = app_name;
2005  params.set<RegistrationType>("reg_type") = REGALL;
2006  params.set<std::string>("registration_method") = app_name + "__registerAll";
2007  params.set<std::string>("library_path") = library_path;
2008  params.set<std::string>("library_name") =
2009  library_name.empty() ? appNameToLibName(app_name) : library_name;
2010 
2011  params.set<Factory *>("factory") = factory;
2012  params.set<Syntax *>("syntax") = syntax;
2013  params.set<ActionFactory *>("action_factory") = action_factory;
2014  params.set<bool>("library_load_dependencies") = false;
2015 
2016  dynamicRegistration(params);
2017 #else
2018  libmesh_ignore(app_name, factory, action_factory, syntax, library_path, library_name);
2019  mooseError("Dynamic Loading is either not supported or was not detected by libMesh configure.");
2020 #endif
2021 }
Generic factory class for build all sorts of objects.
Definition: Factory.h:28
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
void dynamicRegistration(const Parameters &params)
Helper method for dynamic loading of objects.
Definition: MooseApp.C:2024
Syntax & syntax()
Returns a writable reference to the syntax object.
Definition: MooseApp.h:220
void libmesh_ignore(const Args &...)
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:50
RegistrationType
Enumeration for holding the valid types of dynamic registrations allowed.
Definition: MooseApp.h:1404
Holding syntax for parsing input files.
Definition: Syntax.h:21
std::string appNameToLibName(const std::string &app_name) const
Converts an application name to a library name: Examples: AnimalApp -> libanimal-oprof.la (assuming METHOD=oprof) ThreeWordAnimalApp -> libthree_word_animal-dbg.la (assuming METHOD=dbg)
Definition: MooseApp.C:1778

◆ dynamicAppRegistration()

void MooseApp::dynamicAppRegistration ( const std::string &  app_name,
std::string  library_path,
const std::string &  library_name,
bool  lib_load_deps 
)

Definition at line 1938 of file MooseApp.C.

Referenced by MultiApp::createApps().

1942 {
1943 #ifdef LIBMESH_HAVE_DLOPEN
1944  Parameters params;
1945  params.set<std::string>("app_name") = app_name;
1946  params.set<RegistrationType>("reg_type") = APPLICATION;
1947  params.set<std::string>("registration_method") = app_name + "__registerApps";
1948  params.set<std::string>("library_path") = library_path;
1949 
1950  const auto effective_library_name =
1951  library_name.empty() ? appNameToLibName(app_name) : library_name;
1952  params.set<std::string>("library_name") = effective_library_name;
1953  params.set<bool>("library_load_dependencies") = lib_load_deps;
1954 
1955  const auto paths = getLibrarySearchPaths(library_path);
1956  std::ostringstream oss;
1957 
1958  auto successfully_loaded = false;
1959  if (paths.empty())
1960  oss << '"' << app_name << "\" is not a registered application name.\n"
1961  << "No search paths were set. We made no attempts to locate the corresponding library "
1962  "file.\n";
1963  else
1964  {
1965  dynamicRegistration(params);
1966 
1967  // At this point the application should be registered so check it
1968  if (!AppFactory::instance().isRegistered(app_name))
1969  {
1970  oss << '"' << app_name << "\" is not a registered application name.\n"
1971  << "Unable to locate library archive for \"" << app_name
1972  << "\".\nWe attempted to locate the library archive \"" << effective_library_name
1973  << "\" in the following paths:\n\t";
1974  std::copy(paths.begin(), paths.end(), infix_ostream_iterator<std::string>(oss, "\n\t"));
1975  }
1976  else
1977  successfully_loaded = true;
1978  }
1979 
1980  if (!successfully_loaded)
1981  {
1982  oss << "\nMake sure you have compiled the library and either set the \"library_path\" "
1983  "variable in your input file or exported \"MOOSE_LIBRARY_PATH\".\n";
1984 
1985  mooseError(oss.str());
1986  }
1987 
1988 #else
1989  libmesh_ignore(app_name, library_path, library_name, lib_load_deps);
1990  mooseError("Dynamic Loading is either not supported or was not detected by libMesh configure.");
1991 #endif
1992 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
void dynamicRegistration(const Parameters &params)
Helper method for dynamic loading of objects.
Definition: MooseApp.C:2024
void libmesh_ignore(const Args &...)
RegistrationType
Enumeration for holding the valid types of dynamic registrations allowed.
Definition: MooseApp.h:1404
std::set< std::string > getLibrarySearchPaths(const std::string &library_path_from_param) const
Return the paths searched by MOOSE when loading libraries.
Definition: MooseApp.C:2198
static AppFactory & instance()
Get the instance of the AppFactory.
Definition: AppFactory.C:17
std::string appNameToLibName(const std::string &app_name) const
Converts an application name to a library name: Examples: AnimalApp -> libanimal-oprof.la (assuming METHOD=oprof) ThreeWordAnimalApp -> libthree_word_animal-dbg.la (assuming METHOD=dbg)
Definition: MooseApp.C:1778

◆ dynamicRegistration()

void MooseApp::dynamicRegistration ( const Parameters &  params)
protected

Helper method for dynamic loading of objects.

Definition at line 2024 of file MooseApp.C.

Referenced by dynamicAllRegistration(), and dynamicAppRegistration().

2025 {
2026  const auto paths = getLibrarySearchPaths(params.get<std::string>("library_path"));
2027  const auto library_name = params.get<std::string>("library_name");
2028 
2029  // Attempt to dynamically load the library
2030  for (const auto & path : paths)
2031  if (MooseUtils::checkFileReadable(path + '/' + library_name, false, false))
2033  path + '/' + library_name, params, params.get<bool>("library_load_dependencies"));
2034 }
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true, bool check_for_git_lfs_pointer=true)
Checks to see if a file is readable (exists and permissions)
Definition: MooseUtils.C:253
std::set< std::string > getLibrarySearchPaths(const std::string &library_path_from_param) const
Return the paths searched by MOOSE when loading libraries.
Definition: MooseApp.C:2198
void loadLibraryAndDependencies(const std::string &library_filename, const Parameters &params, bool load_dependencies=true)
Recursively loads libraries and dependencies in the proper order to fully register a MOOSE applicatio...
Definition: MooseApp.C:2037

◆ errorCheck()

void MooseApp::errorCheck ( )
protected

Runs post-initialization error checking that cannot be run correctly unless the simulation has been fully set up and initialized.

Definition at line 1122 of file MooseApp.C.

Referenced by executeExecutioner(), and run().

1123 {
1124  bool warn = _enable_unused_check == WARN_UNUSED;
1126 
1127  _builder.errorCheck(*_comm, warn, err);
1128 
1129  auto apps = feProblem().getMultiAppWarehouse().getObjects();
1130  for (auto app : apps)
1131  for (unsigned int i = 0; i < app->numLocalApps(); i++)
1132  app->localApp(i)->errorCheck();
1133 }
OStreamProxy err
ExecuteMooseObjectWarehouse< MultiApp > & getMultiAppWarehouse()
FEProblemBase & feProblem() const
Definition: MooseApp.C:1326
const std::vector< std::shared_ptr< T > > & getObjects(THREAD_ID tid=0) const
Retrieve complete vector to the all/block/boundary restricted objects for a given thread...
enum MooseApp::UNUSED_CHECK _enable_unused_check
Moose::Builder _builder
Builder for building app related parser tree.
Definition: MooseApp.h:1152
const std::shared_ptr< Parallel::Communicator > _comm
The MPI communicator this App is going to use.
Definition: MooseApp.h:1106
void errorCheck(const Parallel::Communicator &comm, bool warn_unused, bool err_unused)
Definition: Builder.C:500

◆ errorOnJacobianNonzeroReallocation()

virtual bool MooseApp::errorOnJacobianNonzeroReallocation ( ) const
inlinevirtual

Whether this application should by default error on Jacobian nonzero reallocations.

The application level setting can always be overridden by setting the error_on_jacobian_nonzero_reallocation parameter in the Problem block of the input file

Definition at line 1041 of file MooseApp.h.

1041 { return false; }

◆ executeExecutioner()

void MooseApp::executeExecutioner ( )
virtual

Execute the Executioner that was built.

Definition at line 1136 of file MooseApp.C.

Referenced by run().

1137 {
1138  TIME_SECTION("executeExecutioner", 3);
1139 
1140  // If ready to exit has been set, then just return
1141  if (_ready_to_exit)
1142  return;
1143 
1144  // run the simulation
1145  if (_use_executor && _executor)
1146  {
1148 
1149  _executor->init();
1150  errorCheck();
1151  auto result = _executor->exec();
1152  if (!result.convergedAll())
1153  mooseError(result.str());
1154  }
1155  else if (_executioner)
1156  {
1158  _executioner->init();
1159  errorCheck();
1160  _executioner->execute();
1161  }
1162  else
1163  mooseError("No executioner was specified (go fix your input file)");
1164 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::shared_ptr< CommandLine > _command_line
Command line object.
Definition: MooseApp.h:1130
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:1173
PetscErrorCode petscSetupOutput(CommandLine *cmd_line)
Definition: PetscSupport.C:260
bool _ready_to_exit
Definition: MooseApp.h:1218
const bool _use_executor
Indicates whether we are operating in the new/experimental executor mode instead of using the legacy ...
Definition: MooseApp.h:1192
std::shared_ptr< Executor > _executor
Pointer to the Executor of this run.
Definition: MooseApp.h:1176
void errorCheck()
Runs post-initialization error checking that cannot be run correctly unless the simulation has been f...
Definition: MooseApp.C:1122

◆ feProblem()

FEProblemBase & MooseApp::feProblem ( ) const

Definition at line 1326 of file MooseApp.C.

Referenced by attachRelationshipManagers(), MooseMesh::cacheFaceInfoVariableOwnership(), MooseMesh::cacheFVElementalDoFs(), errorCheck(), AutomaticMortarGeneration::initOutput(), removeRelationshipManager(), and setOutputFileBase().

1327 {
1328  return _executor.get() ? _executor->feProblem() : _executioner->feProblem();
1329 }
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:1173
std::shared_ptr< Executor > _executor
Pointer to the Executor of this run.
Definition: MooseApp.h:1176

◆ finalizeRestore()

std::unique_ptr< Backup > MooseApp::finalizeRestore ( )

Finalizes (closes) the restoration process done in restore().

Returns
The underlying Backup that was used to do the restoration (if any, will be null when backed up from file); can be ignored to destruct it

This releases access to the stream in which the restore was loaded from and makes it no longer possible to restore additional data.

Definition at line 1282 of file MooseApp.C.

Referenced by FEProblemBase::initialSetup().

1283 {
1284  if (!_rd_reader.isRestoring())
1285  mooseError("MooseApp::finalizeRestore(): Not currently restoring");
1286 
1287  // This gives us access to the underlying streams so that we can return it if needed
1288  auto input_streams = _rd_reader.clear();
1289 
1290  std::unique_ptr<Backup> backup;
1291 
1292  // Give them back a backup if this restore started from a Backup, in which case
1293  // the two streams in the Backup are formed into StringInputStreams
1294  if (auto header_string_input = dynamic_cast<StringInputStream *>(input_streams.header.get()))
1295  {
1296  auto data_string_input = dynamic_cast<StringInputStream *>(input_streams.data.get());
1297  mooseAssert(data_string_input, "Should also be a string input");
1298 
1299  auto header_sstream = header_string_input->release();
1300  mooseAssert(header_sstream, "Header not available");
1301 
1302  auto data_sstream = data_string_input->release();
1303  mooseAssert(data_sstream, "Data not available");
1304 
1305  backup = std::make_unique<Backup>();
1306  backup->header = std::move(header_sstream);
1307  backup->data = std::move(data_sstream);
1308  }
1309 
1310  return backup;
1311 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
RestartableDataReader _rd_reader
Definition: MooseApp.h:1428
std::unique_ptr< Backup > backup()
Backs up the application memory in a Backup.
Definition: MooseApp.C:1225
Helper class that hands out input streams to a stringstream.
InputStreams clear()
Clears the contents of the reader (header stream, data stream, header)

◆ fixedPointConfig()

FixedPointConfig& MooseApp::fixedPointConfig ( )
inline

This info is stored here because we need a "globalish" place to put it in order to allow communication between a multiapp and solver-specific internals (i.e.

relating to fixed-point inner loops like picard, etc.) for handling subapp-specific modifications necessary for those solve processes.

Definition at line 393 of file MooseApp.h.

Referenced by FixedPointSolve::FixedPointSolve().

393 { return _fixed_point_config; }
FixedPointConfig _fixed_point_config
Multiapp-related fixed point algorithm configuration details primarily intended to be passed to and u...
Definition: MooseApp.h:1188

◆ getActionFactory()

ActionFactory& MooseApp::getActionFactory ( )
inline

Retrieve a writable reference to the ActionFactory associated with this App.

Definition at line 413 of file MooseApp.h.

413 { return _action_factory; }
ActionFactory _action_factory
The Factory responsible for building Actions.
Definition: MooseApp.h:1140

◆ getCheckpointDirectories()

std::list< std::string > MooseApp::getCheckpointDirectories ( ) const

Get all checkpoint directories.

Returns
A Set of checkpoint directories

Definition at line 1720 of file MooseApp.C.

Referenced by getCheckpointFiles().

1721 {
1722  // Storage for the directory names
1723  std::list<std::string> checkpoint_dirs;
1724 
1725  // Add the directories added with Outputs/checkpoint=true input syntax
1726  checkpoint_dirs.push_back(getOutputFileBase() + "_cp");
1727 
1728  // Add the directories from any existing checkpoint output objects
1729  const auto & actions = _action_warehouse.getActionListByName("add_output");
1730  for (const auto & action : actions)
1731  {
1732  // Get the parameters from the MooseObjectAction
1733  MooseObjectAction * moose_object_action = dynamic_cast<MooseObjectAction *>(action);
1734  if (!moose_object_action)
1735  continue;
1736 
1737  const InputParameters & params = moose_object_action->getObjectParams();
1738  if (moose_object_action->getParam<std::string>("type") == "Checkpoint")
1739  {
1740  // Unless file_base was explicitly set by user, we cannot rely on it, as it will be changed
1741  // later
1742  const std::string cp_dir =
1743  _file_base_set_by_user ? params.get<std::string>("file_base")
1744  : (getOutputFileBase(true) + "_" + moose_object_action->name());
1745  checkpoint_dirs.push_back(cp_dir + "_cp");
1746  }
1747  }
1748  return checkpoint_dirs;
1749 }
bool _file_base_set_by_user
Whether or not file base is set through input or setOutputFileBase by MultiApp.
Definition: MooseApp.h:1112
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
std::string getOutputFileBase(bool for_non_moose_build_output=false) const
Get the output file base name.
Definition: MooseApp.C:1072
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
const std::list< Action * > & getActionListByName(const std::string &task) const
Retrieve a constant list of Action pointers associated with the passed in task.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:56
InputParameters & getObjectParams()
Retreive the parameters of the object to be created by this action.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.

◆ getCheckpointFiles()

std::list< std::string > MooseApp::getCheckpointFiles ( ) const

Extract all possible checkpoint file names.

Returns
A Set of checkpoint filenames

Definition at line 1752 of file MooseApp.C.

Referenced by setRestartRecoverFileBase().

1753 {
1754  auto checkpoint_dirs = getCheckpointDirectories();
1755  return MooseUtils::getFilesInDirs(checkpoint_dirs, false);
1756 }
std::list< std::string > getCheckpointDirectories() const
Get all checkpoint directories.
Definition: MooseApp.C:1720
std::list< std::string > getFilesInDirs(const std::list< std::string > &directory_list, const bool files_only=true)
Retrieves the names of all of the files contained within the list of directories passed into the rout...
Definition: MooseUtils.C:791

◆ getCommunicator()

const std::shared_ptr<Parallel::Communicator> MooseApp::getCommunicator ( ) const
inline

Definition at line 1010 of file MooseApp.h.

Referenced by MooseServer::parseDocumentForDiagnostics().

1010 { return _comm; }
const std::shared_ptr< Parallel::Communicator > _comm
The MPI communicator this App is going to use.
Definition: MooseApp.h:1106

◆ getDistributedMeshOnCommandLine()

bool MooseApp::getDistributedMeshOnCommandLine ( ) const
inline

Returns true if the user specified –distributed-mesh (or –parallel-mesh, for backwards compatibility) on the command line and false otherwise.

Definition at line 464 of file MooseApp.h.

Referenced by MooseMesh::determineUseDistributedMesh().

bool _distributed_mesh_on_command_line
This variable indicates that DistributedMesh should be used for the libMesh mesh underlying MooseMesh...
Definition: MooseApp.h:1227

◆ getExecuteOnEnum()

const ExecFlagEnum& MooseApp::getExecuteOnEnum ( ) const
inline

Return the app level ExecFlagEnum, this contains all the available flags for the app.

Definition at line 992 of file MooseApp.h.

Referenced by FEProblemBase::initialSetup(), and EigenExecutionerBase::normalizeSolution().

992 { return _execute_flags; }
const ExecFlagEnum _execute_flags
Execution flags for this App.
Definition: MooseApp.h:1437

◆ getExecutioner()

Executioner * MooseApp::getExecutioner ( ) const

◆ getExecutor() [1/2]

Executor* MooseApp::getExecutor ( ) const
inline

Definition at line 330 of file MooseApp.h.

Referenced by CheckIntegrityAction::act(), ExecutorInterface::getExecutor(), FEProblemBase::getExecutor(), and ExecutorInterface::getExecutorByName().

330 { return _executor.get(); }
std::shared_ptr< Executor > _executor
Pointer to the Executor of this run.
Definition: MooseApp.h:1176

◆ getExecutor() [2/2]

Executor & MooseApp::getExecutor ( const std::string &  name,
bool  fail_if_not_found = true 
)

Get an Executor.

Parameters
nameThe name of the Executor
fail_if_not_foundWhether or not to fail if the executor doesn't exist. If this is false then this function will return a NullExecutor

Definition at line 1468 of file MooseApp.C.

1469 {
1470  auto it = _executors.find(name);
1471 
1472  if (it != _executors.end())
1473  return *it->second;
1474 
1475  if (fail_if_not_found)
1476  mooseError("Executor not found: ", name);
1477 
1478  return *_null_executor;
1479 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
if(subdm)
std::map< std::string, std::shared_ptr< Executor > > _executors
Pointers to all of the Executors for this run.
Definition: MooseApp.h:1179
std::shared_ptr< NullExecutor > _null_executor
Used to return an executor that does nothing.
Definition: MooseApp.h:1195

◆ getExodusFileRestart()

bool MooseApp::getExodusFileRestart ( ) const
inline

Whether or not we need to use a separate Exodus reader to read the mesh BEFORE we create the mesh.

Definition at line 437 of file MooseApp.h.

Referenced by SetupMeshCompleteAction::act(), FileMesh::buildMesh(), FileMeshGenerator::generate(), and FEProblemBase::initialSetup().

437 { return _initial_from_file; }
bool _initial_from_file
This variable indicates when a request has been made to restart from an Exodus file.
Definition: MooseApp.h:1221

◆ getExReaderForRestart()

ExodusII_IO* MooseApp::getExReaderForRestart ( ) const
inline

Get the Exodus reader to restart variables from an Exodus mesh file.

Definition at line 447 of file MooseApp.h.

Referenced by FEProblemBase::checkICRestartError(), and FEProblemBase::initialSetup().

447 { return _ex_reader.get(); }
std::shared_ptr< ExodusII_IO > _ex_reader
The Exodus reader when _initial_from_file is set to true.
Definition: MooseApp.h:1224

◆ getFactory()

Factory& MooseApp::getFactory ( )
inline

◆ getFileName()

std::string MooseApp::getFileName ( bool  stripLeadingPath = true) const

Return the primary (first) filename that was parsed Note: When stripLeadingPath is false, this function returns the same name as getInputFileName() method when the input file is not a link.

Definition at line 1766 of file MooseApp.C.

Referenced by ProgressOutput::output().

1767 {
1768  return _builder.getPrimaryFileName(stripLeadingPath);
1769 }
std::string getPrimaryFileName(bool stripLeadingPath=true) const
Return the primary (first) filename that was parsed.
Definition: Builder.C:197
Moose::Builder _builder
Builder for building app related parser tree.
Definition: MooseApp.h:1152

◆ getFPTrapFlag()

bool MooseApp::getFPTrapFlag ( ) const
inline

Returns whether FPE trapping is turned on (either because of debug or user requested)

Definition at line 926 of file MooseApp.h.

926 { return _trap_fpe; }
bool _trap_fpe
Whether or not FPE trapping should be turned on.
Definition: MooseApp.h:1242

◆ getFrameworkVersion()

std::string MooseApp::getFrameworkVersion ( ) const

Returns the framework version.

Definition at line 661 of file MooseApp.C.

662 {
663  return MOOSE_VERSION;
664 }

◆ getGlobalTimeOffset()

Real MooseApp::getGlobalTimeOffset ( ) const
inline

Each App has it's own local time.

The "global" time of the whole problem might be different. This offset is how far off the local App time is from the global time.

Definition at line 307 of file MooseApp.h.

Referenced by Tecplot::output(), Nemesis::output(), Exodus::outputEmptyTimestep(), Exodus::outputNodalVariables(), and TransientMultiApp::solveStep().

307 { return _global_time_offset; }
Real _global_time_offset
Offset of the local App time to the "global" problem time.
Definition: MooseApp.h:1127

◆ getInputFileNames()

const std::vector< std::string > & MooseApp::getInputFileNames ( ) const
Returns
the input file names set in the Parser

Definition at line 1058 of file MooseApp.C.

Referenced by Console::outputInput(), and setupOptions().

1059 {
1060  mooseAssert(_parser, "Parser is not set");
1061  return _parser->getInputFileNames();
1062 }
const std::shared_ptr< Parser > _parser
Parser for parsing the input file.
Definition: MooseApp.h:1149

◆ getInputParameterWarehouse()

InputParameterWarehouse & MooseApp::getInputParameterWarehouse ( )

Get the InputParameterWarehouse for MooseObjects.

Definition at line 2224 of file MooseApp.C.

Referenced by FEProblemBase::addMaterialHelper(), MooseBaseParameterInterface::connectControllableParams(), ActionFactory::create(), Factory::create(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), ActionWarehouse::printInputFile(), and Factory::releaseSharedObjects().

2225 {
2227 }
std::unique_ptr< InputParameterWarehouse > _input_parameter_warehouse
Input parameter storage structure; unique_ptr so we can control its destruction order.
Definition: MooseApp.h:1137

◆ getInstallableInputs()

std::string MooseApp::getInstallableInputs ( ) const
privatevirtual

Method to retrieve the installable inputs from a given applications <app>Revision.h file.

Definition at line 1584 of file MooseApp.C.

Referenced by showInputs().

1585 {
1586  return "tests";
1587 }

◆ getInterfaceObjects()

template<class T >
const std::vector< T * > & MooseApp::getInterfaceObjects ( ) const

Gets the registered interface objects for a given interface.

For this to work, the interface must register itself using registerInterfaceObject.

Definition at line 1535 of file MooseApp.h.

Referenced by DeclareLateReportersAction::act(), ResolveOptionalMaterialPropertiesAction::act(), Coupleable::checkWritableVar(), PetscOutputInterface::petscLinearOutput(), PetscOutputInterface::petscNonlinearOutput(), and PetscOutput::solveSetup().

1536 {
1537  static_assert(!std::is_base_of<MooseObject, T>::value, "T is not an interface");
1538 
1539  const auto it = _interface_registry.find(typeid(T));
1540  if (it != _interface_registry.end())
1541  return static_cast<InterfaceRegistryObjects<T> *>(it->second.get())->_objects;
1542  const static std::vector<T *> empty;
1543  return empty;
1544 }
std::map< std::type_index, std::unique_ptr< InterfaceRegistryObjectsBase > > _interface_registry
Registration for interface objects.
Definition: MooseApp.h:1458

◆ getLastInputFileName()

const std::string & MooseApp::getLastInputFileName ( ) const
Returns
The last input filename set (if any)

Definition at line 1065 of file MooseApp.C.

Referenced by setupOptions().

1066 {
1067  mooseAssert(_parser, "Parser is not set");
1068  return _parser->getLastInputFileName();
1069 }
const std::shared_ptr< Parser > _parser
Parser for parsing the input file.
Definition: MooseApp.h:1149

◆ getLibrarySearchPaths()

std::set< std::string > MooseApp::getLibrarySearchPaths ( const std::string &  library_path_from_param) const

Return the paths searched by MOOSE when loading libraries.

Definition at line 2198 of file MooseApp.C.

Referenced by dynamicAppRegistration(), and dynamicRegistration().

2199 {
2200  std::set<std::string> paths;
2201 
2202  if (!library_path.empty())
2203  {
2204  std::vector<std::string> tmp_paths;
2205  MooseUtils::tokenize(library_path, tmp_paths, 1, ":");
2206 
2207  paths.insert(tmp_paths.begin(), tmp_paths.end());
2208  }
2209 
2210  char * moose_lib_path_env = std::getenv("MOOSE_LIBRARY_PATH");
2211  if (moose_lib_path_env)
2212  {
2213  std::string moose_lib_path(moose_lib_path_env);
2214  std::vector<std::string> tmp_paths;
2215  MooseUtils::tokenize(moose_lib_path, tmp_paths, 1, ":");
2216 
2217  paths.insert(tmp_paths.begin(), tmp_paths.end());
2218  }
2219 
2220  return paths;
2221 }
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:779

◆ getLoadedLibraryPaths()

std::set< std::string > MooseApp::getLoadedLibraryPaths ( ) const

Return the paths of loaded libraries.

Definition at line 2187 of file MooseApp.C.

Referenced by Factory::reportUnregisteredError().

2188 {
2189  // Return the paths but not the open file handles
2190  std::set<std::string> paths;
2191  for (const auto & it : _lib_handles)
2192  paths.insert(it.first);
2193 
2194  return paths;
2195 }
std::unordered_map< std::string, DynamicLibraryInfo > _lib_handles
The library archive (name only), registration method and the handle to the method.
Definition: MooseApp.h:1277

◆ getMeshGenerator()

const MeshGenerator& MooseApp::getMeshGenerator ( const std::string &  name) const
inline
Returns
The MeshGenerator with the name name.

Definition at line 867 of file MooseApp.h.

Referenced by MeshGenerator::generateInternal().

868  {
870  }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426
const MeshGenerator & getMeshGenerator(const std::string &name) const

◆ getMeshGeneratorMesh()

std::unique_ptr<MeshBase> MooseApp::getMeshGeneratorMesh ( )
inline
Returns
The final mesh generated by the mesh generator system

Definition at line 875 of file MooseApp.h.

876  {
878  }
std::unique_ptr< MeshBase > getSavedMesh(const std::string &name)
Get the saved mesh by name.
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426
static std::string mainMeshGeneratorName()
The name reserved for the "main" mesh generator which is the one used for the numerical solver downst...

◆ getMeshGeneratorNames()

std::vector<std::string> MooseApp::getMeshGeneratorNames ( ) const
inline
Returns
The names of all mesh generators

See MeshGeneratorSystem::getMeshGeneratorNames()

Definition at line 885 of file MooseApp.h.

Referenced by SetupMeshAction::act().

886  {
888  }
std::vector< std::string > getMeshGeneratorNames() const
Get names of all mesh generators Note: This function should be called after all mesh generators are a...
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426

◆ getMeshGeneratorSystem()

MeshGeneratorSystem& MooseApp::getMeshGeneratorSystem ( )
inline

Gets the system that manages the MeshGenerators.

Definition at line 838 of file MooseApp.h.

Referenced by ExecuteMeshGenerators::act(), SetupMeshAction::act(), CreateAddedMeshGenerators::act(), MeshGenerator::checkGetMesh(), ExtraNodesetGenerator::generate(), SideSetsFromNormalsGenerator::generate(), MeshGenerator::getMeshByName(), and MeshGenerator::MeshGenerator().

838 { return _mesh_generator_system; }
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426

◆ getNullExecutor()

NullExecutor* MooseApp::getNullExecutor ( ) const
inline

Definition at line 331 of file MooseApp.h.

Referenced by ExecutorInterface::getExecutor().

331 { return _null_executor.get(); }
std::shared_ptr< NullExecutor > _null_executor
Used to return an executor that does nothing.
Definition: MooseApp.h:1195

◆ getOutputFileBase()

std::string MooseApp::getOutputFileBase ( bool  for_non_moose_build_output = false) const

Get the output file base name.

Parameters
for_non_moose_build_outputTrue for getting the file base for outputs generated with Outputs/[outputname] input syntax.
Returns
The file base name used by output objects Note: for_non_moose_build_output does not affect the returned value when this is a subapp. for_non_moose_build_output also does not affect the returned value when Outputs/file_base parameter is available. When for_non_moose_build_output does affect the returned value, i.e. master without Outputs/file_base, the suffix _out is removed.

Definition at line 1072 of file MooseApp.C.

Referenced by getCheckpointDirectories(), OutputWarehouse::resetFileBase(), and MultiApp::setAppOutputFileBase().

1073 {
1074  if (_file_base_set_by_user || for_non_moose_build_output || _multiapp_level)
1075  return _output_file_base;
1076  else
1077  return _output_file_base + "_out";
1078 }
unsigned int _multiapp_level
Level of multiapp, the master is level 0. This used by the Console to indent output.
Definition: MooseApp.h:1414
bool _file_base_set_by_user
Whether or not file base is set through input or setOutputFileBase by MultiApp.
Definition: MooseApp.h:1112
std::string _output_file_base
The output file basename.
Definition: MooseApp.h:1109

◆ getOutputFileNumbers()

const std::map<std::string, unsigned int>& MooseApp::getOutputFileNumbers ( ) const
inline

Store a map of outputter names and file numbers The MultiApp system requires this to get the file numbering to propogate down through the multiapps.

See also
MultiApp TransientMultiApp

Definition at line 550 of file MooseApp.h.

Referenced by TransientMultiApp::setupApp().

551  {
552  return _output_file_numbers;
553  }
std::map< std::string, unsigned int > _output_file_numbers
Map of outputer name and file number (used by MultiApps to propagate file numbers down through the mu...
Definition: MooseApp.h:1251

◆ getOutputPosition()

Point MooseApp::getOutputPosition ( ) const
inline

Get the output position.

Returns
The position offset for the output.

Definition at line 277 of file MooseApp.h.

Referenced by MultiApp::createApp(), Exodus::output(), and MultiApp::parentOutputPositionChanged().

277 { return _output_position; }
Point _output_position
The output position.
Definition: MooseApp.h:1118

◆ getOutputWarehouse()

OutputWarehouse & MooseApp::getOutputWarehouse ( )

◆ getParam() [1/2]

template<typename T >
const T & MooseApp::getParam ( const std::string &  name)

Retrieve a parameter for the object.

Parameters
nameThe name of the parameter
Returns
The value of the parameter

Definition at line 1474 of file MooseApp.h.

Referenced by CommonOutputAction::act(), FEProblemBase::addOutput(), Console::Console(), MooseApp(), PerfGraphOutput::output(), SetupMeshAction::setupMesh(), and Output::setWallTimeIntervalFromCommandLineParam().

1475 {
1476  return InputParameters::getParamHelper(name, _pars, static_cast<T *>(0));
1477 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type, const MooseObject *moose_object=nullptr)
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100

◆ getParam() [2/2]

template<typename T >
const T & MooseApp::getParam ( const std::string &  name) const

Definition at line 1481 of file MooseApp.h.

1482 {
1483  return InputParameters::getParamHelper(name, _pars, static_cast<T *>(0));
1484 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type, const MooseObject *moose_object=nullptr)
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100

◆ getPrintableName()

virtual std::string MooseApp::getPrintableName ( ) const
inlinevirtual

Get printable name of the application.

Definition at line 111 of file MooseApp.h.

Referenced by getPrintableVersion().

111 { return "Application"; }

◆ getPrintableVersion()

std::string MooseApp::getPrintableVersion ( ) const

Non-virtual method for printing out the version string in a consistent format.

Definition at line 673 of file MooseApp.C.

Referenced by setupOptions().

674 {
675  return getPrintableName() + " Version: " + getVersion();
676 }
virtual std::string getPrintableName() const
Get printable name of the application.
Definition: MooseApp.h:111
virtual std::string getVersion() const
Returns the current version of the framework or application (default: framework version).
Definition: MooseApp.C:667

◆ getRecoverableData()

const DataNames& MooseApp::getRecoverableData ( ) const
inline

Return a reference to the recoverable data object.

Returns
A const reference to the recoverable data

Definition at line 724 of file MooseApp.h.

Referenced by restore().

724 { return _recoverable_data_names; }
DataNames _recoverable_data_names
Data names that will only be read from the restart file during RECOVERY.
Definition: MooseApp.h:1161

◆ getRecoverFileBase()

std::string MooseApp::getRecoverFileBase ( ) const
inline

Definition at line 499 of file MooseApp.h.

500  {
501  mooseDeprecated("MooseApp::getRecoverFileBase is deprecated, use "
502  "MooseApp::getRestartRecoverFileBase() instead.");
503  return _restart_recover_base;
504  }
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:1245
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:313

◆ getRelationshipManagerInfo()

std::vector< std::pair< std::string, std::string > > MooseApp::getRelationshipManagerInfo ( ) const

Returns the Relationship managers info suitable for printing.

Definition at line 2665 of file MooseApp.C.

Referenced by ConsoleUtils::outputRelationshipManagerInformation().

2666 {
2667  std::vector<std::pair<std::string, std::string>> info_strings;
2668  info_strings.reserve(_relationship_managers.size());
2669 
2670  for (const auto & rm : _relationship_managers)
2671  {
2672  std::stringstream oss;
2673  oss << rm->getInfo();
2674 
2675  auto & for_whom = rm->forWhom();
2676 
2677  if (!for_whom.empty())
2678  {
2679  oss << " for ";
2680 
2681  std::copy(for_whom.begin(), for_whom.end(), infix_ostream_iterator<std::string>(oss, ", "));
2682  }
2683 
2684  info_strings.emplace_back(std::make_pair(Moose::stringify(rm->getType()), oss.str()));
2685  }
2686 
2687  // List the libMesh GhostingFunctors - Not that in libMesh all of the algebraic and coupling
2688  // Ghosting Functors are also attached to the mesh. This should catch them all.
2689  const auto & mesh = _action_warehouse.getMesh();
2690  if (mesh)
2691  {
2692  // Let us use an ordered map to avoid stochastic console behaviors.
2693  // I believe we won't have many RMs, and there is no performance issue.
2694  // Deterministic behaviors are good for setting up regression tests
2695  std::map<std::string, unsigned int> counts;
2696 
2697  for (auto & gf : as_range(mesh->getMesh().ghosting_functors_begin(),
2698  mesh->getMesh().ghosting_functors_end()))
2699  {
2700  const auto * gf_ptr = dynamic_cast<const RelationshipManager *>(gf);
2701  if (!gf_ptr)
2702  // Count how many occurences of the same Ghosting Functor types we are encountering
2703  counts[demangle(typeid(*gf).name())]++;
2704  }
2705 
2706  for (const auto & pair : counts)
2707  info_strings.emplace_back(std::make_pair(
2708  "Default", pair.first + (pair.second > 1 ? " x " + std::to_string(pair.second) : "")));
2709  }
2710 
2711  // List the libMesh GhostingFunctors - Not that in libMesh all of the algebraic and coupling
2712  // Ghosting Functors are also attached to the mesh. This should catch them all.
2713  const auto & d_mesh = _action_warehouse.getDisplacedMesh();
2714  if (d_mesh)
2715  {
2716  // Let us use an ordered map to avoid stochastic console behaviors.
2717  // I believe we won't have many RMs, and there is no performance issue.
2718  // Deterministic behaviors are good for setting up regression tests
2719  std::map<std::string, unsigned int> counts;
2720 
2721  for (auto & gf : as_range(d_mesh->getMesh().ghosting_functors_begin(),
2722  d_mesh->getMesh().ghosting_functors_end()))
2723  {
2724  const auto * gf_ptr = dynamic_cast<const RelationshipManager *>(gf);
2725  if (!gf_ptr)
2726  // Count how many occurences of the same Ghosting Functor types we are encountering
2727  counts[demangle(typeid(*gf).name())]++;
2728  }
2729 
2730  for (const auto & pair : counts)
2731  info_strings.emplace_back(
2732  std::make_pair("Default",
2733  pair.first + (pair.second > 1 ? " x " + std::to_string(pair.second) : "") +
2734  " for DisplacedMesh"));
2735  }
2736 
2737  return info_strings;
2738 }
const std::shared_ptr< MooseMesh > & getMesh() const
MeshBase & mesh
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:62
std::string demangle(const char *name)
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
const std::shared_ptr< MooseMesh > & getDisplacedMesh() const
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added.
Definition: MooseApp.h:1257

◆ getReleationshipManagers()

const std::vector<std::shared_ptr<RelationshipManager> >& MooseApp::getReleationshipManagers ( )

Retrieve the relationship managers.

◆ getRenamedParam()

template<typename T >
const T & MooseApp::getRenamedParam ( const std::string &  old_name,
const std::string &  new_name 
) const

Retrieve a renamed parameter for the object.

This helper makes sure we check both names before erroring, and that only one parameter is passed to avoid silent errors

Parameters
old_namethe old name for the parameter
new_namethe new name for the parameter

Definition at line 1488 of file MooseApp.h.

1489 {
1490  // this enables having a default on the new parameter but bypassing it with the old one
1491  // Most important: accept new parameter
1492  if (isParamSetByUser(new_name) && !isParamValid(old_name))
1493  return InputParameters::getParamHelper(new_name, _pars, static_cast<T *>(0));
1494  // Second most: accept old parameter
1495  else if (isParamValid(old_name) && !isParamSetByUser(new_name))
1496  return InputParameters::getParamHelper(old_name, _pars, static_cast<T *>(0));
1497  // Third most: accept default for new parameter
1498  else if (isParamValid(new_name) && !isParamValid(old_name))
1499  return InputParameters::getParamHelper(new_name, _pars, static_cast<T *>(0));
1500  // Refuse: no default, no value passed
1501  else if (!isParamValid(old_name) && !isParamValid(new_name))
1502  mooseError(_pars.blockFullpath() + ": parameter '" + new_name +
1503  "' is being retrieved without being set.\n"
1504  "Did you mispell it?");
1505  // Refuse: both old and new parameters set by user
1506  else
1507  mooseError(_pars.blockFullpath() + ": parameter '" + new_name +
1508  "' may not be provided alongside former parameter '" + old_name + "'");
1509 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:174
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type, const MooseObject *moose_object=nullptr)
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100
std::string & blockFullpath()
Get/set a string representing the full HIT parameter path from the input file (e.g.
bool isParamSetByUser(const std::string &nm) const
Definition: MooseApp.h:176

◆ getRestartableData() [1/2]

const std::vector<RestartableDataMap>& MooseApp::getRestartableData ( ) const
inline

Return reference to the restartable data object.

Returns
A reference to the restartable data object

Definition at line 690 of file MooseApp.h.

690 { return _restartable_data; }
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:1155

◆ getRestartableData() [2/2]

std::vector<RestartableDataMap>& MooseApp::getRestartableData ( )
inline

Definition at line 691 of file MooseApp.h.

691 { return _restartable_data; }
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:1155

◆ getRestartableDataMap()

RestartableDataMap & MooseApp::getRestartableDataMap ( const RestartableDataMapName name)

Return a reference to restartable data for the specific type flag.

Definition at line 2773 of file MooseApp.C.

Referenced by getRestartableMetaData(), possiblyLoadRestartableMetaData(), and writeRestartableMetaData().

2774 {
2775  auto iter = _restartable_meta_data.find(name);
2776  if (iter == _restartable_meta_data.end())
2777  mooseError("Unable to find RestartableDataMap object for the supplied name '",
2778  name,
2779  "', did you call registerRestartableDataMapName in the application constructor?");
2780  return iter->second.first;
2781 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401

◆ getRestartableDataMapBegin()

auto MooseApp::getRestartableDataMapBegin ( )
inline

Iterator based access to the extra RestartableDataMap objects; see Checkpoint.C for use case.

These are MOOSE internal functions and should not be used otherwise.

Definition at line 1031 of file MooseApp.h.

Referenced by SetupDebugAction::act().

1031 { return _restartable_meta_data.begin(); }
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401

◆ getRestartableDataMapEnd()

auto MooseApp::getRestartableDataMapEnd ( )
inline

Definition at line 1033 of file MooseApp.h.

Referenced by SetupDebugAction::act().

1033 { return _restartable_meta_data.end(); }
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401

◆ getRestartableDataMapName()

const std::string & MooseApp::getRestartableDataMapName ( const RestartableDataMapName name) const
Returns
The output name for the restartable data with name name

Definition at line 2800 of file MooseApp.C.

Referenced by possiblyLoadRestartableMetaData(), and writeRestartableMetaData().

2801 {
2802  const auto it = _restartable_meta_data.find(name);
2803  if (it == _restartable_meta_data.end())
2804  mooseError("MooseApp::getRestartableDataMapName: The name '", name, "' is not registered");
2805  return it->second.second;
2806 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401

◆ getRestartableMetaData()

RestartableDataValue & MooseApp::getRestartableMetaData ( const std::string &  name,
const RestartableDataMapName metaname,
THREAD_ID  tid 
)

Definition at line 1868 of file MooseApp.C.

Referenced by MeshMetaDataInterface::getMeshPropertyInternal(), and MeshGenerator::setMeshPropertyHelper().

1871 {
1872  if (tid != 0)
1873  mooseError(
1874  "The meta data storage for '", metaname, "' is not threaded, so the tid must be zero.");
1875 
1876  // Get metadata reference from RestartableDataMap and return a (non-const) reference to its value
1877  auto & restartable_data_map = getRestartableDataMap(metaname);
1878  RestartableDataValue * const data = restartable_data_map.findData(name);
1879  if (!data)
1880  mooseError("Unable to find RestartableDataValue object with name " + name +
1881  " in RestartableDataMap");
1882 
1883  return *data;
1884 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
RestartableDataMap & getRestartableDataMap(const RestartableDataMapName &name)
Return a reference to restartable data for the specific type flag.
Definition: MooseApp.C:2773
Abstract definition of a RestartableData value.

◆ getRestartRecoverFileBase()

std::string MooseApp::getRestartRecoverFileBase ( ) const
inline

The file_base for the recovery file.

Definition at line 498 of file MooseApp.h.

Referenced by SetupRecoverFileBaseAction::act(), MooseMesh::init(), and FEProblemBase::initialSetup().

498 { return _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:1245

◆ getRMClone()

RelationshipManager & MooseApp::getRMClone ( const RelationshipManager template_rm,
const MeshBase &  mesh 
) const
private

Return the relationship manager clone originally created from the provided template relationship manager and mesh.

Definition at line 2427 of file MooseApp.C.

Referenced by removeRelationshipManager().

2428 {
2429  auto outer_it = _template_to_clones.find(&template_rm);
2430  if (outer_it == _template_to_clones.end())
2431  mooseError("The template rm does not exist in our _template_to_clones map");
2432 
2433  auto & mesh_to_clone_map = outer_it->second;
2434  auto inner_it = mesh_to_clone_map.find(&mesh);
2435  if (inner_it == mesh_to_clone_map.end())
2436  mooseError("We should have the mesh key in our mesh");
2437 
2438  return *inner_it->second;
2439 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::map< const RelationshipManager *, std::map< const MeshBase *, std::unique_ptr< RelationshipManager > > > _template_to_clones
Map from a template relationship manager to a map in which the key-value pairs represent the MeshBase...
Definition: MooseApp.h:1455

◆ getStartTime()

Real MooseApp::getStartTime ( ) const
inline
Returns
The start time

Definition at line 295 of file MooseApp.h.

Referenced by FEProblemBase::initialSetup(), and Transient::Transient().

295 { return _start_time; }
Real _start_time
The time at which to start the simulation.
Definition: MooseApp.h:1124

◆ getSystemInfo()

const SystemInfo* MooseApp::getSystemInfo ( ) const
inline

Get SystemInfo object.

Returns
A pointer to the SystemInformation object

Definition at line 564 of file MooseApp.h.

Referenced by ConsoleUtils::outputFrameworkInformation(), ExodusFormatter::printInputFile(), and to_json().

564 { return _sys_info.get(); }
std::unique_ptr< SystemInfo > _sys_info
System Information.
Definition: MooseApp.h:1204

◆ getVersion()

std::string MooseApp::getVersion ( ) const
virtual

Returns the current version of the framework or application (default: framework version).

Definition at line 667 of file MooseApp.C.

Referenced by getPrintableVersion().

668 {
669  return MOOSE_VERSION;
670 }

◆ halfTransient()

bool MooseApp::halfTransient ( ) const
inline

Definition at line 523 of file MooseApp.h.

524  {
525  mooseDeprecated("MooseApp::halfTransient is deprecated, use "
526  "MooseApp::testCheckpointHalfTransient instead.");
528  }
bool testCheckpointHalfTransient() const
Whether or not this simulation should only run half its transient (useful for testing recovery) ...
Definition: MooseApp.h:522
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:313

◆ hasInitialBackup()

bool MooseApp::hasInitialBackup ( ) const
inline
Returns
Whether or not this app currently has an "initial" backup

See _initial_backup and restoreFromInitialBackup() for more info.

Definition at line 999 of file MooseApp.h.

Referenced by FEProblemBase::initialSetup(), and restoreFromInitialBackup().

1000  {
1001  return _initial_backup != nullptr && *_initial_backup != nullptr;
1002  }
std::unique_ptr< Backup > *const _initial_backup
The backup for use in initial setup; this will get set from the _initial_backup input parameter that ...
Definition: MooseApp.h:1464

◆ hasMeshGenerator()

bool MooseApp::hasMeshGenerator ( const MeshGeneratorName &  name) const
inline
Returns
Whether or not a mesh generator exists with the name name.

Definition at line 859 of file MooseApp.h.

860  {
862  }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1426
bool hasMeshGenerator(const MeshGeneratorName &name) const

◆ hasOutputPosition()

bool MooseApp::hasOutputPosition ( ) const
inline

Whether or not an output position has been set.

Returns
True if it has

Definition at line 271 of file MooseApp.h.

Referenced by Exodus::output().

271 { return _output_position_set; }
bool _output_position_set
Whether or not an output position has been set for this app.
Definition: MooseApp.h:1115

◆ hasRecoverFileBase()

bool MooseApp::hasRecoverFileBase ( ) const

Definition at line 1191 of file MooseApp.C.

1192 {
1193  mooseDeprecated("MooseApp::hasRecoverFileBase is deprecated, use "
1194  "MooseApp::hasRestartRecoverFileBase() instead.");
1195  return !_restart_recover_base.empty();
1196 }
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:1245
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:313

◆ hasRelationshipManager()

bool MooseApp::hasRelationshipManager ( const std::string &  name) const

Returns a Boolean indicating whether a RelationshipManater exists with the same name.

Definition at line 2322 of file MooseApp.C.

2323 {
2324  return std::find_if(_relationship_managers.begin(),
2325  _relationship_managers.end(),
2326  [&name](const std::shared_ptr<RelationshipManager> & rm)
2327  { return rm->name() == name; }) != _relationship_managers.end();
2328 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added.
Definition: MooseApp.h:1257

◆ hasRestartableDataMap()

bool MooseApp::hasRestartableDataMap ( const RestartableDataMapName name) const
Returns
Whether or not the restartable data has the given name registered.

Definition at line 2784 of file MooseApp.C.

2785 {
2786  return _restartable_meta_data.count(name);
2787 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401

◆ hasRestartableMetaData()

bool MooseApp::hasRestartableMetaData ( const std::string &  name,
const RestartableDataMapName metaname 
) const

Definition at line 1858 of file MooseApp.C.

Referenced by MeshMetaDataInterface::hasMeshProperty().

1860 {
1861  auto it = _restartable_meta_data.find(metaname);
1862  if (it == _restartable_meta_data.end())
1863  return false;
1864  return it->second.first.hasData(name);
1865 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401

◆ hasRestartRecoverFileBase()

bool MooseApp::hasRestartRecoverFileBase ( ) const

Return true if the recovery file base is set.

Definition at line 1185 of file MooseApp.C.

1186 {
1187  return !_restart_recover_base.empty();
1188 }
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:1245

◆ hasRMClone()

bool MooseApp::hasRMClone ( const RelationshipManager template_rm,
const MeshBase &  mesh 
) const
private
Returns
whether we have created any clones for the provided template relationship manager and mesh yet. This may be false for instance when we are in the initial add relationship manager stage and haven't attempted attaching any relationship managers to the mesh or dof map yet (which is when we generate the clones). It's also maybe possible that we've created a clone of a given template_rm but not for the provided mesh so we return false in that case as well

Definition at line 2419 of file MooseApp.C.

Referenced by removeRelationshipManager().

2420 {
2421  auto it = _template_to_clones.find(&template_rm);
2422  // C++ does short circuiting so we're safe here
2423  return (it != _template_to_clones.end()) && (it->second.find(&mesh) != it->second.end());
2424 }
std::map< const RelationshipManager *, std::map< const MeshBase *, std::unique_ptr< RelationshipManager > > > _template_to_clones
Map from a template relationship manager to a map in which the key-value pairs represent the MeshBase...
Definition: MooseApp.h:1455

◆ hasStartTime()

bool MooseApp::hasStartTime ( ) const
inline
Returns
Whether or not a start time has been programmatically set using setStartTime()

Definition at line 290 of file MooseApp.h.

Referenced by FEProblemBase::initialSetup(), and Transient::Transient().

290 { return _start_time_set; }
bool _start_time_set
Whether or not an start time has been set.
Definition: MooseApp.h:1121

◆ header()

std::string MooseApp::header ( ) const
virtual

Returns a string to be printed at the beginning of a simulation.

Definition at line 2230 of file MooseApp.C.

Referenced by restore(), and setupOptions().

2231 {
2232  return std::string("");
2233 }

◆ isParamSetByUser()

bool MooseApp::isParamSetByUser ( const std::string &  nm) const
inline

Definition at line 176 of file MooseApp.h.

Referenced by getRenamedParam().

176 { return _pars.isParamSetByUser(nm); }
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was by the user.
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100

◆ isParamValid()

bool MooseApp::isParamValid ( const std::string &  name) const
inline

Definition at line 174 of file MooseApp.h.

Referenced by copyInputs(), getRenamedParam(), MooseApp(), run(), runInputFile(), runInputs(), setupOptions(), Output::setWallTimeIntervalFromCommandLineParam(), and showInputs().

174 { return _pars.isParamValid(name); }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.

◆ isRecovering()

bool MooseApp::isRecovering ( ) const

◆ isRestarting()

bool MooseApp::isRestarting ( ) const

Whether or not this is a "restart" calculation.

More specifically whether this has been restarted using the Problem/restart_file_base parameter. Note that this will only return true when doing checkpoint restart. This will be false if doing exodus restart. Finally this will never return true when isRecovering is true

Definition at line 1173 of file MooseApp.C.

Referenced by SetupMeshAction::act(), FEProblemBase::checkICRestartError(), MultiApp::createApp(), FileOutput::FileOutput(), FEProblemBase::initialSetup(), Transient::preExecute(), TimeSequenceStepperBase::setupSequence(), and TransientMultiApp::solveStep().

1174 {
1175  return _restart;
1176 }
bool _restart
Whether or not this is a restart run.
Definition: MooseApp.h:1233

◆ isSplitMesh()

bool MooseApp::isSplitMesh ( ) const

Whether or not this is a split mesh operation.

Definition at line 1179 of file MooseApp.C.

Referenced by MooseMesh::init().

1180 {
1181  return _split_mesh;
1182 }
bool _split_mesh
Whether or not we are performing a split mesh operation (–split-mesh)
Definition: MooseApp.h:1236

◆ isUltimateMaster()

bool MooseApp::isUltimateMaster ( ) const
inline

◆ libNameToAppName()

std::string MooseApp::libNameToAppName ( const std::string &  library_name) const

Converts a library name to an application name:

Definition at line 1794 of file MooseApp.C.

1795 {
1796  std::string app_name(library_name);
1797 
1798  // Strip off the leading "lib" and trailing ".la"
1799  if (pcrecpp::RE("lib(.+?)(?:-\\w+)?\\.la").Replace("\\1", &app_name) == 0)
1800  mooseError("Invalid library name: ", app_name);
1801 
1802  return MooseUtils::underscoreToCamelCase(app_name, true);
1803 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
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:563

◆ loadLibraryAndDependencies()

void MooseApp::loadLibraryAndDependencies ( const std::string &  library_filename,
const Parameters &  params,
bool  load_dependencies = true 
)
protected

Recursively loads libraries and dependencies in the proper order to fully register a MOOSE application that may have several dependencies.

REQUIRES: dynamic linking loader support.

Definition at line 2037 of file MooseApp.C.

Referenced by dynamicRegistration().

2040 {
2041  std::string line;
2042  std::string dl_lib_filename;
2043 
2044  // This RE looks for absolute path libtool filenames (i.e. begins with a slash and ends with a
2045  // .la)
2046  pcrecpp::RE re_deps("(/\\S*\\.la)");
2047 
2048  std::ifstream la_handle(library_filename.c_str());
2049  if (la_handle.is_open())
2050  {
2051  while (std::getline(la_handle, line))
2052  {
2053  // Look for the system dependent dynamic library filename to open
2054  if (line.find("dlname=") != std::string::npos)
2055  // Magic numbers are computed from length of this string "dlname=' and line minus that
2056  // string plus quotes"
2057  dl_lib_filename = line.substr(8, line.size() - 9);
2058 
2059  if (line.find("dependency_libs=") != std::string::npos)
2060  {
2061  if (load_dependencies)
2062  {
2063  pcrecpp::StringPiece input(line);
2064  pcrecpp::StringPiece depend_library;
2065  while (re_deps.FindAndConsume(&input, &depend_library))
2066  // Recurse here to load dependent libraries in depth-first order
2067  loadLibraryAndDependencies(depend_library.as_string(), params, load_dependencies);
2068  }
2069 
2070  // There's only one line in the .la file containing the dependency libs so break after
2071  // finding it
2072  break;
2073  }
2074  }
2075  la_handle.close();
2076  }
2077 
2078  // This should only occur if we have static linkage.
2079  if (dl_lib_filename.empty())
2080  return;
2081 
2082  const auto & [dir, file_name] = MooseUtils::splitFileName(library_filename);
2083 
2084  // Time to load the library, First see if we've already loaded this particular dynamic library
2085  // 1) make sure we haven't already loaded this library
2086  // AND 2) make sure we have a library name (we won't for static linkage)
2087  // Note: Here was are going to assume uniqueness based on the filename alone. This has significant
2088  // implications for applications that have "diamond" inheritance of libraries (usually
2089  // modules). We will only load one of those libraries, versions be damned.
2090  auto dyn_lib_it = _lib_handles.find(file_name);
2091  if (dyn_lib_it == _lib_handles.end())
2092  {
2093  // Assemble the actual filename using the base path of the *.la file and the dl_lib_filename
2094  const auto dl_lib_full_path = MooseUtils::pathjoin(dir, dl_lib_filename);
2095 
2096  MooseUtils::checkFileReadable(dl_lib_full_path, false, /*throw_on_unreadable=*/true);
2097 
2098 #ifdef LIBMESH_HAVE_DLOPEN
2099  void * const lib_handle = dlopen(dl_lib_full_path.c_str(), RTLD_LAZY);
2100 #else
2101  void * const lib_handle = nullptr;
2102 #endif
2103 
2104  if (!lib_handle)
2105  mooseError("The library file \"",
2106  dl_lib_full_path,
2107  "\" exists and has proper permissions, but cannot by dynamically loaded.\nThis "
2108  "generally means that the loader was unable to load one or more of the "
2109  "dependencies listed in the supplied library (see otool or ldd).\n",
2110  dlerror());
2111 
2112  DynamicLibraryInfo lib_info;
2113  lib_info.library_handle = lib_handle;
2114  lib_info.full_path = library_filename;
2115 
2116  auto insert_ret = _lib_handles.insert(std::make_pair(file_name, lib_info));
2117  mooseAssert(insert_ret.second == true, "Error inserting into lib_handles map");
2118 
2119  dyn_lib_it = insert_ret.first;
2120  }
2121 
2122  // Library has been loaded, check to see if we've called the requested registration method
2123  const auto registration_method = params.get<std::string>("registration_method");
2124  auto & entry_sym_from_curr_lib = dyn_lib_it->second.entry_symbols;
2125 
2126  if (entry_sym_from_curr_lib.find(registration_method) == entry_sym_from_curr_lib.end())
2127  {
2128  // get the pointer to the method in the library. The dlsym()
2129  // function returns a null pointer if the symbol cannot be found,
2130  // we also explicitly set the pointer to NULL if dlsym is not
2131  // available.
2132 #ifdef LIBMESH_HAVE_DLOPEN
2133  void * registration_handle =
2134  dlsym(dyn_lib_it->second.library_handle, registration_method.c_str());
2135 #else
2136  void * registration_handle = nullptr;
2137 #endif
2138 
2139  if (registration_handle)
2140  {
2141  switch (params.get<RegistrationType>("reg_type"))
2142  {
2143  case APPLICATION:
2144  {
2145  using register_app_t = void (*)();
2146  register_app_t * const reg_ptr = reinterpret_cast<register_app_t *>(&registration_handle);
2147  (*reg_ptr)();
2148  break;
2149  }
2150  case REGALL:
2151  {
2152  using register_app_t = void (*)(Factory *, ActionFactory *, Syntax *);
2153  register_app_t * const reg_ptr = reinterpret_cast<register_app_t *>(&registration_handle);
2154  (*reg_ptr)(params.get<Factory *>("factory"),
2155  params.get<ActionFactory *>("action_factory"),
2156  params.get<Syntax *>("syntax"));
2157  break;
2158  }
2159  default:
2160  mooseError("Unhandled RegistrationType");
2161  }
2162 
2163  entry_sym_from_curr_lib.insert(registration_method);
2164  }
2165  else
2166  {
2167 
2168 #if defined(DEBUG) && defined(LIBMESH_HAVE_DLOPEN)
2169  // We found a dynamic library that doesn't have a dynamic
2170  // registration method in it. This shouldn't be an error, so
2171  // we'll just move on.
2172  if (!registration_handle)
2173  mooseWarning("Unable to find extern \"C\" method \"",
2174  registration_method,
2175  "\" in library: ",
2176  dyn_lib_it->first,
2177  ".\n",
2178  "This doesn't necessarily indicate an error condition unless you believe that "
2179  "the method should exist in that library.\n",
2180  dlerror());
2181 #endif
2182  }
2183  }
2184 }
Generic factory class for build all sorts of objects.
Definition: Factory.h:28
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:296
std::pair< std::filesystem::path, std::filesystem::path > splitFileName(const T &full_file)
Function for splitting path and filename.
Definition: MooseUtils.h:231
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:50
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true, bool check_for_git_lfs_pointer=true)
Checks to see if a file is readable (exists and permissions)
Definition: MooseUtils.C:253
RegistrationType
Enumeration for holding the valid types of dynamic registrations allowed.
Definition: MooseApp.h:1404
std::unordered_map< std::string, DynamicLibraryInfo > _lib_handles
The library archive (name only), registration method and the handle to the method.
Definition: MooseApp.h:1277
std::filesystem::path pathjoin(const std::filesystem::path &p)
Definition: MooseUtils.C:58
Holding syntax for parsing input files.
Definition: Syntax.h:21
class infix_ostream_iterator if void
Definition: InfixIterator.h:26
void loadLibraryAndDependencies(const std::string &library_filename, const Parameters &params, bool load_dependencies=true)
Recursively loads libraries and dependencies in the proper order to fully register a MOOSE applicatio...
Definition: MooseApp.C:2037

◆ loadRestartableMetaData()

void MooseApp::loadRestartableMetaData ( const std::filesystem::path &  folder_base)

Loads all available restartable meta data if it is available with the folder base folder_base.

Definition at line 1902 of file MooseApp.C.

Referenced by SetupRecoverFileBaseAction::act().

1903 {
1904  for (const auto & name_map_pair : _restartable_meta_data)
1905  possiblyLoadRestartableMetaData(name_map_pair.first, folder_base);
1906 }
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401
void possiblyLoadRestartableMetaData(const RestartableDataMapName &name, const std::filesystem::path &folder_base)
Loads the restartable meta data for name if it is available with the folder base folder_base.
Definition: MooseApp.C:1887

◆ masterDisplacedMesh()

const MooseMesh* MooseApp::masterDisplacedMesh ( ) const
inline

Returns a pointer to the master displaced mesh.

Definition at line 833 of file MooseApp.h.

Referenced by SetupMeshAction::act().

833 { return _master_displaced_mesh; }
const MooseMesh *const _master_displaced_mesh
The displaced mesh from master app.
Definition: MooseApp.h:1423

◆ masterMesh()

const MooseMesh* MooseApp::masterMesh ( ) const
inline

Returns a pointer to the master mesh.

Definition at line 828 of file MooseApp.h.

Referenced by ExecuteMeshGenerators::act(), SetupMeshCompleteAction::act(), and SetupMeshAction::act().

828 { return _master_mesh; }
const MooseMesh *const _master_mesh
The mesh from master app.
Definition: MooseApp.h:1420

◆ metaDataFolderBase()

std::filesystem::path MooseApp::metaDataFolderBase ( const std::filesystem::path &  folder_base,
const std::string &  map_suffix 
)
static

The file suffix for meta data (header and data)

Definition at line 2403 of file MooseApp.C.

Referenced by possiblyLoadRestartableMetaData(), and writeRestartableMetaData().

2405 {
2406  return RestartableDataIO::restartableDataFolder(folder_base /
2407  std::filesystem::path("meta_data" + map_suffix));
2408 }
static std::filesystem::path restartableDataFolder(const std::filesystem::path &folder_base)

◆ multiAppLevel()

unsigned int MooseApp::multiAppLevel ( ) const
inline

The MultiApp Level.

Returns
The current number of levels from the master app

Definition at line 812 of file MooseApp.h.

Referenced by FEProblemBase::checkNonlinearConvergence(), MultiApp::createApp(), OutputWarehouse::mooseConsole(), setupOptions(), and Console::write().

812 { return _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:1414

◆ multiAppNumber()

unsigned int MooseApp::multiAppNumber ( ) const
inline

The MultiApp number.

Returns
The numbering in all the sub-apps on the same level

Definition at line 818 of file MooseApp.h.

Referenced by FileOutput::FileOutput(), and Console::outputSystemInformation().

818 { return _multiapp_number; }
unsigned int _multiapp_number
Numbering in all the sub-apps on the same level.
Definition: MooseApp.h:1417

◆ name()

const std::string& MooseApp::name ( ) const
inline

◆ parameters()

InputParameters& MooseApp::parameters ( )
inline

Get the parameters of the object.

Returns
The parameters of the object

Definition at line 126 of file MooseApp.h.

Referenced by MeshOnlyAction::act(), SplitMeshAction::act(), MeshGeneratorSystem::hasDataDrivenAllowed(), MooseApp(), ConsoleUtils::outputLegacyInformation(), and MooseServer::parseDocumentForDiagnostics().

126 { return _pars; }
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100

◆ parser()

Moose::Builder & MooseApp::parser ( )

Deprecated helper function to link the new added Builder back to Parser.

This function will be removed after new Parser and builder are merged

Definition at line 1352 of file MooseApp.C.

1353 {
1354  mooseDeprecated("MooseApp::parser() is deprecated, use MooseApp::builder() instead.");
1355  return _builder;
1356 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:313
Moose::Builder _builder
Builder for building app related parser tree.
Definition: MooseApp.h:1152

◆ perfGraph()

PerfGraph& MooseApp::perfGraph ( )
inline

Get the PerfGraph for this app.

Definition at line 144 of file MooseApp.h.

Referenced by PerfGraphInterface::perfGraph().

144 { return _perf_graph; }
PerfGraph & _perf_graph
The PerfGraph object for this application (recoverable)
Definition: MooseApp.h:1164

◆ possiblyLoadRestartableMetaData()

void MooseApp::possiblyLoadRestartableMetaData ( const RestartableDataMapName name,
const std::filesystem::path &  folder_base 
)

Loads the restartable meta data for name if it is available with the folder base folder_base.

Definition at line 1887 of file MooseApp.C.

Referenced by FileMesh::buildMesh(), FileMeshGenerator::generate(), and loadRestartableMetaData().

1889 {
1890  const auto & map_name = getRestartableDataMapName(name);
1891  const auto meta_data_folder_base = metaDataFolderBase(folder_base, map_name);
1892  if (RestartableDataReader::isAvailable(meta_data_folder_base))
1893  {
1895  reader.setErrorOnLoadWithDifferentNumberOfProcessors(false);
1896  reader.setInput(meta_data_folder_base);
1897  reader.restore();
1898  }
1899 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
Reader for restartable data written by the RestartableDataWriter.
static std::filesystem::path metaDataFolderBase(const std::filesystem::path &folder_base, const std::string &map_suffix)
The file suffix for meta data (header and data)
Definition: MooseApp.C:2403
RestartableDataMap & getRestartableDataMap(const RestartableDataMapName &name)
Return a reference to restartable data for the specific type flag.
Definition: MooseApp.C:2773
const std::string & getRestartableDataMapName(const RestartableDataMapName &name) const
Definition: MooseApp.C:2800
static bool isAvailable(const std::filesystem::path &folder_base)

◆ postRestore()

virtual void MooseApp::postRestore ( const bool  )
inlinevirtual

Insertion point for other apps that is called after restore()

Parameters
for_restartWhether this restoration is explicitly for the first restoration of restart data

Definition at line 776 of file MooseApp.h.

Referenced by restore().

776 {}

◆ preBackup()

virtual void MooseApp::preBackup ( )
inlinevirtual

Insertion point for other apps that is called before backup()

Definition at line 742 of file MooseApp.h.

Referenced by backup().

742 {}

◆ processor_id()

processor_id_type MooseApp::processor_id ( ) const
inline

Returns the MPI processor ID of the current processor.

Definition at line 418 of file MooseApp.h.

Referenced by copyInputs(), MooseApp(), restartFolderBase(), runInputs(), FileOutput::setFileBaseInternal(), and writeRestartableMetaData().

418 { return _comm->rank(); }
const std::shared_ptr< Parallel::Communicator > _comm
The MPI communicator this App is going to use.
Definition: MooseApp.h:1106

◆ rankMap()

const RankMap& MooseApp::rankMap ( )
inline

The RankMap is a useful object for determining how the processes are laid out on the physical nodes of the cluster.

Definition at line 139 of file MooseApp.h.

139 { return _rank_map; }
const RankMap _rank_map
The RankMap is a useful object for determining how the processes are laid out on the physical hardwar...
Definition: MooseApp.h:1170

◆ recursivelyCreateExecutors()

void MooseApp::recursivelyCreateExecutors ( const std::string &  current_executor_name,
std::list< std::string > &  possible_roots,
std::list< std::string > &  current_branch 
)
private

Internal function used to recursively create the executor objects.

Called by createExecutors

Parameters
current_executor_nameThe name of the executor currently needing to be built
possible_rootsThe names of executors that are currently candidates for being the root

Definition at line 1359 of file MooseApp.C.

Referenced by createExecutors().

1362 {
1363  // Did we already make this one?
1364  if (_executors.find(current_executor_name) != _executors.end())
1365  return;
1366 
1367  // Is this one already on the current branch (i.e. there is a cycle)
1368  if (std::find(current_branch.begin(), current_branch.end(), current_executor_name) !=
1369  current_branch.end())
1370  {
1371  std::stringstream exec_names_string;
1372 
1373  auto branch_it = current_branch.begin();
1374 
1375  exec_names_string << *branch_it++;
1376 
1377  for (; branch_it != current_branch.end(); ++branch_it)
1378  exec_names_string << ", " << *branch_it;
1379 
1380  exec_names_string << ", " << current_executor_name;
1381 
1382  mooseError("Executor cycle detected: ", exec_names_string.str());
1383  }
1384 
1385  current_branch.push_back(current_executor_name);
1386 
1387  // Build the dependencies first
1388  const auto & params = *_executor_params[current_executor_name].second;
1389 
1390  for (const auto & param : params)
1391  {
1392  if (params.have_parameter<ExecutorName>(param.first))
1393  {
1394  const auto & dependency_name = params.get<ExecutorName>(param.first);
1395 
1396  possible_roots.remove(dependency_name);
1397 
1398  if (!dependency_name.empty())
1399  recursivelyCreateExecutors(dependency_name, possible_roots, current_branch);
1400  }
1401  }
1402 
1403  // Add this Executor
1404  const auto & type = _executor_params[current_executor_name].first;
1405  addExecutor(type, current_executor_name, params);
1406 
1407  current_branch.pop_back();
1408 }
std::unordered_map< std::string, std::pair< std::string, std::unique_ptr< InputParameters > > > _executor_params
Used in building the Executors Maps the name of the Executor block to the <type, params> ...
Definition: MooseApp.h:1184
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
void recursivelyCreateExecutors(const std::string &current_executor_name, std::list< std::string > &possible_roots, std::list< std::string > &current_branch)
Internal function used to recursively create the executor objects.
Definition: MooseApp.C:1359
std::map< std::string, std::shared_ptr< Executor > > _executors
Pointers to all of the Executors for this run.
Definition: MooseApp.h:1179
void addExecutor(const std::string &type, const std::string &name, const InputParameters &params)
Definition: MooseApp.C:1332
const std::string & type() const
Get the type of this object as a string.
Definition: MooseApp.C:1050

◆ registerInterfaceObject()

template<class T >
void MooseApp::registerInterfaceObject ( T &  interface)

Registers an interface object for accessing with getInterfaceObjects.

This should be called within the constructor of the interface in interest.

Definition at line 1513 of file MooseApp.h.

Referenced by Coupleable::Coupleable(), MaterialPropertyInterface::MaterialPropertyInterface(), PetscOutputInterface::PetscOutputInterface(), and Reporter::Reporter().

1514 {
1515  static_assert(!std::is_base_of<MooseObject, T>::value, "T is not an interface");
1516 
1517  InterfaceRegistryObjects<T> * registry = nullptr;
1518  auto it = _interface_registry.find(typeid(T));
1519  if (it == _interface_registry.end())
1520  {
1521  auto new_registry = std::make_unique<InterfaceRegistryObjects<T>>();
1522  registry = new_registry.get();
1523  _interface_registry.emplace(typeid(T), std::move(new_registry));
1524  }
1525  else
1526  registry = static_cast<InterfaceRegistryObjects<T> *>(it->second.get());
1527 
1528  mooseAssert(std::count(registry->_objects.begin(), registry->_objects.end(), &interface) == 0,
1529  "Interface already registered");
1530  registry->_objects.push_back(&interface);
1531 }
std::map< std::type_index, std::unique_ptr< InterfaceRegistryObjectsBase > > _interface_registry
Registration for interface objects.
Definition: MooseApp.h:1458

◆ registerRestartableData() [1/2]

RestartableDataValue & MooseApp::registerRestartableData ( std::unique_ptr< RestartableDataValue data,
THREAD_ID  tid,
bool  read_only,
const RestartableDataMapName metaname = "" 
)

Definition at line 1806 of file MooseApp.C.

Referenced by createRecoverablePerfGraph(), createRecoverableSolutionInvalidity(), MeshGenerator::declareMeshProperty(), ReporterData::getRestartableDataHelper(), and Restartable::registerRestartableDataOnApp().

1810 {
1811  if (!metaname.empty() && tid != 0)
1812  mooseError(
1813  "The meta data storage for '", metaname, "' is not threaded, so the tid must be zero.");
1814 
1815  mooseAssert(metaname.empty() ||
1816  _restartable_meta_data.find(metaname) != _restartable_meta_data.end(),
1817  "The desired meta data name does not exist: " + metaname);
1818 
1819  // Select the data store for saving this piece of restartable data (mesh or everything else)
1820  auto & data_map =
1821  metaname.empty() ? _restartable_data[tid] : _restartable_meta_data[metaname].first;
1822 
1823  RestartableDataValue * stored_data = data_map.findData(data->name());
1824  if (stored_data)
1825  {
1826  if (data->typeId() != stored_data->typeId())
1827  mooseError("Type mismatch found in RestartableData registration of '",
1828  data->name(),
1829  "'\n\n Stored type: ",
1830  stored_data->type(),
1831  "\n New type: ",
1832  data->type());
1833  }
1834  else
1835  stored_data = &data_map.addData(std::move(data));
1836 
1837  if (!read_only)
1838  stored_data->setDeclared({});
1839 
1840  return *stored_data;
1841 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401
virtual const std::type_info & typeId() const =0
The type ID of the underlying data.
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:1155
virtual std::string type() const =0
String identifying the type of parameter stored.
void setDeclared(const SetDeclaredKey)
Sets that this restartable value has been declared.
Abstract definition of a RestartableData value.

◆ registerRestartableData() [2/2]

RestartableDataValue& MooseApp::registerRestartableData ( const std::string &  name,
std::unique_ptr< RestartableDataValue data,
THREAD_ID  tid,
bool  read_only,
const RestartableDataMapName metaname = "" 
)

◆ registerRestartableDataMapName()

void MooseApp::registerRestartableDataMapName ( const RestartableDataMapName name,
std::string  suffix = "" 
)

Reserve a location for storing custom RestartableDataMap objects.

This should be called in the constructor of an application.

Parameters
nameA key to use for accessing the data object
suffixThe suffix to use when appending to checkpoint output, if not supplied the given name is used to generate the suffix (MyMetaData -> _mymetadata)

Definition at line 2790 of file MooseApp.C.

Referenced by MooseApp().

2791 {
2792  if (!suffix.empty())
2793  std::transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);
2794  suffix.insert(0, "_");
2795  _restartable_meta_data.emplace(
2796  std::make_pair(name, std::make_pair(RestartableDataMap(), suffix)));
2797 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401
Storage for restartable data that is ordered based on insertion order.

◆ registerRestartableNameWithFilter()

void MooseApp::registerRestartableNameWithFilter ( const std::string &  name,
Moose::RESTARTABLE_FILTER  filter 
)
protected

NOTE: This is an internal function meant for MOOSE use only!

Register a piece of restartable data that will be used in a filter in/out during deserialization. Note however that this data will always be written to the restart file.

Parameters
nameThe full (unique) name.
filterThe filter name where to direct the name

Definition at line 1199 of file MooseApp.C.

Referenced by createRecoverablePerfGraph(), createRecoverableSolutionInvalidity(), and Restartable::registerRestartableNameWithFilterOnApp().

1201 {
1203  switch (filter)
1204  {
1205  case RESTARTABLE_FILTER::RECOVERABLE:
1206  _recoverable_data_names.insert(name);
1207  break;
1208  default:
1209  mooseError("Unknown filter");
1210  }
1211 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
RESTARTABLE_FILTER
The filter type applied to a particular piece of "restartable" data.
Definition: MooseTypes.h:704
DataNames _recoverable_data_names
Data names that will only be read from the restart file during RECOVERY.
Definition: MooseApp.h:1161

◆ registerTimedSection() [1/2]

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level 
) const
protectedinherited

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
Returns
The ID of the section - use when starting timing

Definition at line 53 of file PerfGraphInterface.C.

55 {
56  const auto timed_section_name = timedSectionName(section_name);
57  if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
58  return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
59  else
60  return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
61 }
PerfID registerSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
std::string timedSectionName(const std::string &section_name) const
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID The name of the section.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ registerTimedSection() [2/2]

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level,
const std::string &  live_message,
const bool  print_dots = true 
) const
protectedinherited

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
live_messageThe message to be printed to the screen during execution
print_dotsWhether or not progress dots should be printed for this section
Returns
The ID of the section - use when starting timing

Definition at line 64 of file PerfGraphInterface.C.

68 {
69  const auto timed_section_name = timedSectionName(section_name);
70  if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
72  timedSectionName(section_name), level, live_message, print_dots);
73  else
74  return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
75 }
PerfID registerSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
std::string timedSectionName(const std::string &section_name) const
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID The name of the section.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ relationshipManagers()

const std::set<std::shared_ptr<RelationshipManager> >& MooseApp::relationshipManagers ( ) const
inline

Return the container of relationship managers.

Definition at line 1015 of file MooseApp.h.

Referenced by NumRelationshipManagers::getValue().

1016  {
1017  return _relationship_managers;
1018  }
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added.
Definition: MooseApp.h:1257

◆ removeRelationshipManager()

void MooseApp::removeRelationshipManager ( std::shared_ptr< RelationshipManager relationship_manager)
private

Purge this relationship manager from meshes and DofMaps and finally from us.

This method is private because only this object knows when we should remove relationship managers: when we are adding relationship managers to this object's storage, we perform an operator>= comparison between our existing RMs and the RM we are trying to add. If any comparison returns true, we do not add the new RM because the comparison indicates that we would gain no new coverage. However, if no comparison return true, then we add the new RM and we turn the comparison around! Consequently if our new RM is >= than any of our preexisting RMs, we remove those preexisting RMs using this method

Definition at line 2442 of file MooseApp.C.

Referenced by addRelationshipManager().

2443 {
2444  auto * const mesh = _action_warehouse.mesh().get();
2445  if (!mesh)
2446  mooseError("The MooseMesh should exist");
2447 
2448  const MeshBase * const undisp_lm_mesh = mesh->getMeshPtr();
2449  RelationshipManager * undisp_clone = nullptr;
2450  if (undisp_lm_mesh && hasRMClone(*rm, *undisp_lm_mesh))
2451  {
2452  undisp_clone = &getRMClone(*rm, *undisp_lm_mesh);
2453  const_cast<MeshBase *>(undisp_lm_mesh)->remove_ghosting_functor(*undisp_clone);
2454  }
2455 
2456  auto & displaced_mesh = _action_warehouse.displacedMesh();
2457  MeshBase * const disp_lm_mesh = displaced_mesh ? &displaced_mesh->getMesh() : nullptr;
2458  RelationshipManager * disp_clone = nullptr;
2459  if (disp_lm_mesh && hasRMClone(*rm, *disp_lm_mesh))
2460  {
2461  disp_clone = &getRMClone(*rm, *disp_lm_mesh);
2462  disp_lm_mesh->remove_ghosting_functor(*disp_clone);
2463  }
2464 
2465  if (_executioner)
2466  {
2467  auto & problem = feProblem();
2468  if (undisp_clone)
2469  {
2470  problem.removeAlgebraicGhostingFunctor(*undisp_clone);
2471  problem.removeCouplingGhostingFunctor(*undisp_clone);
2472  }
2473 
2474  auto * dp = problem.getDisplacedProblem().get();
2475  if (dp && disp_clone)
2476  dp->removeAlgebraicGhostingFunctor(*disp_clone);
2477  }
2478 
2480  _relationship_managers.erase(rm);
2481 }
bool hasRMClone(const RelationshipManager &template_rm, const MeshBase &mesh) const
Definition: MooseApp.C:2419
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::shared_ptr< MooseMesh > & displacedMesh()
RelationshipManager & getRMClone(const RelationshipManager &template_rm, const MeshBase &mesh) const
Return the relationship manager clone originally created from the provided template relationship mana...
Definition: MooseApp.C:2427
MeshBase & mesh
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
FEProblemBase & feProblem() const
Definition: MooseApp.C:1326
std::shared_ptr< MooseMesh > & mesh()
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:1173
void releaseSharedObjects(const MooseObject &moose_object, THREAD_ID tid=0)
Releases any shared resources created as a side effect of creating an object through the Factory::cre...
Definition: Factory.C:164
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added.
Definition: MooseApp.h:1257
Factory _factory
Definition: MooseApp.h:1214

◆ restartFolderBase()

std::filesystem::path MooseApp::restartFolderBase ( const std::filesystem::path &  folder_base) const

The file suffix for restartable data.

Definition at line 2411 of file MooseApp.C.

Referenced by FEProblemBase::initialSetup(), and Checkpoint::output().

2412 {
2413  auto folder = folder_base;
2414  folder += "-restart-" + std::to_string(processor_id());
2416 }
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor.
Definition: MooseApp.h:418
static std::filesystem::path restartableDataFolder(const std::filesystem::path &folder_base)

◆ restore() [1/2]

void MooseApp::restore ( const std::filesystem::path &  folder_base,
const bool  for_restart 
)

Restore an application from file.

Parameters
folder_baseThe backup folder base
for_restartWhether this restoration is explicitly for the first restoration of restart data

You must call finalizeRestore() after this in order to finalize the restoration. The restore process is kept open in order to restore additional data after the initial restore (that is, the restoration of data that has already been declared).

Definition at line 1240 of file MooseApp.C.

Referenced by FEProblemBase::initialSetup(), and restoreFromInitialBackup().

1241 {
1242  TIME_SECTION("restore", 2, "Restoring Application from File");
1243 
1244  const DataNames filter_names = for_restart ? getRecoverableData() : DataNames{};
1245 
1246  _rd_reader.setInput(folder_base);
1247  _rd_reader.restore(filter_names);
1248 
1249  postRestore(for_restart);
1250 }
void setInput(std::unique_ptr< std::stringstream > header_stream, std::unique_ptr< std::stringstream > data_stream)
Sets the input stream for reading from the stringstreams header_stream and data_stream for the header...
RestartableDataReader _rd_reader
Definition: MooseApp.h:1428
virtual void postRestore(const bool)
Insertion point for other apps that is called after restore()
Definition: MooseApp.h:776
std::unordered_set< std::string > DataNames
void restore(const DataNames &filter_names={})
Restores the restartable data.
const DataNames & getRecoverableData() const
Return a reference to the recoverable data object.
Definition: MooseApp.h:724

◆ restore() [2/2]

void MooseApp::restore ( std::unique_ptr< Backup backup,
const bool  for_restart 
)

Restore an application from the backup backup.

Parameters
backupThe backup
for_restartWhether this restoration is explicitly for the first restoration of restart data

You must call finalizeRestore() after this in order to finalize the restoration. The restore process is kept open in order to restore additional data after the initial restore (that is, the restoration of data that has already been declared).

Definition at line 1253 of file MooseApp.C.

1254 {
1255  TIME_SECTION("restore", 2, "Restoring Application");
1256 
1257  const DataNames filter_names = for_restart ? getRecoverableData() : DataNames{};
1258 
1259  if (!backup)
1260  mooseError("MooseApp::resore(): Provided backup is not initialized");
1261 
1262  auto header = std::move(backup->header);
1263  mooseAssert(header, "Header not available");
1264 
1265  auto data = std::move(backup->data);
1266  mooseAssert(data, "Data not available");
1267 
1268  _rd_reader.setInput(std::move(header), std::move(data));
1269  _rd_reader.restore(filter_names);
1270 
1271  postRestore(for_restart);
1272 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
void setInput(std::unique_ptr< std::stringstream > header_stream, std::unique_ptr< std::stringstream > data_stream)
Sets the input stream for reading from the stringstreams header_stream and data_stream for the header...
RestartableDataReader _rd_reader
Definition: MooseApp.h:1428
virtual void postRestore(const bool)
Insertion point for other apps that is called after restore()
Definition: MooseApp.h:776
std::unique_ptr< Backup > backup()
Backs up the application memory in a Backup.
Definition: MooseApp.C:1225
virtual std::string header() const
Returns a string to be printed at the beginning of a simulation.
Definition: MooseApp.C:2230
std::unordered_set< std::string > DataNames
void restore(const DataNames &filter_names={})
Restores the restartable data.
const DataNames & getRecoverableData() const
Return a reference to the recoverable data object.
Definition: MooseApp.h:724

◆ restoreFromInitialBackup()

void MooseApp::restoreFromInitialBackup ( const bool  for_restart)

Restores from a "initial" backup, that is, one set in _initial_backup.

Parameters
for_restartWhether this restoration is explicitly for the first restoration of restart data

This is only used for restoration of multiapp subapps, which have been given a Backup from their parent on initialization. Said Backup is passed to this app via the "_initial_backup" private input parameter.

See restore() for more information

Definition at line 1275 of file MooseApp.C.

Referenced by FEProblemBase::initialSetup().

1276 {
1277  mooseAssert(hasInitialBackup(), "Missing initial backup");
1278  restore(std::move(*_initial_backup), for_restart);
1279 }
bool hasInitialBackup() const
Definition: MooseApp.h:999
void restore(const std::filesystem::path &folder_base, const bool for_restart)
Restore an application from file.
Definition: MooseApp.C:1240
std::unique_ptr< Backup > *const _initial_backup
The backup for use in initial setup; this will get set from the _initial_backup input parameter that ...
Definition: MooseApp.h:1464

◆ run()

void MooseApp::run ( )
virtual

Run the application.

Definition at line 1494 of file MooseApp.C.

1495 {
1496  TIME_SECTION("run", 3);
1497  if (isParamValid("show_docs") && getParam<bool>("show_docs"))
1498  {
1499  auto binname = appBinaryName();
1500  if (binname == "")
1501  mooseError("could not locate installed tests to run (unresolved binary/app name)");
1502  auto docspath = MooseUtils::docsDir(binname);
1503  if (docspath == "")
1504  mooseError("no installed documentation found");
1505 
1506  auto docmsgfile = MooseUtils::pathjoin(docspath, "docmsg.txt");
1507  std::string docmsg = "file://" + MooseUtils::realpath(docspath) + "/index.html";
1508  if (MooseUtils::pathExists(docmsgfile) && MooseUtils::checkFileReadable(docmsgfile))
1509  {
1510  std::ifstream ifs(docmsgfile);
1511  std::string content((std::istreambuf_iterator<char>(ifs)),
1512  (std::istreambuf_iterator<char>()));
1513  content.replace(content.find("$LOCAL_SITE_HOME"), content.length(), docmsg);
1514  docmsg = content;
1515  }
1516 
1517  Moose::out << docmsg << "\n";
1518  _ready_to_exit = true;
1519  return;
1520  }
1521 
1522  if (showInputs() || copyInputs() || runInputs())
1523  {
1524  _ready_to_exit = true;
1525  return;
1526  }
1527 
1528  try
1529  {
1530  TIME_SECTION("setup", 2, "Setting Up");
1531  setupOptions();
1532  runInputFile();
1533  }
1534  catch (std::exception & err)
1535  {
1536  mooseError(err.what());
1537  }
1538 
1539  if (!_check_input)
1540  {
1541  TIME_SECTION("execute", 2, "Executing");
1543  }
1544  else
1545  {
1546  errorCheck();
1547  // Output to stderr, so it is easier for peacock to get the result
1548  Moose::err << "Syntax OK" << std::endl;
1549  }
1550 }
OStreamProxy err
std::string docsDir(const std::string &app_name)
Returns the directory of any installed docs/site.
Definition: MooseUtils.C:120
virtual void setupOptions()
Setup options based on InputParameters.
Definition: MooseApp.C:679
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual std::string appBinaryName() const
Definition: MooseApp.h:113
bool _check_input
true if we want to just check the input file
Definition: MooseApp.h:1254
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:174
std::string realpath(const std::string &path)
Wrapper around PetscGetRealPath, which is a cross-platform replacement for realpath.
Definition: MooseUtils.C:1217
bool copyInputs() const
Handles the copy_inputs input parameter logic: Checks to see whether the passed argument is valid (a ...
Definition: MooseApp.C:1590
bool showInputs() const
Prints a message showing the installable inputs for a given application (if getInstallableInputs has ...
Definition: MooseApp.C:1553
bool runInputs() const
Handles the run input parameter logic: Checks to see whether a directory exists in user space and lau...
Definition: MooseApp.C:1654
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true, bool check_for_git_lfs_pointer=true)
Checks to see if a file is readable (exists and permissions)
Definition: MooseUtils.C:253
std::filesystem::path pathjoin(const std::filesystem::path &p)
Definition: MooseUtils.C:58
virtual void executeExecutioner()
Execute the Executioner that was built.
Definition: MooseApp.C:1136
virtual void runInputFile()
Actually build everything in the input file.
Definition: MooseApp.C:1097
bool pathExists(const std::string &path)
Definition: MooseUtils.C:240
bool _ready_to_exit
Definition: MooseApp.h:1218
void errorCheck()
Runs post-initialization error checking that cannot be run correctly unless the simulation has been f...
Definition: MooseApp.C:1122

◆ runInputFile()

void MooseApp::runInputFile ( )
virtual

Actually build everything in the input file.

Definition at line 1097 of file MooseApp.C.

Referenced by run().

1098 {
1099  TIME_SECTION("runInputFile", 3);
1100 
1101  // If ready to exit has been set, then just return
1102  if (_ready_to_exit)
1103  return;
1104 
1106 
1107  if (isParamValid("mesh_only") || isParamValid("split_mesh"))
1108  _ready_to_exit = true;
1109  else if (getParam<bool>("list_constructed_objects"))
1110  {
1111  // TODO: ask multiapps for their constructed objects
1112  _ready_to_exit = true;
1113  std::vector<std::string> obj_list = _factory.getConstructedObjects();
1114  Moose::out << "**START OBJECT DATA**\n";
1115  for (const auto & name : obj_list)
1116  Moose::out << name << "\n";
1117  Moose::out << "**END OBJECT DATA**\n" << std::endl;
1118  }
1119 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:174
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
std::vector< std::string > getConstructedObjects() const
Get a list of all constructed Moose Object types.
Definition: Factory.C:282
Factory _factory
Definition: MooseApp.h:1214
void executeAllActions()
This method loops over all actions in the warehouse and executes them.
bool _ready_to_exit
Definition: MooseApp.h:1218

◆ runInputs()

bool MooseApp::runInputs ( ) const
private

Handles the run input parameter logic: Checks to see whether a directory exists in user space and launches the TestHarness to process the given directory.

Returns
a Boolean value used to indicate whether the application should exit early

Definition at line 1654 of file MooseApp.C.

Referenced by run().

1655 {
1656  if (isParamValid("run"))
1657  {
1658  // Here we are going to pass everything after --run on the cli to the TestHarness. That means
1659  // cannot validate these CLIs.
1660  auto it = _command_line->find("run");
1661 
1662  std::string test_args;
1663  if (it != _command_line->end())
1664  {
1665  // Preincrement here to skip over --run
1666  while (++it != _command_line->end())
1667  test_args += " " + *it;
1668  }
1669 
1670  auto cmd = MooseUtils::runTestsExecutable() + test_args;
1671  auto working_dir = MooseUtils::getCurrentWorkingDir();
1672 
1673  if (MooseUtils::findTestRoot() == "")
1674  {
1675  auto bin_name = appBinaryName();
1676  if (bin_name == "")
1677  mooseError("Could not locate binary name relative to installed location");
1678 
1679  auto cmd_name = Moose::getExecutableName();
1680  mooseError(
1681  "Could not locate installed tests from the current working directory:",
1682  working_dir,
1683  ".\nMake sure you are executing this command from within a writable installed inputs ",
1684  "directory.\nRun \"",
1685  cmd_name,
1686  " --copy-inputs <dir>\" to copy the contents of <dir> to a \"./",
1687  bin_name,
1688  "_<dir>\" directory.\nChange into that directory and try \"",
1689  cmd_name,
1690  " --run <dir>\" again.");
1691  }
1692 
1693  // Only launch the tests on the root processor
1694  Moose::out << "Working Directory: " << working_dir << "\nRunning Command: " << cmd << std::endl;
1695  int return_value = 0;
1696  if (processor_id() == 0)
1697  return_value = system(cmd.c_str());
1698  _communicator.broadcast(return_value);
1699 
1700  if (WIFEXITED(return_value) && WEXITSTATUS(return_value) != 0)
1701  mooseError("Run failed");
1702  return true;
1703  }
1704 
1705  return false;
1706 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual std::string appBinaryName() const
Definition: MooseApp.h:113
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:174
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor.
Definition: MooseApp.h:418
std::shared_ptr< CommandLine > _command_line
Command line object.
Definition: MooseApp.h:1130
std::string runTestsExecutable()
Returns the location of either a local repo run_tests script - or an installed test executor script i...
Definition: MooseUtils.C:64
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
std::string getCurrentWorkingDir()
Returns the current working directory as a string.
Definition: MooseUtils.C:419
std::string getExecutableName()
This function returns the name of the running executable.
std::string findTestRoot()
Searches in the current working directory and then recursively up in each parent directory looking fo...
Definition: MooseUtils.C:74

◆ setCheckUnusedFlag()

void MooseApp::setCheckUnusedFlag ( bool  warn_is_error = false)
private

Set a flag so that the parser will either warn or error when unused variables are seen after parsing is complete.

Definition at line 1314 of file MooseApp.C.

Referenced by setupOptions().

1315 {
1316  _enable_unused_check = warn_is_error ? ERROR_UNUSED : WARN_UNUSED;
1317 }
enum MooseApp::UNUSED_CHECK _enable_unused_check

◆ setErrorOverridden()

void MooseApp::setErrorOverridden ( )

Set a flag so that the parser will throw an error if overridden parameters are detected.

Definition at line 1488 of file MooseApp.C.

Referenced by setupOptions().

1489 {
1490  _error_overridden = true;
1491 }
bool _error_overridden
Indicates whether warnings or errors are displayed when overridden parameters are detected...
Definition: MooseApp.h:1217

◆ setExecutioner()

void MooseApp::setExecutioner ( std::shared_ptr< Executioner > &&  executioner)
inline

Set the Executioner for this App.

Definition at line 338 of file MooseApp.h.

Referenced by CreateExecutionerAction::act().

338 { _executioner = executioner; }
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:1173

◆ setExecutor()

void MooseApp::setExecutor ( std::shared_ptr< Executor > &&  executor)
inline

Definition at line 339 of file MooseApp.h.

339 { _executor = executor; }
std::shared_ptr< Executor > _executor
Pointer to the Executor of this run.
Definition: MooseApp.h:1176

◆ setExodusFileRestart()

void MooseApp::setExodusFileRestart ( bool  flag)
inline

Set the flag to indicate whether or not we need to use a separate Exodus reader to read the mesh BEFORE we create the mesh.

Definition at line 431 of file MooseApp.h.

Referenced by CopyNodalVarsAction::act(), and PhysicsBase::prepareCopyNodalVariables().

431 { _initial_from_file = flag; }
bool _initial_from_file
This variable indicates when a request has been made to restart from an Exodus file.
Definition: MooseApp.h:1221

◆ setExReaderForRestart()

void MooseApp::setExReaderForRestart ( std::shared_ptr< ExodusII_IO > &&  exreader)
inline

Set the Exodus reader to restart variables from an Exodus mesh file.

Definition at line 442 of file MooseApp.h.

Referenced by FileMesh::buildMesh(), and FileMeshGenerator::generate().

442 { _ex_reader = exreader; }
std::shared_ptr< ExodusII_IO > _ex_reader
The Exodus reader when _initial_from_file is set to true.
Definition: MooseApp.h:1224

◆ setGlobalTimeOffset()

void MooseApp::setGlobalTimeOffset ( Real  offset)
inline

Each App has it's own local time.

The "global" time of the whole problem might be different. This offset is how far off the local App time is from the global time.

Definition at line 301 of file MooseApp.h.

301 { _global_time_offset = offset; }
Real _global_time_offset
Offset of the local App time to the "global" problem time.
Definition: MooseApp.h:1127

◆ setOutputFileBase()

void MooseApp::setOutputFileBase ( const std::string &  output_file_base)

Override the selection of the output file base name.

Note: This method is supposed to be called by MultiApp only.

Definition at line 1081 of file MooseApp.C.

1082 {
1083  _output_file_base = output_file_base;
1084 
1085  // Reset the file base in the outputs
1087 
1088  // Reset the file base in multiapps (if they have been constructed yet)
1089  if (getExecutioner())
1090  for (auto & multi_app : feProblem().getMultiAppWarehouse().getObjects())
1091  multi_app->setAppOutputFileBase();
1092 
1093  _file_base_set_by_user = true;
1094 }
bool _file_base_set_by_user
Whether or not file base is set through input or setOutputFileBase by MultiApp.
Definition: MooseApp.h:1112
FEProblemBase & feProblem() const
Definition: MooseApp.C:1326
void resetFileBase()
Resets the file base for all FileOutput objects.
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition: MooseApp.C:1482
OutputWarehouse _output_warehouse
OutputWarehouse object for this App.
Definition: MooseApp.h:1146
std::string _output_file_base
The output file basename.
Definition: MooseApp.h:1109

◆ setOutputFileNumbers()

void MooseApp::setOutputFileNumbers ( const std::map< std::string, unsigned int > &  numbers)
inline

Store a map of outputter names and file numbers The MultiApp system requires this to get the file numbering to propagate down through the Multiapps.

Parameters
numbersMap of outputter names and file numbers
See also
MultiApp TransientMultiApp OutputWarehouse

Definition at line 538 of file MooseApp.h.

539  {
540  _output_file_numbers = numbers;
541  }
std::map< std::string, unsigned int > _output_file_numbers
Map of outputer name and file number (used by MultiApps to propagate file numbers down through the mu...
Definition: MooseApp.h:1251

◆ setOutputPosition()

void MooseApp::setOutputPosition ( const Point &  p)

Tell the app to output in a specific position.

Definition at line 1709 of file MooseApp.C.

1710 {
1711  _output_position_set = true;
1712  _output_position = p;
1714 
1715  if (_executioner.get())
1716  _executioner->parentOutputPositionChanged();
1717 }
bool _output_position_set
Whether or not an output position has been set for this app.
Definition: MooseApp.h:1115
void meshChanged()
Calls the meshChanged method for every output object.
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:1173
Point _output_position
The output position.
Definition: MooseApp.h:1118
OutputWarehouse _output_warehouse
OutputWarehouse object for this App.
Definition: MooseApp.h:1146

◆ setRecover()

void MooseApp::setRecover ( bool  value)

Definition at line 2242 of file MooseApp.C.

2243 {
2244  _recover = value;
2245 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
bool _recover
Whether or not this is a recovery run.
Definition: MooseApp.h:1230

◆ setRestart()

void MooseApp::setRestart ( bool  value)

Sets the restart/recover flags.

Parameters
stateThe state to set the flag to

Definition at line 2236 of file MooseApp.C.

Referenced by FEProblemBase::setRestartFile().

2237 {
2238  _restart = value;
2239 }
bool _restart
Whether or not this is a restart run.
Definition: MooseApp.h:1233
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)

◆ setRestartRecoverFileBase()

void MooseApp::setRestartRecoverFileBase ( const std::string &  file_base)
inline

mutator for recover_base (set by RecoverBaseAction)

Definition at line 510 of file MooseApp.h.

Referenced by SetupRecoverFileBaseAction::act(), and FEProblemBase::setRestartFile().

511  {
512  if (file_base.empty())
514  else
515  _restart_recover_base = file_base;
516  }
std::list< std::string > getCheckpointFiles() const
Extract all possible checkpoint file names.
Definition: MooseApp.C:1752
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:1245
std::string getLatestCheckpointFilePrefix(const std::list< std::string > &checkpoint_files)
Returns the most recent checkpoint prefix (the four numbers at the begining) If a suitable file isn&#39;t...
Definition: MooseUtils.C:802

◆ setStartTime()

void MooseApp::setStartTime ( Real  time)

Set the starting time for the simulation.

This will override any choice made in the input file.

Parameters
timeThe start time for the simulation.

Definition at line 1759 of file MooseApp.C.

Referenced by EigenExecutionerBase::EigenExecutionerBase(), and Transient::Transient().

1760 {
1761  _start_time_set = true;
1762  _start_time = time;
1763 }
Real _start_time
The time at which to start the simulation.
Definition: MooseApp.h:1124
bool _start_time_set
Whether or not an start time has been set.
Definition: MooseApp.h:1121

◆ setupOptions()

void MooseApp::setupOptions ( )
virtual

Setup options based on InputParameters.

Definition at line 679 of file MooseApp.C.

Referenced by run().

680 {
681  TIME_SECTION("setupOptions", 5, "Setting Up Options");
682 
683  // Print the header, this is as early as possible
684  auto hdr = header();
685  if (hdr.length() != 0)
686  {
687  if (multiAppLevel() > 0)
689  Moose::out << hdr << std::endl;
690  }
691 
692  if (getParam<bool>("error_unused"))
693  setCheckUnusedFlag(true);
694  else if (getParam<bool>("allow_unused"))
695  setCheckUnusedFlag(false);
696 
697  if (getParam<bool>("error_override"))
699 
700  _distributed_mesh_on_command_line = getParam<bool>("distributed_mesh");
701 
702  _test_checkpoint_half_transient = getParam<bool>("test_checkpoint_half_transient");
703 
704  if (isParamValid("output_wall_time_interval"))
705  {
706  const auto output_wall_time_interval = getParam<Real>("output_wall_time_interval");
707  if (output_wall_time_interval <= 0)
708  mooseError("--output-wall-time-interval must be greater than zero.");
709  }
710 
711  // The no_timing flag takes precedence over the timing flag.
712  if (getParam<bool>("no_timing"))
713  {
714  _pars.set<bool>("timing") = false;
715 
716  _perf_graph.setActive(false);
717  }
718 
719  if (isParamValid("trap_fpe") && isParamValid("no_trap_fpe"))
720  mooseError("Cannot use both \"--trap-fpe\" and \"--no-trap-fpe\" flags.");
721  if (isParamValid("trap_fpe"))
722  _trap_fpe = true;
723  else if (isParamValid("no_trap_fpe"))
724  _trap_fpe = false;
725 
726  // Turn all warnings in MOOSE to errors (almost see next logic block)
727  Moose::_warnings_are_errors = getParam<bool>("error");
728 
729  // Deprecated messages can be toggled to errors independently from everything else.
730  Moose::_deprecated_is_error = getParam<bool>("error_deprecated");
731 
732  if (isUltimateMaster()) // makes sure coloring isn't reset incorrectly in multi-app settings
733  {
734  // Toggle the color console off
735  Moose::setColorConsole(true, true); // set default color condition
736  if (getParam<bool>("no_color"))
737  Moose::setColorConsole(false);
738 
739  char * c_color = std::getenv("MOOSE_COLOR");
740  std::string color = "on";
741  if (c_color)
742  color = c_color;
743  if (getParam<std::string>("color") != "default-on")
744  color = getParam<std::string>("color");
745 
746  if (color == "auto")
748  else if (color == "on")
749  Moose::setColorConsole(true, true);
750  else if (color == "off")
751  Moose::setColorConsole(false);
752  else
753  mooseWarning("ignoring invalid --color arg (want 'auto', 'on', or 'off')");
754  }
755 
756  // this warning goes below --color processing to honor that setting for
757  // the warning. And below settings for warnings/error setup.
758  if (getParam<bool>("no_color"))
759  mooseDeprecated("The --no-color flag is deprecated. Use '--color off' instead.");
760 
761 // If there's no threading model active, but the user asked for
762 // --n-threads > 1 on the command line, throw a mooseError. This is
763 // intended to prevent situations where the user has potentially
764 // built MOOSE incorrectly (neither TBB nor pthreads found) and is
765 // asking for multiple threads, not knowing that there will never be
766 // any threads launched.
767 #if !LIBMESH_USING_THREADS
768  if (libMesh::command_line_value("--n-threads", 1) > 1)
769  mooseError("You specified --n-threads > 1, but there is no threading model active!");
770 #endif
771 
772  // Build a minimal running application, ignoring the input file.
773  if (getParam<bool>("minimal"))
775 
776  else if (getParam<bool>("display_version"))
777  {
778  Moose::out << getPrintableVersion() << std::endl;
779  _ready_to_exit = true;
780  return;
781  }
782  else if (getParam<bool>("help"))
783  {
784  _command_line->printUsage();
785  _ready_to_exit = true;
786  }
787  else if (isParamValid("dump"))
788  {
789  // Get command line argument following --dump on command line
790  std::string following_arg = getParam<std::string>("dump");
791 
792  // The argument following --dump is a parameter search string,
793  // which can be empty.
794  std::string param_search;
795  if (!following_arg.empty() && (following_arg.find('-') != 0))
796  param_search = following_arg;
797 
798  JsonSyntaxTree tree(param_search);
799 
800  {
801  TIME_SECTION("dump", 1, "Building Syntax Tree");
803  }
804 
805  // Turn off live printing so that it doesn't mess with the dump
807 
808  JsonInputFileFormatter formatter;
809  Moose::out << "\n### START DUMP DATA ###\n"
810  << formatter.toString(tree.getRoot()) << "\n### END DUMP DATA ###" << std::endl;
811  _ready_to_exit = true;
812  }
813  else if (isParamValid("registry"))
814  {
816 
817  Moose::out << "Label\tType\tName\tClass\tFile\n";
818 
819  auto & objmap = Registry::allObjects();
820  for (auto & entry : objmap)
821  for (auto & obj : entry.second)
822  Moose::out << entry.first << "\tobject\t" << obj->name() << "\t" << obj->_classname << "\t"
823  << obj->_file << "\n";
824 
825  auto & actmap = Registry::allActions();
826  for (auto & entry : actmap)
827  {
828  for (auto & act : entry.second)
829  Moose::out << entry.first << "\taction\t" << act->_name << "\t" << act->_classname << "\t"
830  << act->_file << "\n";
831  }
832 
833  _ready_to_exit = true;
834  }
835  else if (isParamValid("registry_hit"))
836  {
838 
839  Moose::out << "### START REGISTRY DATA ###\n";
840 
841  hit::Section root("");
842  auto sec = new hit::Section("registry");
843  root.addChild(sec);
844  auto objsec = new hit::Section("objects");
845  sec->addChild(objsec);
846 
847  auto & objmap = Registry::allObjects();
848  for (auto & entry : objmap)
849  for (auto & obj : entry.second)
850  {
851  auto ent = new hit::Section("entry");
852  objsec->addChild(ent);
853  ent->addChild(new hit::Field("label", hit::Field::Kind::String, entry.first));
854  ent->addChild(new hit::Field("type", hit::Field::Kind::String, "object"));
855  ent->addChild(new hit::Field("name", hit::Field::Kind::String, obj->name()));
856  ent->addChild(new hit::Field("class", hit::Field::Kind::String, obj->_classname));
857  ent->addChild(new hit::Field("file", hit::Field::Kind::String, obj->_file));
858  }
859 
860  auto actsec = new hit::Section("actions");
861  sec->addChild(actsec);
862  auto & actmap = Registry::allActions();
863  for (auto & entry : actmap)
864  for (auto & act : entry.second)
865  {
866  auto ent = new hit::Section("entry");
867  actsec->addChild(ent);
868  ent->addChild(new hit::Field("label", hit::Field::Kind::String, entry.first));
869  ent->addChild(new hit::Field("type", hit::Field::Kind::String, "action"));
870  ent->addChild(new hit::Field("task", hit::Field::Kind::String, act->_name));
871  ent->addChild(new hit::Field("class", hit::Field::Kind::String, act->_classname));
872  ent->addChild(new hit::Field("file", hit::Field::Kind::String, act->_file));
873  }
874 
875  Moose::out << root.render();
876 
877  Moose::out << "\n### END REGISTRY DATA ###\n";
878  _ready_to_exit = true;
879  }
880  else if (isParamValid("definition"))
881  {
883 
884  JsonSyntaxTree tree("");
886  SONDefinitionFormatter formatter;
887  Moose::out << "%-START-SON-DEFINITION-%\n"
888  << formatter.toString(tree.getRoot()) << "\n%-END-SON-DEFINITION-%\n";
889  _ready_to_exit = true;
890  }
891  else if (isParamValid("yaml"))
892  {
894 
896 
897  // Get command line argument following --yaml on command line
898  std::string yaml_following_arg = getParam<std::string>("yaml");
899 
900  // If the argument following --yaml is non-existent or begins with
901  // a dash, call buildFullTree() with an empty string, otherwise
902  // pass the argument following --yaml.
903  if (yaml_following_arg.empty() || (yaml_following_arg.find('-') == 0))
905  else
906  _builder.buildFullTree(yaml_following_arg);
907 
908  _ready_to_exit = true;
909  }
910  else if (isParamValid("json"))
911  {
913 
914  // Get command line argument following --json on command line
915  std::string json_following_arg = getParam<std::string>("json");
916 
917  // The argument following --json is a parameter search string,
918  // which can be empty.
919  std::string search;
920  if (!json_following_arg.empty() && (json_following_arg.find('-') != 0))
921  search = json_following_arg;
922 
923  JsonSyntaxTree tree(search);
925 
926  Moose::out << "**START JSON DATA**\n" << tree.getRoot().dump(2) << "\n**END JSON DATA**\n";
927  _ready_to_exit = true;
928  }
929  else if (getParam<bool>("syntax"))
930  {
932 
933  std::multimap<std::string, Syntax::ActionInfo> syntax = _syntax.getAssociatedActions();
934  Moose::out << "**START SYNTAX DATA**\n";
935  for (const auto & it : syntax)
936  Moose::out << it.first << "\n";
937  Moose::out << "**END SYNTAX DATA**\n" << std::endl;
938  _ready_to_exit = true;
939  }
940  else if (getParam<bool>("apptype"))
941  {
943 
944  Moose::out << "MooseApp Type: " << type() << std::endl;
945  _ready_to_exit = true;
946  }
947  else if (getInputFileNames().size())
948  {
949  if (isParamValid("recover"))
950  {
951  // We need to set the flag manually here since the recover parameter is a string type (takes
952  // an optional filename)
953  _recover = true;
954 
955  // Get command line argument following --recover on command line
956  std::string recover_following_arg = getParam<std::string>("recover");
957 
958  // If the argument following --recover is non-existent or begins with
959  // a dash then we are going to eventually find the newest recovery file to use
960  if (!(recover_following_arg.empty() || (recover_following_arg.find('-') == 0)))
961  _restart_recover_base = recover_following_arg;
962  }
963 
964  // In the event that we've parsed once before already in MooseMain, we
965  // won't need to parse again
966  if (!_parser->root())
967  _parser->parse();
968 
969  _builder.build();
970 
971  if (isParamValid("mesh_only"))
972  {
973  _syntax.registerTaskName("mesh_only", true);
974  _syntax.addDependency("mesh_only", "setup_mesh_complete");
975  _syntax.addDependency("determine_system_type", "mesh_only");
976  _action_warehouse.setFinalTask("mesh_only");
977  }
978  else if (isParamValid("split_mesh"))
979  {
980  _split_mesh = true;
981  _syntax.registerTaskName("split_mesh", true);
982  _syntax.addDependency("split_mesh", "setup_mesh_complete");
983  _syntax.addDependency("determine_system_type", "split_mesh");
984  _action_warehouse.setFinalTask("split_mesh");
985  }
987 
988  // Setup the AppFileBase for use by the Outputs or other systems that need output file info
989  {
990  // Extract the CommonOutputAction
991  const auto common_actions = _action_warehouse.getActions<CommonOutputAction>();
992  mooseAssert(common_actions.size() <= 1, "Should not be more than one CommonOutputAction");
993  const Action * common = common_actions.empty() ? nullptr : *common_actions.begin();
994 
995  // If file_base is set in CommonOutputAction through parsing input, obtain the file_base
996  if (common && common->isParamValid("file_base"))
997  {
998  _output_file_base = common->getParam<std::string>("file_base");
999  _file_base_set_by_user = true;
1000  }
1001  else if (isUltimateMaster())
1002  {
1003  // if this app is a master, we use the first input file name as the default file base
1004  std::string base = getLastInputFileName();
1005  size_t pos = base.find_last_of('.');
1006  _output_file_base = base.substr(0, pos);
1007  // Note: we did not append "_out" in the file base here because we do not want to
1008  // have it in between the input file name and the object name for Output/*
1009  // syntax.
1010  }
1011  // default file base for multiapps is set by MultiApp
1012  }
1013  }
1014  else if (isParamValid("input_file"))
1015  {
1016  mooseAssert(getInputFileNames().empty(), "Should be empty");
1017  mooseError("No input files specified. Add -i <inputfile> to your command line.");
1018  }
1019  else if (isParamValid("language_server"))
1020  {
1022 
1023  // Reset output to the buffer what was cached before it was turned it off
1024  if (!Moose::out.rdbuf() && _output_buffer_cache)
1025  Moose::out.rdbuf(_output_buffer_cache);
1026 
1027  // Start a language server that communicates using an iostream connection
1028  MooseServer moose_server(*this);
1029 
1030  moose_server.run();
1031 
1032  _ready_to_exit = true;
1033  }
1034 
1035  else /* The catch-all case for bad options or missing options, etc. */
1036  {
1037  if (_check_input)
1038  mooseError("You specified --check-input, but did not provide an input file. Add -i "
1039  "<inputfile> to your command line.");
1040 
1041  _command_line->printUsage();
1042 
1043  _ready_to_exit = true;
1044  }
1045 
1046  Moose::out << std::flush;
1047 }
void build()
Parse an input file (or text string if provided) consisting of hit syntax and setup objects in the MO...
Definition: Builder.C:409
PerfGraph & _perf_graph
The PerfGraph object for this application (recoverable)
Definition: MooseApp.h:1164
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
Definition: MooseApp.h:823
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:1245
const std::shared_ptr< Parser > _parser
Parser for parsing the input file.
Definition: MooseApp.h:1149
const std::multimap< std::string, ActionInfo > & getAssociatedActions() const
Return all Syntax to Action associations.
Definition: Syntax.C:368
void buildFullTree(const std::string &search_string)
Use MOOSE Factories to construct a full parse tree for documentation or echoing input.
Definition: Builder.C:681
bool _file_base_set_by_user
Whether or not file base is set through input or setOutputFileBase by MultiApp.
Definition: MooseApp.h:1112
void addDependency(const std::string &task, const std::string &pre_req)
Definition: Syntax.C:60
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:1314
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
bool _warnings_are_errors
Variable to toggle any warning into an error (includes deprecated code warnings)
Definition: Moose.C:637
void registerTaskName(const std::string &task, bool should_auto_build=false)
Method to register a new task.
Definition: Syntax.C:20
static const std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > & allActions()
Returns a per-label keyed map of all Actions in the registry.
Definition: Registry.h:208
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:296
void setFinalTask(const std::string &task)
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
unsigned int multiAppLevel() const
The MultiApp Level.
Definition: MooseApp.h:812
const std::string _name
The name of this object.
Definition: MooseApp.h:1097
bool _check_input
true if we want to just check the input file
Definition: MooseApp.h:1254
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:174
Syntax _syntax
Syntax of the input file.
Definition: MooseApp.h:1133
Syntax & syntax()
Returns a writable reference to the syntax object.
Definition: MooseApp.h:220
bool _trap_fpe
Whether or not FPE trapping should be turned on.
Definition: MooseApp.h:1242
static const std::map< std::string, std::vector< std::shared_ptr< RegistryEntryBase > > > & allObjects()
Returns a per-label keyed map of all MooseObjects in the registry.
Definition: Registry.h:203
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1143
This class produces a dump of the InputFileParameters in the Standard Object Notation (SON) format fo...
Holds the syntax in a Json::Value tree.
Base class for actions.
Definition: Action.h:38
const std::string & getLastInputFileName() const
Definition: MooseApp.C:1065
void setErrorOverridden()
Set a flag so that the parser will throw an error if overridden parameters are detected.
Definition: MooseApp.C:1488
T command_line_value(const std::string &, T)
std::shared_ptr< CommandLine > _command_line
Command line object.
Definition: MooseApp.h:1130
void indentMessage(const std::string &prefix, std::string &message, const char *color=COLOR_CYAN, bool dont_indent_first_line=true, const std::string &post_prefix=": ")
Indents the supplied message given the prefix and color.
Definition: MooseUtils.C:721
bool _deprecated_is_error
Variable to toggle only deprecated warnings as errors.
Definition: Moose.C:638
void setActive(bool active)
Turn on or off timing.
Definition: PerfGraph.h:129
void initSyntaxFormatter(SyntaxFormatterType type, bool dump_mode)
Creates a syntax formatter for printing.
Definition: Builder.C:550
void disableLivePrint()
Completely disables Live Print (cannot be restarted)
Definition: PerfGraph.C:63
bool _recover
Whether or not this is a recovery run.
Definition: MooseApp.h:1230
void buildJsonSyntaxTree(JsonSyntaxTree &tree) const
Use MOOSE Factories to construct a parameter tree for documentation or echoing input.
Definition: Builder.C:567
std::string toString(const nlohmann::json &root)
returns a string representation of the tree in input file format
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:313
This class produces produces a dump of the InputParameters that appears like the normal input file sy...
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100
bool _distributed_mesh_on_command_line
This variable indicates that DistributedMesh should be used for the libMesh mesh underlying MooseMesh...
Definition: MooseApp.h:1227
Moose::Builder _builder
Builder for building app related parser tree.
Definition: MooseApp.h:1152
bool _test_checkpoint_half_transient
Whether or not this simulation should only run half its transient (useful for testing recovery) ...
Definition: MooseApp.h:1248
std::string _output_file_base
The output file basename.
Definition: MooseApp.h:1109
std::streambuf * _output_buffer_cache
Cache output buffer so the language server can turn it off then back on.
Definition: MooseApp.h:1440
void build()
Builds all auto-buildable tasks.
bool setColorConsole(bool use_color, bool force=false)
Turns color escape sequences on/off for info written to stdout.
Definition: Moose.C:631
virtual std::string header() const
Returns a string to be printed at the beginning of a simulation.
Definition: MooseApp.C:2230
const std::string & type() const
Get the type of this object as a string.
Definition: MooseApp.C:1050
const std::vector< std::string > & getInputFileNames() const
Definition: MooseApp.C:1058
std::string toString(const nlohmann::json &root)
Returns a string representation of the tree in input file format.
std::string getPrintableVersion() const
Non-virtual method for printing out the version string in a consistent format.
Definition: MooseApp.C:673
std::vector< const T * > getActions()
Retrieve all actions in a specific type ordered by their names.
void createMinimalApp()
Method for creating the minimum required actions for an application (no input file) ...
Definition: MooseApp.C:2248
bool _ready_to_exit
Definition: MooseApp.h:1218
bool _split_mesh
Whether or not we are performing a split mesh operation (–split-mesh)
Definition: MooseApp.h:1236
Meta-action for creating common output object parameters This action serves two purpose, first it adds common output object parameters.

◆ showInputs()

bool MooseApp::showInputs ( ) const
private

Prints a message showing the installable inputs for a given application (if getInstallableInputs has been overridden for an application).

Definition at line 1553 of file MooseApp.C.

Referenced by run().

1554 {
1555  if (isParamValid("show_inputs"))
1556  {
1557  auto copy_syntax = _pars.getCommandLineSyntax("copy_inputs");
1558  std::vector<std::string> dirs;
1559  const auto installable_inputs = getInstallableInputs();
1560 
1561  if (installable_inputs == "")
1562  {
1563  Moose::out
1564  << "Show inputs has not been overriden in this application.\nContact the developers of "
1565  "this appication and request that they override \"MooseApp::getInstallableInputs\".\n";
1566  }
1567  else
1568  {
1569  mooseAssert(!copy_syntax.empty(), "copy_inputs sytnax should not be empty");
1570 
1571  MooseUtils::tokenize(installable_inputs, dirs, 1, " ");
1572  Moose::out << "The following directories are installable into a user-writeable directory:\n\n"
1573  << installable_inputs << '\n'
1574  << "\nTo install one or more directories of inputs, execute the binary with the \""
1575  << copy_syntax[0] << "\" flag. e.g.:\n$ " << _command_line->getExecutableName()
1576  << ' ' << copy_syntax[0] << ' ' << dirs[0] << '\n';
1577  }
1578  return true;
1579  }
1580  return false;
1581 }
virtual std::string getInstallableInputs() const
Method to retrieve the installable inputs from a given applications <app>Revision.h file.
Definition: MooseApp.C:1584
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:779
const std::vector< std::string > & getCommandLineSyntax(const std::string &name) const
bool isParamValid(const std::string &name) const
Definition: MooseApp.h:174
std::shared_ptr< CommandLine > _command_line
Command line object.
Definition: MooseApp.h:1130
InputParameters _pars
Parameters of this object.
Definition: MooseApp.h:1100

◆ solutionInvalidity()

SolutionInvalidity& MooseApp::solutionInvalidity ( )
inline

◆ syntax()

Syntax& MooseApp::syntax ( )
inline

Returns a writable reference to the syntax object.

Definition at line 220 of file MooseApp.h.

Referenced by dynamicAllRegistration(), and setupOptions().

220 { return _syntax; }
Syntax _syntax
Syntax of the input file.
Definition: MooseApp.h:1133

◆ testCheckpointHalfTransient()

bool MooseApp::testCheckpointHalfTransient ( ) const
inline

Whether or not this simulation should only run half its transient (useful for testing recovery)

Definition at line 522 of file MooseApp.h.

Referenced by AutoCheckpointAction::act(), TimeStepper::constrainStep(), Transient::execute(), halfTransient(), TimeSequenceStepperBase::setupSequence(), and Transient::Transient().

bool _test_checkpoint_half_transient
Whether or not this simulation should only run half its transient (useful for testing recovery) ...
Definition: MooseApp.h:1248

◆ theWarehouse()

TheWarehouse& MooseApp::theWarehouse ( )
inline

Definition at line 97 of file MooseApp.h.

Referenced by MooseVariableDataFV< OutputType >::MooseVariableDataFV(), and FEProblemBase::theWarehouse().

97 { return *_the_warehouse; }
std::unique_ptr< TheWarehouse > _the_warehouse
The combined warehouse for storing any MooseObject based object.
Definition: MooseApp.h:1411

◆ timedSectionName()

std::string PerfGraphInterface::timedSectionName ( const std::string &  section_name) const
protectedinherited
Returns
The name of the timed section with the name section_name.

Optionally adds a prefix if one is defined.

Definition at line 47 of file PerfGraphInterface.C.

Referenced by PerfGraphInterface::registerTimedSection().

48 {
49  return _prefix.empty() ? "" : (_prefix + "::") + section_name;
50 }
const std::string _prefix
A prefix to use for all sections.

◆ type()

const std::string & MooseApp::type ( ) const

Get the type of this object as a string.

This is a string version of the class name (e.g. MooseTestApp).

Returns
The the type of the object

Definition at line 1050 of file MooseApp.C.

Referenced by addExecutor(), addExecutorParams(), addMeshGenerator(), appendMeshGenerator(), createRecoverablePerfGraph(), MooseServer::parseDocumentForDiagnostics(), recursivelyCreateExecutors(), and setupOptions().

1051 {
1052  if (_parser && _parser->getAppType().size())
1053  mooseAssert(_parser->getAppType() == _type, "Should be equivalent");
1054  return _type;
1055 }
const std::string _type
The string representation of the type of this object as registered (see registerApp(AppName)) ...
Definition: MooseApp.h:1103
const std::shared_ptr< Parser > _parser
Parser for parsing the input file.
Definition: MooseApp.h:1149

◆ useEigenvalue()

bool& MooseApp::useEigenvalue ( )
inline

Returns a writable Boolean indicating whether this app will use an eigenvalue executioner.

Definition at line 403 of file MooseApp.h.

Referenced by CreateProblemDefaultAction::act().

403 { return _use_eigen_value; }
bool _use_eigen_value
Boolean to indicate whether to use an eigenvalue executioner.
Definition: MooseApp.h:1201

◆ useExecutor()

bool MooseApp::useExecutor ( ) const
inline

Definition at line 332 of file MooseApp.h.

332 { return _use_executor; }
const bool _use_executor
Indicates whether we are operating in the new/experimental executor mode instead of using the legacy ...
Definition: MooseApp.h:1192

◆ useNonlinear()

bool& MooseApp::useNonlinear ( )
inline

Returns a writable Boolean indicating whether this app will use a Nonlinear or Eigen System.

Definition at line 398 of file MooseApp.h.

Referenced by CreateProblemAction::act(), and CreateProblemDefaultAction::act().

398 { return _use_nonlinear; }
bool _use_nonlinear
Boolean to indicate whether to use a Nonlinear or EigenSystem (inspected by actions) ...
Definition: MooseApp.h:1198

◆ validParams()

InputParameters MooseApp::validParams ( )
static

Definition at line 96 of file MooseApp.C.

97 {
99 
100  // Parameters that main also expects that we won't use (-i)
102 
103  params.addCommandLineParam<bool>(
104  "display_version", "-v --version", false, "Print application version");
105 
106  params.addCommandLineParam<std::string>(
107  "mesh_only",
108  "--mesh-only [mesh_file_name]",
109  "Setup and Output the input mesh only (Default: \"<input_file_name>_in.e\")");
110 
111  params.addCommandLineParam<bool>("show_input",
112  "--show-input",
113  false,
114  "Shows the parsed input file before running the simulation.");
115  params.addCommandLineParam<bool>(
116  "show_outputs", "--show-outputs", false, "Shows the output execution time information.");
117  params.addCommandLineParam<bool>(
118  "show_controls", "--show-controls", false, "Shows the Control logic available and executed.");
119 
120  params.addCommandLineParam<bool>(
121  "no_color", "--no-color", false, "Disable coloring of all Console outputs.");
122  params.addCommandLineParam<std::string>("color",
123  "--color [auto,on,off]",
124  "default-on",
125  "Whether to use color in console output (default 'on').");
126 
127  params.addCommandLineParam<bool>("help", "-h --help", false, "Displays CLI usage statement.");
128  params.addCommandLineParam<bool>(
129  "minimal",
130  "--minimal",
131  false,
132  "Ignore input file and build a minimal application with Transient executioner.");
133 
134  params.addCommandLineParam<bool>(
135  "language_server",
136  "--language-server",
137  "Starts a process to communicate with development tools using the language server protocol");
138 
139  params.addCommandLineParam<std::string>(
140  "definition", "--definition", "Shows a SON style input definition dump for input validation");
141  params.addCommandLineParam<std::string>(
142  "dump", "--dump [search_string]", "Shows a dump of available input file syntax.");
143  params.addCommandLineParam<bool>(
144  "registry", "--registry", "Lists all known objects and actions.");
145  params.addCommandLineParam<bool>(
146  "registry_hit", "--registry-hit", "Lists all known objects and actions in hit format.");
147  params.addCommandLineParam<bool>(
148  "use_executor", "--executor", false, "Use the new Executor system instead of Executioners");
149 
150  params.addCommandLineParam<bool>(
151  "apptype", "--type", false, "Return the name of the application object.");
152  params.addCommandLineParam<std::string>(
153  "yaml", "--yaml", "Dumps input file syntax in YAML format.");
154  params.addCommandLineParam<std::string>(
155  "json", "--json", "Dumps input file syntax in JSON format.");
156  params.addCommandLineParam<bool>(
157  "syntax", "--syntax", false, "Dumps the associated Action syntax paths ONLY");
158  params.addCommandLineParam<bool>(
159  "show_docs", "--docs", false, "print url/path to the documentation website");
160  params.addCommandLineParam<bool>("check_input",
161  "--check-input",
162  false,
163  "Check the input file (i.e. requires -i <filename>) and quit.");
164  params.addCommandLineParam<std::string>(
165  "show_inputs",
166  "--show-copyable-inputs",
167  "Shows the directories able to be installed (copied) into a user-writable location");
168 
169  params.addCommandLineParam<std::string>("copy_inputs",
170  "--copy-inputs <dir>",
171  "Copies installed inputs (e.g. tests, examples, etc.) to "
172  "an directory named <appname>_<dir>.");
173  params.addCommandLineParam<std::string>("run",
174  "--run",
175  "Runs the inputs in the current directory copied to a "
176  "user-writable location by \"--copy-inputs\"");
177 
178  params.addCommandLineParam<bool>(
179  "list_constructed_objects",
180  "--list-constructed-objects",
181  false,
182  "List all moose object type names constructed by the master app factory.");
183 
184  params.addCommandLineParam<unsigned int>(
185  "n_threads", "--n-threads=<n>", 1, "Runs the specified number of threads per process");
186 
187  params.addCommandLineParam<bool>("allow_unused",
188  "-w --allow-unused",
189  false,
190  "Warn about unused input file options instead of erroring.");
191  params.addCommandLineParam<bool>("error_unused",
192  "-e --error-unused",
193  false,
194  "Error when encountering unused input file options");
195  params.addCommandLineParam<bool>(
196  "error_override",
197  "-o --error-override",
198  false,
199  "Error when encountering overridden or parameters supplied multiple times");
200  params.addCommandLineParam<bool>(
201  "error_deprecated", "--error-deprecated", false, "Turn deprecated code messages into Errors");
202 
203  params.addCommandLineParam<bool>(
204  "distributed_mesh",
205  "--distributed-mesh",
206  false,
207  "The libMesh Mesh underlying MooseMesh should always be a DistributedMesh");
208 
209  params.addCommandLineParam<std::string>(
210  "split_mesh",
211  "--split-mesh [splits]",
212  "comma-separated list of numbers of chunks to split the mesh into");
213 
214  params.addCommandLineParam<std::string>("split_file",
215  "--split-file [filename]",
216  "",
217  "optional name of split mesh file(s) to write/read");
218 
219  params.addCommandLineParam<bool>(
220  "use_split", "--use-split", false, "use split distributed mesh files");
221 
222  params.addCommandLineParam<unsigned int>(
223  "refinements",
224  "-r <n>",
225  0,
226  "Specify additional initial uniform mesh refinements for grid convergence studies");
227 
228  params.addCommandLineParam<std::string>("recover",
229  "--recover [file_base]",
230  "Continue the calculation. If file_base is omitted then "
231  "the most recent recovery file will be utilized");
232 
233  params.addCommandLineParam<bool>("test_checkpoint_half_transient",
234  "--test-checkpoint-half-transient",
235  false,
236  "When true the simulation will only run half of "
237  "its specified transient (ie half the "
238  "timesteps) with checkpoints enabled. "
239  "This is useful for testing recovery and restart "
240  "and should only be used in the test harness.");
241 
242  params.addCommandLineParam<Real>("output_wall_time_interval",
243  "--output-wall-time-interval [interval]",
244  "The target wall time interval (in seconds) at "
245  "which to write to output. "
246  "USE FOR TEST SUITE PROBLEMS ONLY, FOR ALL OTHER USES "
247  "SEE THE wall_time_interval IN DERIVED Output OBJECTS.");
248 
249  // No default on these two options, they must not both be valid
250  params.addCommandLineParam<bool>(
251  "trap_fpe",
252  "--trap-fpe",
253  "Enable Floating Point Exception handling in critical sections of "
254  "code. This is enabled automatically in DEBUG mode");
255  params.addCommandLineParam<bool>("no_trap_fpe",
256  "--no-trap-fpe",
257  "Disable Floating Point Exception handling in critical "
258  "sections of code when using DEBUG mode.");
259 
260  params.addCommandLineParam<bool>("error", "--error", false, "Turn all warnings into errors");
261 
262  params.addCommandLineParam<bool>(
263  "timing",
264  "-t --timing",
265  false,
266  "Enable all performance logging for timing purposes. This will disable all "
267  "screen output of performance logs for all Console objects.");
268  params.addCommandLineParam<bool>("no_timing",
269  "--no-timing",
270  false,
271  "Disabled performance logging. Overrides -t or --timing "
272  "if passed in conjunction with this flag");
273 
274  params.addCommandLineParam<bool>(
275  "allow_test_objects", "--allow-test-objects", false, "Register test objects and syntax.");
276 
277  // Options ignored by MOOSE but picked up by libMesh, these are here so that they are displayed in
278  // the application help
279  params.addCommandLineParam<bool>(
280  "keep_cout",
281  "--keep-cout",
282  false,
283  "Keep standard output from all processors when running in parallel");
284  params.addCommandLineParam<bool>(
285  "redirect_stdout",
286  "--redirect-stdout",
287  false,
288  "Keep standard output from all processors when running in parallel");
289 
290  params.addCommandLineParam<std::string>(
291  "timpi_sync",
292  "--timpi-sync <sync type>",
293  "nbx",
294  "Changes the sync type used in spare parallel communitations within the TIMPI library "
295  "(advanced option).");
296 
297  // Options for debugging
298  params.addCommandLineParam<std::string>("start_in_debugger",
299  "--start-in-debugger <debugger>",
300  "Start the application and attach a debugger. This will "
301  "launch xterm windows using the command you specify for "
302  "'debugger'");
303 
304  params.addCommandLineParam<unsigned int>("stop_for_debugger",
305  "--stop-for-debugger [seconds]",
306  30,
307  "Pauses the application during startup for the "
308  "specified time to allow for connection of debuggers.");
309 
310  params.addCommandLineParam<bool>("perf_graph_live_all",
311  "--perf-graph-live-all",
312  false,
313  "Forces printing of ALL progress messages.");
314 
315  params.addCommandLineParam<bool>("disable_perf_graph_live",
316  "--disable-perf-graph-live",
317  false,
318  "Disables PerfGraph Live Printing.");
319 
320  params.addParam<bool>(
321  "automatic_automatic_scaling", false, "Whether to turn on automatic scaling by default.");
322 
323 #ifdef HAVE_GPERFTOOLS
324  params.addCommandLineParam<std::string>(
325  "gperf_profiler_on",
326  "--gperf-profiler-on [ranks]",
327  "To generate profiling report only on comma-separated list of MPI ranks.");
328 #endif
329 
330  params.addPrivateParam<std::string>("_app_name"); // the name passed to AppFactory::create
331  params.addPrivateParam<std::string>("_type");
332  params.addPrivateParam<int>("_argc");
333  params.addPrivateParam<char **>("_argv");
334  params.addPrivateParam<std::shared_ptr<CommandLine>>("_command_line");
335  params.addPrivateParam<std::shared_ptr<Parallel::Communicator>>("_comm");
336  params.addPrivateParam<unsigned int>("_multiapp_level");
337  params.addPrivateParam<unsigned int>("_multiapp_number");
338  params.addPrivateParam<const MooseMesh *>("_master_mesh");
339  params.addPrivateParam<const MooseMesh *>("_master_displaced_mesh");
340  params.addPrivateParam<std::unique_ptr<Backup> *>("_initial_backup", nullptr);
341  params.addPrivateParam<std::shared_ptr<Parser>>("_parser");
342 
343  params.addParam<bool>(
344  "use_legacy_material_output",
345  true,
346  "Set false to allow material properties to be output on INITIAL, not just TIMESTEP_END.");
347 
348  params.addParam<bool>(
350  false,
351  "Set true to enable data-driven mesh generation, which is an experimental feature");
352 
353  MooseApp::addAppParam(params);
354 
355  return params;
356 }
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...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()
void addMainCommandLineParams(InputParameters &params)
Adds the command line parameters needed from within main, which will also need to be added to MooseAp...
Definition: MooseMain.C:26
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
void addCommandLineParam(const std::string &name, const std::string &syntax, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static void addAppParam(InputParameters &params)
Definition: MooseApp.C:85
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...
static const std::string allow_data_driven_param
The name of the boolean parameter on the MooseApp that will enable data driven generation.

◆ writeRestartableMetaData() [1/2]

std::vector< std::filesystem::path > MooseApp::writeRestartableMetaData ( const RestartableDataMapName name,
const std::filesystem::path &  folder_base 
)

Writes the restartable meta data for name with a folder base of folder_base.

Returns
The files that were written

Definition at line 1909 of file MooseApp.C.

Referenced by MeshOnlyAction::act(), SplitMeshAction::act(), Checkpoint::output(), and writeRestartableMetaData().

1911 {
1912  if (processor_id() != 0)
1913  mooseError("MooseApp::writeRestartableMetaData(): Should only run on processor 0");
1914 
1915  const auto & map_name = getRestartableDataMapName(name);
1916  const auto meta_data_folder_base = metaDataFolderBase(folder_base, map_name);
1917 
1919  return writer.write(meta_data_folder_base);
1920 }
const std::string & name() const
Get the name of the object.
Definition: MooseApp.h:106
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
static std::filesystem::path metaDataFolderBase(const std::filesystem::path &folder_base, const std::string &map_suffix)
The file suffix for meta data (header and data)
Definition: MooseApp.C:2403
Writer for restartable data, to be read by the RestartableDataReader.
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor.
Definition: MooseApp.h:418
RestartableDataMap & getRestartableDataMap(const RestartableDataMapName &name)
Return a reference to restartable data for the specific type flag.
Definition: MooseApp.C:2773
const std::string & getRestartableDataMapName(const RestartableDataMapName &name) const
Definition: MooseApp.C:2800

◆ writeRestartableMetaData() [2/2]

std::vector< std::filesystem::path > MooseApp::writeRestartableMetaData ( const std::filesystem::path &  folder_base)

Writes all available restartable meta data with a file base of file_base.

Returns
The files that were written

Definition at line 1923 of file MooseApp.C.

1924 {
1925  std::vector<std::filesystem::path> paths;
1926 
1927  if (processor_id() == 0)
1928  for (const auto & name_map_pair : _restartable_meta_data)
1929  {
1930  const auto map_paths = writeRestartableMetaData(name_map_pair.first, folder_base);
1931  paths.insert(paths.end(), map_paths.begin(), map_paths.end());
1932  }
1933 
1934  return paths;
1935 }
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1401
std::vector< std::filesystem::path > writeRestartableMetaData(const RestartableDataMapName &name, const std::filesystem::path &folder_base)
Writes the restartable meta data for name with a folder base of folder_base.
Definition: MooseApp.C:1909
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor.
Definition: MooseApp.h:418

Friends And Related Function Documentation

◆ FEProblemBase

friend class FEProblemBase
friend

Definition at line 1467 of file MooseApp.h.

◆ Restartable

friend class Restartable
friend

Definition at line 1468 of file MooseApp.h.

◆ SubProblem

friend class SubProblem
friend

Definition at line 1469 of file MooseApp.h.

Member Data Documentation

◆ _action_factory

ActionFactory MooseApp::_action_factory
protected

The Factory responsible for building Actions.

Definition at line 1140 of file MooseApp.h.

Referenced by createMinimalApp(), getActionFactory(), and MooseApp().

◆ _action_warehouse

ActionWarehouse MooseApp::_action_warehouse
protected

◆ _attached_relationship_managers

std::map<Moose::RelationshipManagerType, std::set<const RelationshipManager *> > MooseApp::_attached_relationship_managers
protected

The relationship managers that have been attached (type -> RMs)

Definition at line 1261 of file MooseApp.h.

Referenced by attachRelationshipManagers().

◆ _automatic_automatic_scaling

const bool MooseApp::_automatic_automatic_scaling
private

Whether to turn on automatic scaling by default.

Definition at line 1443 of file MooseApp.h.

Referenced by defaultAutomaticScaling().

◆ _builder

Moose::Builder MooseApp::_builder
protected

Builder for building app related parser tree.

Definition at line 1152 of file MooseApp.h.

Referenced by builder(), errorCheck(), getFileName(), parser(), and setupOptions().

◆ _check_input

bool MooseApp::_check_input
protected

true if we want to just check the input file

Definition at line 1254 of file MooseApp.h.

Referenced by checkInput(), MooseApp(), run(), and setupOptions().

◆ _comm

const std::shared_ptr<Parallel::Communicator> MooseApp::_comm
protected

The MPI communicator this App is going to use.

Definition at line 1106 of file MooseApp.h.

Referenced by errorCheck(), getCommunicator(), MooseApp(), and processor_id().

◆ _command_line

std::shared_ptr<CommandLine> MooseApp::_command_line
protected

Command line object.

Definition at line 1130 of file MooseApp.h.

Referenced by commandLine(), copyInputs(), executeExecutioner(), MooseApp(), runInputs(), setupOptions(), and showInputs().

◆ _console

const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 31 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), MeshOnlyAction::act(), SetupDebugAction::act(), MaterialOutputAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), PerfGraph::addToExecutionList(), SimplePredictor::apply(), SystemBase::applyScalingFactors(), MultiApp::backup(), FEProblemBase::backupMultiApps(), CoarsenedPiecewiseLinear::buildCoarsenedGrid(), MeshDiagnosticsGenerator::checkElementOverlap(), MeshDiagnosticsGenerator::checkElementTypes(), MeshDiagnosticsGenerator::checkElementVolumes(), FEProblemBase::checkExceptionAndStopSolve(), MeshDiagnosticsGenerator::checkLocalJacobians(), MeshDiagnosticsGenerator::checkNonConformalMesh(), MeshDiagnosticsGenerator::checkNonConformalMeshFromAdaptivity(), MeshDiagnosticsGenerator::checkNonPlanarSides(), FEProblemBase::checkProblemIntegrity(), ReferenceResidualProblem::checkRelativeConvergence(), MeshDiagnosticsGenerator::checkSidesetsOrientation(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), FixedPointSolve::computeCustomConvergencePostprocessor(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInitialDT(), IterationAdaptiveDT::computeInterpolationDT(), NonlinearSystemBase::computeScaling(), Problem::console(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MessageFromInput::execute(), Steady::execute(), Eigenvalue::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), CoarsenBlockGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), Transient::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseBaseErrorInterface::mooseDeprecated(), MooseBaseErrorInterface::mooseInfo(), MooseBaseErrorInterface::mooseWarning(), MooseBaseErrorInterface::mooseWarningNonPrefixed(), ReferenceResidualProblem::nonlinearConvergenceSetup(), ReporterDebugOutput::output(), PerfGraphOutput::output(), MaterialPropertyDebugOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), PseudoTimestep::outputPseudoTimestep(), Console::outputReporters(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), SolutionInvalidity::printDebug(), EigenExecutionerBase::printEigenvalue(), SecantSolve::printFixedPointConvergenceHistory(), SteffensenSolve::printFixedPointConvergenceHistory(), PicardSolve::printFixedPointConvergenceHistory(), FixedPointSolve::printFixedPointConvergenceReason(), PerfGraphLivePrint::printLiveMessage(), MaterialPropertyDebugOutput::printMaterialMap(), PerfGraphLivePrint::printStats(), AutomaticMortarGeneration::projectPrimaryNodesSinglePair(), AutomaticMortarGeneration::projectSecondaryNodesSinglePair(), CoarsenBlockGenerator::recursiveCoarsen(), SolutionTimeAdaptiveDT::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), SimplePredictor::shouldApply(), Checkpoint::shouldOutput(), SubProblem::showFunctorRequestors(), SubProblem::showFunctors(), FullSolveMultiApp::showStatusMessage(), FEProblemSolve::solve(), FixedPointSolve::solve(), NonlinearSystem::solve(), EigenProblem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), PerfGraphLivePrint::start(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), Transient::takeStep(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _cpu_profiling

bool MooseApp::_cpu_profiling = false
private

CPU profiling.

Definition at line 1446 of file MooseApp.h.

Referenced by MooseApp(), and ~MooseApp().

◆ _distributed_mesh_on_command_line

bool MooseApp::_distributed_mesh_on_command_line
protected

This variable indicates that DistributedMesh should be used for the libMesh mesh underlying MooseMesh.

Definition at line 1227 of file MooseApp.h.

Referenced by getDistributedMeshOnCommandLine(), and setupOptions().

◆ _enable_unused_check

enum MooseApp::UNUSED_CHECK MooseApp::_enable_unused_check
protected

◆ _error_overridden

bool MooseApp::_error_overridden
protected

Indicates whether warnings or errors are displayed when overridden parameters are detected.

Definition at line 1217 of file MooseApp.h.

Referenced by setErrorOverridden().

◆ _ex_reader

std::shared_ptr<ExodusII_IO> MooseApp::_ex_reader
protected

The Exodus reader when _initial_from_file is set to true.

Definition at line 1224 of file MooseApp.h.

Referenced by getExReaderForRestart(), and setExReaderForRestart().

◆ _execute_flags

const ExecFlagEnum MooseApp::_execute_flags
private

Execution flags for this App.

Note: These are copied on purpose instead of maintaining a reference to the ExecFlagRegistry registry. In the Multiapp case, the registry may be augmented, changing the flags "known" to the application in the middle of executing the setup. This causes issues with the application having to process flags that aren't specifically registered.

Definition at line 1437 of file MooseApp.h.

Referenced by getExecuteOnEnum().

◆ _executioner

std::shared_ptr<Executioner> MooseApp::_executioner
protected

Pointer to the executioner of this run (typically build by actions)

Definition at line 1173 of file MooseApp.h.

Referenced by attachRelationshipManagers(), executeExecutioner(), feProblem(), getExecutioner(), removeRelationshipManager(), setExecutioner(), setOutputPosition(), and ~MooseApp().

◆ _executor

std::shared_ptr<Executor> MooseApp::_executor
protected

◆ _executor_params

std::unordered_map<std::string, std::pair<std::string, std::unique_ptr<InputParameters> > > MooseApp::_executor_params
protected

Used in building the Executors Maps the name of the Executor block to the <type, params>

Definition at line 1184 of file MooseApp.h.

Referenced by addExecutorParams(), createExecutors(), and recursivelyCreateExecutors().

◆ _executors

std::map<std::string, std::shared_ptr<Executor> > MooseApp::_executors
protected

Pointers to all of the Executors for this run.

Definition at line 1179 of file MooseApp.h.

Referenced by addExecutor(), createExecutors(), getExecutor(), and recursivelyCreateExecutors().

◆ _factory

Factory MooseApp::_factory
protected

◆ _file_base_set_by_user

bool MooseApp::_file_base_set_by_user
protected

Whether or not file base is set through input or setOutputFileBase by MultiApp.

Definition at line 1112 of file MooseApp.h.

Referenced by getCheckpointDirectories(), getOutputFileBase(), setOutputFileBase(), and setupOptions().

◆ _fixed_point_config

FixedPointConfig MooseApp::_fixed_point_config
protected

Multiapp-related fixed point algorithm configuration details primarily intended to be passed to and used by the executioner/executor system.

Definition at line 1188 of file MooseApp.h.

Referenced by fixedPointConfig().

◆ _global_time_offset

Real MooseApp::_global_time_offset
protected

Offset of the local App time to the "global" problem time.

Definition at line 1127 of file MooseApp.h.

Referenced by getGlobalTimeOffset(), and setGlobalTimeOffset().

◆ _heap_profiling

bool MooseApp::_heap_profiling = false
private

Memory profiling.

Definition at line 1449 of file MooseApp.h.

Referenced by MooseApp(), and ~MooseApp().

◆ _initial_backup

std::unique_ptr<Backup>* const MooseApp::_initial_backup
private

The backup for use in initial setup; this will get set from the _initial_backup input parameter that typically gets set from a MultiApp that has a backup This is a pointer to a pointer because at the time of construction of the app, the backup will not be filled yet.

Definition at line 1464 of file MooseApp.h.

Referenced by hasInitialBackup(), and restoreFromInitialBackup().

◆ _initial_from_file

bool MooseApp::_initial_from_file
protected

This variable indicates when a request has been made to restart from an Exodus file.

Definition at line 1221 of file MooseApp.h.

Referenced by getExodusFileRestart(), and setExodusFileRestart().

◆ _input_parameter_warehouse

std::unique_ptr<InputParameterWarehouse> MooseApp::_input_parameter_warehouse
protected

Input parameter storage structure; unique_ptr so we can control its destruction order.

Definition at line 1137 of file MooseApp.h.

Referenced by getInputParameterWarehouse(), and ~MooseApp().

◆ _interface_registry

std::map<std::type_index, std::unique_ptr<InterfaceRegistryObjectsBase> > MooseApp::_interface_registry
private

Registration for interface objects.

Definition at line 1458 of file MooseApp.h.

Referenced by getInterfaceObjects(), and registerInterfaceObject().

◆ _lib_handles

std::unordered_map<std::string, DynamicLibraryInfo> MooseApp::_lib_handles
protected

The library archive (name only), registration method and the handle to the method.

Definition at line 1277 of file MooseApp.h.

Referenced by getLoadedLibraryPaths(), loadLibraryAndDependencies(), and ~MooseApp().

◆ _master_displaced_mesh

const MooseMesh* const MooseApp::_master_displaced_mesh
private

The displaced mesh from master app.

Definition at line 1423 of file MooseApp.h.

Referenced by masterDisplacedMesh(), and MooseApp().

◆ _master_mesh

const MooseMesh* const MooseApp::_master_mesh
private

The mesh from master app.

Definition at line 1420 of file MooseApp.h.

Referenced by masterMesh(), and MooseApp().

◆ _mesh_generator_system

MeshGeneratorSystem MooseApp::_mesh_generator_system
private

◆ _multiapp_level

unsigned int MooseApp::_multiapp_level
private

Level of multiapp, the master is level 0. This used by the Console to indent output.

Definition at line 1414 of file MooseApp.h.

Referenced by getOutputFileBase(), isUltimateMaster(), MooseApp(), and multiAppLevel().

◆ _multiapp_number

unsigned int MooseApp::_multiapp_number
private

Numbering in all the sub-apps on the same level.

Definition at line 1417 of file MooseApp.h.

Referenced by multiAppNumber().

◆ _name

const std::string MooseApp::_name
protected

The name of this object.

Definition at line 1097 of file MooseApp.h.

Referenced by name(), and setupOptions().

◆ _null_executor

std::shared_ptr<NullExecutor> MooseApp::_null_executor
protected

Used to return an executor that does nothing.

Definition at line 1195 of file MooseApp.h.

Referenced by createExecutors(), getExecutor(), and getNullExecutor().

◆ _output_buffer_cache

std::streambuf* MooseApp::_output_buffer_cache
private

Cache output buffer so the language server can turn it off then back on.

Definition at line 1440 of file MooseApp.h.

Referenced by MooseApp(), and setupOptions().

◆ _output_file_base

std::string MooseApp::_output_file_base
protected

The output file basename.

Definition at line 1109 of file MooseApp.h.

Referenced by getOutputFileBase(), setOutputFileBase(), and setupOptions().

◆ _output_file_numbers

std::map<std::string, unsigned int> MooseApp::_output_file_numbers
protected

Map of outputer name and file number (used by MultiApps to propagate file numbers down through the multiapps)

Definition at line 1251 of file MooseApp.h.

Referenced by getOutputFileNumbers(), and setOutputFileNumbers().

◆ _output_position

Point MooseApp::_output_position
protected

The output position.

Definition at line 1118 of file MooseApp.h.

Referenced by getOutputPosition(), and setOutputPosition().

◆ _output_position_set

bool MooseApp::_output_position_set
protected

Whether or not an output position has been set for this app.

Definition at line 1115 of file MooseApp.h.

Referenced by hasOutputPosition(), and setOutputPosition().

◆ _output_warehouse

OutputWarehouse MooseApp::_output_warehouse
protected

OutputWarehouse object for this App.

Definition at line 1146 of file MooseApp.h.

Referenced by getOutputWarehouse(), setOutputFileBase(), and setOutputPosition().

◆ _pars

InputParameters MooseApp::_pars
protected

Parameters of this object.

Definition at line 1100 of file MooseApp.h.

Referenced by copyInputs(), getParam(), getRenamedParam(), isParamSetByUser(), isParamValid(), parameters(), setupOptions(), and showInputs().

◆ _parser

const std::shared_ptr<Parser> MooseApp::_parser
protected

Parser for parsing the input file.

Definition at line 1149 of file MooseApp.h.

Referenced by getInputFileNames(), getLastInputFileName(), setupOptions(), and type().

◆ _perf_graph

PerfGraph& MooseApp::_perf_graph
protected

The PerfGraph object for this application (recoverable)

Definition at line 1164 of file MooseApp.h.

Referenced by perfGraph(), and setupOptions().

◆ _pg_moose_app

MooseApp& PerfGraphInterface::_pg_moose_app
protectedinherited

The MooseApp that owns the PerfGraph.

Definition at line 124 of file PerfGraphInterface.h.

Referenced by PerfGraphInterface::perfGraph().

◆ _prefix

const std::string PerfGraphInterface::_prefix
protectedinherited

A prefix to use for all sections.

Definition at line 127 of file PerfGraphInterface.h.

Referenced by PerfGraphInterface::timedSectionName().

◆ _rank_map

const RankMap MooseApp::_rank_map
protected

The RankMap is a useful object for determining how the processes are laid out on the physical hardware.

Definition at line 1170 of file MooseApp.h.

Referenced by rankMap().

◆ _rd_reader

RestartableDataReader MooseApp::_rd_reader
private

Definition at line 1428 of file MooseApp.h.

Referenced by finalizeRestore(), and restore().

◆ _ready_to_exit

bool MooseApp::_ready_to_exit
protected

Definition at line 1218 of file MooseApp.h.

Referenced by executeExecutioner(), run(), runInputFile(), and setupOptions().

◆ _recover

bool MooseApp::_recover
protected

Whether or not this is a recovery run.

Definition at line 1230 of file MooseApp.h.

Referenced by isRecovering(), setRecover(), and setupOptions().

◆ _recoverable_data_names

DataNames MooseApp::_recoverable_data_names
protected

Data names that will only be read from the restart file during RECOVERY.

e.g. these names are excluded during restart.

Definition at line 1161 of file MooseApp.h.

Referenced by getRecoverableData(), and registerRestartableNameWithFilter().

◆ _relationship_managers

std::set<std::shared_ptr<RelationshipManager> > MooseApp::_relationship_managers
protected

◆ _restart

bool MooseApp::_restart
protected

Whether or not this is a restart run.

Definition at line 1233 of file MooseApp.h.

Referenced by isRestarting(), and setRestart().

◆ _restart_recover_base

std::string MooseApp::_restart_recover_base
protected

The base name to restart/recover from. If blank then we will find the newest checkpoint file.

Definition at line 1245 of file MooseApp.h.

Referenced by getRecoverFileBase(), getRestartRecoverFileBase(), hasRecoverFileBase(), hasRestartRecoverFileBase(), setRestartRecoverFileBase(), and setupOptions().

◆ _restartable_data

std::vector<RestartableDataMap> MooseApp::_restartable_data
protected

Where the restartable data is held (indexed on tid)

Definition at line 1155 of file MooseApp.h.

Referenced by backup(), getRestartableData(), registerRestartableData(), and ~MooseApp().

◆ _restartable_meta_data

std::unordered_map<RestartableDataMapName, std::pair<RestartableDataMap, std::string> > MooseApp::_restartable_meta_data
private

◆ _solution_invalidity

SolutionInvalidity& MooseApp::_solution_invalidity
protected

The SolutionInvalidity object for this application.

Definition at line 1167 of file MooseApp.h.

Referenced by solutionInvalidity().

◆ _split_mesh

bool MooseApp::_split_mesh
protected

Whether or not we are performing a split mesh operation (–split-mesh)

Definition at line 1236 of file MooseApp.h.

Referenced by isSplitMesh(), and setupOptions().

◆ _start_time

Real MooseApp::_start_time
protected

The time at which to start the simulation.

Definition at line 1124 of file MooseApp.h.

Referenced by getStartTime(), and setStartTime().

◆ _start_time_set

bool MooseApp::_start_time_set
protected

Whether or not an start time has been set.

Definition at line 1121 of file MooseApp.h.

Referenced by hasStartTime(), and setStartTime().

◆ _syntax

Syntax MooseApp::_syntax
protected

Syntax of the input file.

Definition at line 1133 of file MooseApp.h.

Referenced by MooseApp(), setupOptions(), and syntax().

◆ _sys_info

std::unique_ptr<SystemInfo> MooseApp::_sys_info
protected

System Information.

Definition at line 1204 of file MooseApp.h.

Referenced by getSystemInfo(), and MooseApp().

◆ _template_to_clones

std::map<const RelationshipManager *, std::map<const MeshBase *, std::unique_ptr<RelationshipManager> > > MooseApp::_template_to_clones
private

Map from a template relationship manager to a map in which the key-value pairs represent the MeshBase object and the clone of the template relationship manager, e.g.

the top-level map key

Definition at line 1455 of file MooseApp.h.

Referenced by createRMFromTemplateAndInit(), getRMClone(), and hasRMClone().

◆ _test_checkpoint_half_transient

bool MooseApp::_test_checkpoint_half_transient
protected

Whether or not this simulation should only run half its transient (useful for testing recovery)

Definition at line 1248 of file MooseApp.h.

Referenced by setupOptions(), and testCheckpointHalfTransient().

◆ _the_warehouse

std::unique_ptr<TheWarehouse> MooseApp::_the_warehouse
private

The combined warehouse for storing any MooseObject based object.

Definition at line 1411 of file MooseApp.h.

Referenced by MooseApp(), theWarehouse(), and ~MooseApp().

◆ _trap_fpe

bool MooseApp::_trap_fpe
protected

Whether or not FPE trapping should be turned on.

Definition at line 1242 of file MooseApp.h.

Referenced by getFPTrapFlag(), and setupOptions().

◆ _type

const std::string MooseApp::_type
protected

The string representation of the type of this object as registered (see registerApp(AppName))

Definition at line 1103 of file MooseApp.h.

Referenced by MooseApp(), and type().

◆ _undisp_to_disp_rms

std::unordered_map<RelationshipManager *, std::shared_ptr<GhostingFunctor> > MooseApp::_undisp_to_disp_rms
protected

A map from undisplaced relationship managers to their displaced clone (stored as the base GhostingFunctor).

Anytime we clone in attachRelationshipManagers we create a map entry from the cloned undisplaced relationship manager to its displaced clone counterpart. We leverage this map when removing relationship managers/ghosting functors

Definition at line 1267 of file MooseApp.h.

◆ _use_eigen_value

bool MooseApp::_use_eigen_value
protected

Boolean to indicate whether to use an eigenvalue executioner.

Definition at line 1201 of file MooseApp.h.

Referenced by useEigenvalue().

◆ _use_executor

const bool MooseApp::_use_executor
protected

Indicates whether we are operating in the new/experimental executor mode instead of using the legacy executioner system.

Definition at line 1192 of file MooseApp.h.

Referenced by executeExecutioner(), and useExecutor().

◆ _use_nonlinear

bool MooseApp::_use_nonlinear
protected

Boolean to indicate whether to use a Nonlinear or EigenSystem (inspected by actions)

Definition at line 1198 of file MooseApp.h.

Referenced by useNonlinear().

◆ _use_split

const bool MooseApp::_use_split
protected

Whether or not we are using a (pre-)split mesh (automatically DistributedMesh)

Definition at line 1239 of file MooseApp.h.

◆ MESH_META_DATA

const RestartableDataMapName MooseApp::MESH_META_DATA = "MeshMetaData"
static

◆ MESH_META_DATA_SUFFIX

const RestartableDataMapName MooseApp::MESH_META_DATA_SUFFIX = "mesh"
static

Definition at line 91 of file MooseApp.h.

Referenced by MooseApp().


The documentation for this class was generated from the following files: