113 typename std::shared_ptr<T> p;
116 if (act_ptr->name() == name)
118 p = std::dynamic_pointer_cast<T>(act_ptr);
125 std::vector<std::string> all_names;
127 if (!act_ptr->name().empty())
128 all_names.push_back(act_ptr->name());
130 all_names.push_back(
"unnamed");
133 "' does not exist.\n These are the Actions that do exist:",
141 return const_cast<T &
>(
static_cast<const ActionWarehouse *
>(
this)->getAction<T>(name));
151 auto physics =
const_cast<T *
>(&getAction<T>(name));
154 MooseUtils::prettyCppType<T>(),
157 "' is not derived from the PhysicsBase class");
169 typename std::map<std::string, const std::shared_ptr<T>> actions;
172 auto p = std::dynamic_pointer_cast<T>(act_ptr);
174 actions.insert(std::make_pair(act_ptr->name(), p));
177 std::vector<const T *> action_vector;
178 for (
auto & pair : actions)
179 action_vector.push_back(pair.second.get());
180 return action_vector;
189 const auto physics_vector = getActions<T>();
190 for (
const auto phys_ptr : physics_vector)
193 MooseUtils::prettyCppType<T>(),
196 "' is not derived from the PhysicsBase class");
197 return physics_vector;
214 for (
const auto & action : it->second)
216 T * tp =
dynamic_cast<T *
>(action);
220 mooseError(
"More than one actions have been detected in getActionByTask for the task '",
237 bool hasActions(
const std::string & task)
const;
287 std::shared_ptr<FEProblem>
problem();
304 bool hasTask(
const std::string & task)
const;
std::list< Action * >::iterator ActionIterator
alias to hide implementation details
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Specialized factory for generic Action System objects.
Storage for action instances.
std::mutex _completed_tasks_mutex
Mutex for preventing read/write races for _completed_tasks.
const std::string & getMooseAppName()
const std::shared_ptr< MooseMesh > & getDisplacedMesh() const
void checkUnsatisfiedActions() const
This method checks the actions stored in the warehouse against the list of required registered action...
void setFinalTask(const std::string &task)
void printInputFile(std::ostream &out)
This method uses the Actions in the warehouse to reproduce the input file.
std::shared_ptr< MooseMesh > & mesh()
std::string _final_task
Last task to run before (optional) early termination - blank means no early termination.
std::shared_ptr< FEProblemBase > & problemBase()
std::map< std::string, std::list< Action * > > _action_blocks
Pointers to the actual parsed input file blocks.
void showActionDependencies(bool state=true)
This method sets a Boolean which is used to print information about action dependencies before variou...
std::string _current_task
const Action * getCurrentAction() const
bool _show_actions
Whether or not the action warehouse prints the action execution information.
void clear()
This method deletes all of the Actions in the warehouse.
void buildBuildableActions(const std::string &task)
This method auto-builds all Actions that needs to be built and adds them to ActionWarehouse.
const T * getActionByTask(const std::string &task)
Retrieve the action on a specific task with its type.
std::set< std::string > _unsatisfied_dependencies
Use to store the current list of unsatisfied dependencies.
MooseApp & _app
The MooseApp this Warehouse is associated with.
const std::vector< std::shared_ptr< Action > > & allActionBlocks() const
Returns a reference to all of the actions.
const std::string & getCurrentTaskName() const
std::string getCurrentActionName() const
bool _show_action_dependencies
Whether or not the action warehouse prints the action dependency information.
T * getPhysics(const std::string &name) const
Retrieve a Physics with its name and the desired type.
void showParser(bool state=true)
This method sets a Boolean which is used to show debugging information when actions are inserted in t...
const std::shared_ptr< MooseMesh > & getMesh() const
const std::list< Action * > _empty_action_list
std::vector< UserObjectName > getUserObjectParamDependencies(const InputParameters ¶ms) const
std::vector< const T * > getActions()
Retrieve all actions in a specific type ordered by their names.
bool empty() const
returns a Boolean indicating whether the warehouse is empty or not.
bool isTaskComplete(const std::string &task) const
std::shared_ptr< FEProblem > problem()
bool _generator_valid
Flag to indicate whether or not there is an active iterator on this class.
std::vector< T * > getPhysics()
Retrieve all Physics with a specific type ordered by their names.
Syntax & _syntax
Reference to a "syntax" of actions.
std::vector< std::string > _ordered_names
The container that holds the sorted action names from the DependencyResolver.
const T & getAction(const std::string &name) const
Retrieve an action with its name and the desired type.
std::shared_ptr< FEProblemBase > _problem
Problem class.
void sortUserObjectActions(std::list< Action * > &actions) const
Reorder the UserObject-constructing actions actions so that a UserObject that references another (thr...
bool hasActions(const std::string &task) const
Check if Actions associated with passed in task exist.
std::shared_ptr< MooseMesh > & displacedMesh()
ActionIterator actionBlocksWithActionEnd(const std::string &task)
T & getAction(const std::string &name)
ActionFactory & _action_factory
The Factory that builds Actions.
std::vector< std::shared_ptr< Action > > _all_ptrs
ActionIterator actionBlocksWithActionBegin(const std::string &task)
Iterators to the Actions in the warehouse.
bool _show_parser
Whether or not to print messages when actions are inserted in the warehouse by the parser.
std::set< std::string > _completed_tasks
The completed tasks.
void build()
Builds all auto-buildable tasks.
void showActions(bool state=true)
This method sets a Boolean which is used to show information about action execution of various wareho...
void executeActionsWithAction(const std::string &task_name)
This method executes only the actions in the warehouse that satisfy the task passed in.
const std::list< Action * > & getActionListByName(const std::string &task) const
Retrieve a constant list of Action pointers associated with the passed in task.
std::shared_ptr< MooseMesh > _displaced_mesh
Possible mesh for displaced problem.
void printActionDependencySets() const
This method is used only during debugging when show_actions is set to true.
void executeAllActions()
This method loops over all actions in the warehouse and executes them.
bool hasTask(const std::string &task) const
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse.
std::shared_ptr< MooseMesh > _mesh
Mesh class.
An inteface for the _console for outputting to the Console object.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Base class for MOOSE-based applications.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Base class to help creating an entire physics.
Holding syntax for parsing input files.
std::string stringify(const T &t)
conversion to string