Storage for action instances. More...
#include <ActionWarehouse.h>
Public Member Functions | |
ActionWarehouse (MooseApp &app, Syntax &syntax, ActionFactory &factory) | |
~ActionWarehouse () | |
void | build () |
Builds all auto-buildable tasks. More... | |
void | clear () |
This method deletes all of the Actions in the warehouse. More... | |
bool | empty () const |
returns a Boolean indicating whether the warehouse is empty or not. More... | |
void | addActionBlock (std::shared_ptr< Action > blk) |
This method add an Action instance to the warehouse. More... | |
void | checkUnsatisfiedActions () const |
This method checks the actions stored in the warehouse against the list of required registered actions to see if all of them have been satisfied. More... | |
void | printActionDependencySets () const |
This method is used only during debugging when show_actions is set to true . More... | |
void | printInputFile (std::ostream &out) |
This method uses the Actions in the warehouse to reproduce the input file. More... | |
const std::vector< std::shared_ptr< Action > > & | allActionBlocks () const |
Returns a reference to all of the actions. More... | |
const std::list< Action * > & | getActionListByName (const std::string &task) const |
Retrieve a constant list of Action pointers associated with the passed in task. More... | |
template<class T > | |
const T & | getAction (const std::string &name) |
Retrieve an action with its name and the desired type. More... | |
template<class T > | |
std::vector< const T * > | getActions () |
Retrieve all actions in a specific type ordered by their names. More... | |
template<class T > | |
const T * | getActionByTask (const std::string &task) |
Retrieve the action on a specific task with its type. More... | |
void | setFinalTask (const std::string &task) |
bool | hasActions (const std::string &task) const |
Check if Actions associated with passed in task exist. More... | |
void | executeAllActions () |
This method loops over all actions in the warehouse and executes them. More... | |
void | executeActionsWithAction (const std::string &name) |
This method executes only the actions in the warehouse that satisfy the task passed in. More... | |
void | showActions (bool state=true) |
This method sets a Boolean which is used to show debugging information during various warehouse operations during the problem setup phase. More... | |
void | showParser (bool state=true) |
Syntax & | syntax () |
std::shared_ptr< MooseMesh > & | mesh () |
const std::shared_ptr< MooseMesh > & | getMesh () const |
std::shared_ptr< MooseMesh > & | displacedMesh () |
const std::shared_ptr< MooseMesh > & | getDisplacedMesh () const |
std::shared_ptr< FEProblemBase > & | problemBase () |
std::shared_ptr< FEProblem > | problem () |
MooseApp & | mooseApp () |
const std::string & | getCurrentTaskName () const |
std::string | getCurrentActionName () const |
ActionIterator | actionBlocksWithActionBegin (const std::string &task) |
Iterators to the Actions in the warehouse. More... | |
ActionIterator | actionBlocksWithActionEnd (const std::string &task) |
Public Attributes | |
const ConsoleStream | _console |
An instance of helper class to write streams to the Console objects. More... | |
Protected Member Functions | |
void | buildBuildableActions (const std::string &task) |
This method auto-builds all Actions that needs to be built and adds them to ActionWarehouse. More... | |
Protected Attributes | |
std::vector< std::shared_ptr< Action > > | _all_ptrs |
MooseApp & | _app |
The MooseApp this Warehouse is associated with. More... | |
Syntax & | _syntax |
Reference to a "syntax" of actions. More... | |
ActionFactory & | _action_factory |
The Factory that builds Actions. More... | |
std::map< std::string, std::list< Action * > > | _action_blocks |
Pointers to the actual parsed input file blocks. More... | |
std::vector< std::string > | _ordered_names |
The container that holds the sorted action names from the DependencyResolver. More... | |
std::set< std::string > | _unsatisfied_dependencies |
Use to store the current list of unsatisfied dependencies. More... | |
bool | _generator_valid |
Flag to indicate whether or not there is an active iterator on this class. More... | |
bool | _show_actions |
bool | _show_parser |
std::string | _current_task |
std::shared_ptr< MooseMesh > | _mesh |
Mesh class. More... | |
std::shared_ptr< MooseMesh > | _displaced_mesh |
Possible mesh for displaced problem. More... | |
std::shared_ptr< FEProblemBase > | _problem |
Problem class. More... | |
Private Attributes | |
std::string | _final_task |
Last task to run before (optional) early termination - blank means no early termination. More... | |
ActionIterator | _act_iter |
const std::list< Action * > | _empty_action_list |
Storage for action instances.
Definition at line 34 of file ActionWarehouse.h.
ActionWarehouse::ActionWarehouse | ( | MooseApp & | app, |
Syntax & | syntax, | ||
ActionFactory & | factory | ||
) |
Definition at line 25 of file ActionWarehouse.C.
ActionWarehouse::~ActionWarehouse | ( | ) |
Definition at line 36 of file ActionWarehouse.C.
ActionIterator ActionWarehouse::actionBlocksWithActionBegin | ( | const std::string & | task | ) |
Iterators to the Actions in the warehouse.
Iterators should always be used when executing Actions to capture dynamically added Actions (meta-Actions). Meta-Actions are allowed to create and add additional Actions to the warehouse on the fly. Those Actions will fire as long as their associated task hasn't already passed (i.e. matches or is later).
Definition at line 170 of file ActionWarehouse.C.
Referenced by SetupDampersAction::act(), executeActionsWithAction(), Parser::extractParams(), and CommonOutputAction::hasConsole().
ActionIterator ActionWarehouse::actionBlocksWithActionEnd | ( | const std::string & | task | ) |
Definition at line 176 of file ActionWarehouse.C.
Referenced by SetupDampersAction::act(), executeActionsWithAction(), Parser::extractParams(), and CommonOutputAction::hasConsole().
void ActionWarehouse::addActionBlock | ( | std::shared_ptr< Action > | blk | ) |
This method add an Action
instance to the warehouse.
Note: This routine uses the XTerm colors directly which is not advised for general purpose output coloring. Most users should prefer using Problem::colorText() which respects the "color_output" option for terminals that do not support coloring. Since this routine is intended for debugging only and runs before several objects exist in the system, we are just using the constants directly.
We need to see if the current Action satisfies multiple tasks. There are a few cases to consider:
Definition at line 73 of file ActionWarehouse.C.
Referenced by buildBuildableActions(), CommonOutputAction::create(), AddVariableAction::createInitialConditionAction(), MooseApp::createMinimalApp(), CreateExecutionerAction::setupAutoPreconditioning(), and Parser::walkRaw().
const std::vector< std::shared_ptr< Action > > & ActionWarehouse::allActionBlocks | ( | ) | const |
Returns a reference to all of the actions.
Definition at line 182 of file ActionWarehouse.C.
Referenced by AddRelationshipManager::act().
void ActionWarehouse::build | ( | ) |
Builds all auto-buildable tasks.
This method is typically called after the Parser has created Actions based on an input file.
Definition at line 47 of file ActionWarehouse.C.
Referenced by MooseApp::createMinimalApp(), and MooseApp::setupOptions().
|
protected |
This method auto-builds all Actions that needs to be built and adds them to ActionWarehouse.
An Action needs to be built if it is associated with a task that is marked as required and all of it's parameters are valid (are not required or have default values supplied).
task | The name of the task to find and build Actions for. |
Definition at line 204 of file ActionWarehouse.C.
Referenced by build().
void ActionWarehouse::checkUnsatisfiedActions | ( | ) | const |
This method checks the actions stored in the warehouse against the list of required registered actions to see if all of them have been satisfied.
It should be called before running a MOOSE problem
Definition at line 229 of file ActionWarehouse.C.
Referenced by CheckIntegrityAction::act().
void ActionWarehouse::clear | ( | ) |
This method deletes all of the Actions in the warehouse.
Definition at line 55 of file ActionWarehouse.C.
Referenced by MooseApp::~MooseApp().
|
inline |
Definition at line 216 of file ActionWarehouse.h.
Referenced by MooseApp::attachRelationshipManagers(), MooseApp::executeMeshGenerators(), and MooseApp::executeMeshModifiers().
|
inline |
returns
a Boolean indicating whether the warehouse is empty or not.
Definition at line 54 of file ActionWarehouse.h.
Referenced by checkUnsatisfiedActions().
void ActionWarehouse::executeActionsWithAction | ( | const std::string & | name | ) |
This method executes only the actions in the warehouse that satisfy the task passed in.
Definition at line 348 of file ActionWarehouse.C.
Referenced by executeAllActions().
void ActionWarehouse::executeAllActions | ( | ) |
This method loops over all actions in the warehouse and executes them.
Meta-actions may add new actions to the warehouse on the fly and they will still be executed in order
Definition at line 326 of file ActionWarehouse.C.
Referenced by MooseApp::runInputFile().
|
inline |
Retrieve an action with its name and the desired type.
name | The action name. |
Definition at line 110 of file ActionWarehouse.h.
|
inline |
Retrieve the action on a specific task with its type.
Error will be thrown if more than one actions are found.
task | The task name. |
Definition at line 156 of file ActionWarehouse.h.
Referenced by CreateProblemDefaultAction::act().
const std::list< Action * > & ActionWarehouse::getActionListByName | ( | const std::string & | task | ) | const |
Retrieve a constant list of Action
pointers associated with the passed in task.
Empty list will be returned if no actions are associated with the task.
Definition at line 188 of file ActionWarehouse.C.
Referenced by SetupMeshAction::act(), MaterialOutputAction::act(), Console::Console(), MooseApp::getCheckpointDirectories(), OutputWarehouse::getOutputNames(), and MooseApp::setupOptions().
|
inline |
Retrieve all actions in a specific type ordered by their names.
Definition at line 131 of file ActionWarehouse.h.
std::string ActionWarehouse::getCurrentActionName | ( | ) | const |
Definition at line 419 of file ActionWarehouse.C.
Referenced by DumpObjectsProblem::dumpObjectHelper(), and DumpObjectsProblem::dumpVariableHelper().
|
inline |
Definition at line 222 of file ActionWarehouse.h.
|
inline |
Definition at line 217 of file ActionWarehouse.h.
|
inline |
Definition at line 214 of file ActionWarehouse.h.
Referenced by MooseApp::getRelationshipManagerInfo().
bool ActionWarehouse::hasActions | ( | const std::string & | task | ) | const |
Check if Actions associated with passed in task exist.
Definition at line 198 of file ActionWarehouse.C.
Referenced by CreateExecutionerAction::act(), MaterialOutputAction::act(), and OutputWarehouse::getOutputNames().
|
inline |
Definition at line 213 of file ActionWarehouse.h.
Referenced by MeshOnlyAction::act(), SplitMeshAction::act(), MooseApp::addRelationshipManager(), MooseApp::attachRelationshipManagers(), and MooseApp::executeMeshModifiers().
|
inline |
void ActionWarehouse::printActionDependencySets | ( | ) | const |
This method is used only during debugging when show_actions
is set to true
.
It prints all of the actions sets in the correct dependency resolved order with all of the Action objects inside.
Note: This routine uses the XTerm colors directly which is not advised for general purpose output coloring. Most users should prefer using Problem::colorText() which respects the "color_output" option for terminals that do not support coloring. Since this routine is intended for debugging only and runs before several objects exist in the system, we are just using the constants directly.
Definition at line 254 of file ActionWarehouse.C.
Referenced by executeAllActions().
void ActionWarehouse::printInputFile | ( | std::ostream & | out | ) |
This method uses the Actions in the warehouse to reproduce the input file.
This method is useful for debugging as it can assist in finding difficult to track parsing or input file problems.
out | A writable ostream object where the output will be sent. |
Definition at line 369 of file ActionWarehouse.C.
Referenced by Console::outputInput(), and ExodusFormatter::printInputFile().
std::shared_ptr< FEProblem > ActionWarehouse::problem | ( | ) |
Definition at line 411 of file ActionWarehouse.C.
|
inline |
void ActionWarehouse::setFinalTask | ( | const std::string & | task | ) |
|
inline |
This method sets a Boolean which is used to show debugging information during various warehouse operations during the problem setup phase.
state | Flag indicating whether to show action information. |
Definition at line 201 of file ActionWarehouse.h.
Referenced by SetupDebugAction::SetupDebugAction().
|
inline |
Definition at line 203 of file ActionWarehouse.h.
Referenced by SetupDebugAction::SetupDebugAction().
|
inline |
Definition at line 206 of file ActionWarehouse.h.
Referenced by DynamicObjectRegistrationAction::DynamicObjectRegistrationAction().
|
private |
Definition at line 283 of file ActionWarehouse.h.
Referenced by executeActionsWithAction().
|
protected |
Pointers to the actual parsed input file blocks.
Definition at line 245 of file ActionWarehouse.h.
Referenced by actionBlocksWithActionBegin(), actionBlocksWithActionEnd(), addActionBlock(), buildBuildableActions(), checkUnsatisfiedActions(), clear(), empty(), getActionByTask(), getActionListByName(), hasActions(), printActionDependencySets(), and printInputFile().
|
protected |
The Factory that builds Actions.
Definition at line 243 of file ActionWarehouse.h.
Referenced by addActionBlock(), and buildBuildableActions().
|
protected |
Definition at line 236 of file ActionWarehouse.h.
Referenced by addActionBlock(), allActionBlocks(), clear(), getAction(), and getActions().
|
protected |
The MooseApp this Warehouse is associated with.
Definition at line 239 of file ActionWarehouse.h.
Referenced by mooseApp().
|
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(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), SimplePredictor::apply(), MultiApp::backup(), FEProblemBase::backupMultiApps(), ReferenceResidualProblem::checkNonlinearConvergence(), FEProblemBase::checkProblemIntegrity(), CoarsenedPiecewiseLinear::CoarsenedPiecewiseLinear(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInterpolationDT(), FEProblemBase::computeResidualTags(), NonlinearSystem::computeScaling(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MultiAppPostprocessorTransfer::execute(), MultiAppPostprocessorInterpolationTransfer::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), MultiAppVectorPostprocessorTransfer::execute(), MultiAppMeshFunctionTransfer::execute(), MultiAppCopyTransfer::execute(), MultiAppInterpolationTransfer::execute(), MultiAppUserObjectTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppVariableValueSampleTransfer::execute(), MultiAppNearestNodeTransfer::execute(), MultiAppProjectionTransfer::execute(), Steady::execute(), executeActionsWithAction(), executeAllActions(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MultiApp::globalAppToLocal(), InversePowerMethod::init(), NonlinearEigen::init(), Steady::init(), FEProblemBase::initialAdaptMesh(), FEProblemBase::initialSetup(), EigenExecutionerBase::inversePowerIteration(), Transient::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseObject::mooseDeprecated(), MooseObject::mooseInfo(), MooseObject::mooseWarning(), PerfGraphOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), MultiAppConservativeTransfer::postExecute(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), printActionDependencySets(), EigenExecutionerBase::printEigenvalue(), MaterialPropertyDebugOutput::printMaterialMap(), AutomaticMortarGeneration::projectMasterNodesSinglePair(), AutomaticMortarGeneration::projectSlaveNodesSinglePair(), SolutionTimeAdaptiveDT::rejectStep(), DT2::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), SimplePredictor::shouldApply(), PicardSolve::solve(), NonlinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), PicardSolve::solveStep(), DT2::step(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), Transient::takeStep(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().
|
protected |
Definition at line 264 of file ActionWarehouse.h.
Referenced by executeActionsWithAction(), and getCurrentTaskName().
|
protected |
Possible mesh for displaced problem.
Definition at line 274 of file ActionWarehouse.h.
Referenced by clear(), displacedMesh(), and getDisplacedMesh().
|
private |
Definition at line 285 of file ActionWarehouse.h.
Referenced by getActionListByName().
|
private |
Last task to run before (optional) early termination - blank means no early termination.
Definition at line 281 of file ActionWarehouse.h.
Referenced by executeAllActions(), and setFinalTask().
|
protected |
Flag to indicate whether or not there is an active iterator on this class.
There can only be a single active iterator because of the potential for meta Actions to add new Actions into the warehouse on the fly
Definition at line 256 of file ActionWarehouse.h.
Referenced by clear().
|
protected |
Mesh class.
Definition at line 271 of file ActionWarehouse.h.
|
protected |
The container that holds the sorted action names from the DependencyResolver.
Definition at line 247 of file ActionWarehouse.h.
Referenced by build(), and executeAllActions().
|
protected |
Problem class.
Definition at line 277 of file ActionWarehouse.h.
Referenced by clear(), problem(), and problemBase().
|
protected |
Definition at line 259 of file ActionWarehouse.h.
Referenced by executeActionsWithAction(), executeAllActions(), printActionDependencySets(), and showActions().
|
protected |
Definition at line 260 of file ActionWarehouse.h.
Referenced by addActionBlock(), and showParser().
|
protected |
Reference to a "syntax" of actions.
Definition at line 241 of file ActionWarehouse.h.
Referenced by addActionBlock(), build(), buildBuildableActions(), printActionDependencySets(), printInputFile(), setFinalTask(), and syntax().
|
protected |
Use to store the current list of unsatisfied dependencies.
Definition at line 249 of file ActionWarehouse.h.
Referenced by buildBuildableActions(), and checkUnsatisfiedActions().