www.mooseframework.org
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ActionWarehouse Class Reference

Storage for action instances. More...

#include <ActionWarehouse.h>

Inheritance diagram for ActionWarehouse:
[legend]

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)
 
Syntaxsyntax ()
 
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< FEProblemproblem ()
 
MooseAppmooseApp ()
 
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
 

Detailed Description

Storage for action instances.

Definition at line 34 of file ActionWarehouse.h.

Constructor & Destructor Documentation

◆ ActionWarehouse()

ActionWarehouse::ActionWarehouse ( MooseApp app,
Syntax syntax,
ActionFactory factory 
)

Definition at line 25 of file ActionWarehouse.C.

27  _app(app),
28  _syntax(syntax),
29  _action_factory(factory),
30  _generator_valid(false),
31  _show_actions(false),
32  _show_parser(false)
33 {
34 }

◆ ~ActionWarehouse()

ActionWarehouse::~ActionWarehouse ( )

Definition at line 36 of file ActionWarehouse.C.

36 {}

Member Function Documentation

◆ actionBlocksWithActionBegin()

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.

171 {
172  return _action_blocks[task].begin();
173 }

Referenced by SetupDampersAction::act(), executeActionsWithAction(), Parser::extractParams(), and CommonOutputAction::hasConsole().

◆ actionBlocksWithActionEnd()

ActionIterator ActionWarehouse::actionBlocksWithActionEnd ( const std::string &  task)

Definition at line 176 of file ActionWarehouse.C.

177 {
178  return _action_blocks[task].end();
179 }

Referenced by SetupDampersAction::act(), executeActionsWithAction(), Parser::extractParams(), and CommonOutputAction::hasConsole().

◆ addActionBlock()

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:

  1. The current Action is registered with multiple syntax blocks. In this case we can only use the current instance to satisfy the specific task listed for this syntax block. We can detect this case by inspecting whether it has a "specific task name" set in the Action instance.
  2. This action does not have a valid "registered identifier" set in the Action instance. This means that this Action was not built by the Parser. It was most likely created through a Meta-Action (See Case 3 for exception). In this case, the ActionFactory itself would have already set the task it found from the build info used to construct the Action so we'd arbitrarily satisify a single task in this case.
  3. The current Action is registered with only a single syntax block. In this case we can simply re-use the current instance to act and satisfy all registered tasks. This is the normal case where we have a Parser-built Action that does not have a specific task name to satisfy. We will use the Action "type" to retrieve the list of tasks that this Action may satisfy.

Definition at line 73 of file ActionWarehouse.C.

74 {
82  std::string registered_identifier =
83  action->parameters().get<std::string>("registered_identifier");
84  std::set<std::string> tasks;
85 
86  if (_show_parser)
87  Moose::err << COLOR_DEFAULT << "Parsing Syntax: " << COLOR_GREEN << action->name()
88  << '\n'
89  << COLOR_DEFAULT << "Building Action: " << COLOR_DEFAULT << action->type()
90  << '\n'
91  << COLOR_DEFAULT << "Registered Identifier: " << COLOR_GREEN << registered_identifier
92  << '\n'
93  << COLOR_DEFAULT << "Specific Task: " << COLOR_CYAN
94  << action->specificTaskName() << '\n';
95 
116  if (action->specificTaskName() != "") // Case 1
117  tasks.insert(action->specificTaskName());
118  else if (registered_identifier == "" &&
119  _syntax.getSyntaxByAction(action->type()).size() > 1) // Case 2
120  {
121  std::set<std::string> local_tasks = action->getAllTasks();
122  mooseAssert(local_tasks.size() == 1, "More than one task inside of the " << action->name());
123  tasks.insert(*local_tasks.begin());
124  }
125  else // Case 3
126  tasks = _action_factory.getTasksByAction(action->type());
127 
128  // TODO: Now we need to weed out the double registrations!
129  for (const auto & task : tasks)
130  {
131  // Some error checking
132  if (!_syntax.hasTask(task))
133  mooseError("A(n) ", task, " is not a registered task");
134 
135  // Make sure that the ObjectAction task and Action task are consistent
136  // otherwise that means that is action was built by the wrong type
137  std::shared_ptr<MooseObjectAction> moa = std::dynamic_pointer_cast<MooseObjectAction>(action);
138  if (moa.get())
139  {
140  const InputParameters & mparams = moa->getObjectParams();
141 
142  if (mparams.have_parameter<std::string>("_moose_base"))
143  {
144  const std::string & base = mparams.get<std::string>("_moose_base");
145 
146  if (!_syntax.verifyMooseObjectTask(base, task))
147  mooseError("Task ", task, " is not registered to build ", base, " derived objects");
148  }
149  else
150  mooseError("Unable to locate registered base parameter for ", moa->getMooseObjectType());
151  }
152 
153  // Add the current task to current action
154  action->appendTask(task);
155 
156  if (_show_parser)
157  Moose::err << COLOR_YELLOW << "Adding Action: " << COLOR_DEFAULT << action->type()
158  << " (" << COLOR_YELLOW << task << COLOR_DEFAULT << ")\n";
159 
160  // Add it to the warehouse
161  _action_blocks[task].push_back(action.get());
162  }
163  _all_ptrs.push_back(action);
164 
165  if (_show_parser)
166  Moose::err << std::endl;
167 }

Referenced by buildBuildableActions(), CommonOutputAction::create(), AddVariableAction::createInitialConditionAction(), MooseApp::createMinimalApp(), CreateExecutionerAction::setupAutoPreconditioning(), and Parser::walkRaw().

◆ allActionBlocks()

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.

183 {
184  return _all_ptrs;
185 }

Referenced by AddRelationshipManager::act().

◆ build()

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.

48 {
50  for (const auto & name : _ordered_names)
52 }

Referenced by MooseApp::createMinimalApp(), and MooseApp::setupOptions().

◆ buildBuildableActions()

void ActionWarehouse::buildBuildableActions ( const std::string &  task)
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).

Parameters
taskThe name of the task to find and build Actions for.

Definition at line 204 of file ActionWarehouse.C.

205 {
206  if (_syntax.shouldAutoBuild(task) && _action_blocks[task].empty())
207  {
208  bool ret_value = false;
209  auto it_pair = _action_factory.getActionsByTask(task);
210  for (const auto & action_pair : as_range(it_pair))
211  {
212  InputParameters params = _action_factory.getValidParams(action_pair.second);
213  params.set<ActionWarehouse *>("awh") = this;
214 
215  if (params.areAllRequiredParamsValid())
216  {
217  params.set<std::string>("registered_identifier") = "(AutoBuilt)";
218  addActionBlock(_action_factory.create(action_pair.second, "", params));
219  ret_value = true;
220  }
221  }
222 
223  if (!ret_value)
224  _unsatisfied_dependencies.insert(task);
225  }
226 }

Referenced by build().

◆ checkUnsatisfiedActions()

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.

230 {
231  std::stringstream oss;
232  bool empty = true;
233 
234  for (const auto & udep : _unsatisfied_dependencies)
235  {
236  if (_action_blocks.find(udep) == _action_blocks.end())
237  {
238  if (empty)
239  empty = false;
240  else
241  oss << " ";
242  oss << udep;
243  }
244  }
245 
246  if (!empty)
247  mooseError(
248  std::string(
249  "The following unsatisfied actions where found while setting up the MOOSE problem:\n") +
250  oss.str() + "\n");
251 }

Referenced by CheckIntegrityAction::act().

◆ clear()

void ActionWarehouse::clear ( )

This method deletes all of the Actions in the warehouse.

Definition at line 55 of file ActionWarehouse.C.

56 {
57  for (auto & ptr : _all_ptrs)
58  ptr.reset();
59 
60  _action_blocks.clear();
61  _generator_valid = false;
62 
63  // Due to the way ActionWarehouse is cleaned up (see MooseApp's
64  // destructor) we must guarantee that ActionWarehouse::clear()
65  // releases all the resources which have to be released _before_ the
66  // _comm object owned by the MooseApp is destroyed.
67  _problem.reset();
68  _displaced_mesh.reset();
69  _mesh.reset();
70 }

Referenced by MooseApp::~MooseApp().

◆ displacedMesh()

std::shared_ptr<MooseMesh>& ActionWarehouse::displacedMesh ( )
inline

◆ empty()

bool ActionWarehouse::empty ( ) const
inline

returns a Boolean indicating whether the warehouse is empty or not.

Definition at line 54 of file ActionWarehouse.h.

54 { return _action_blocks.empty(); }

Referenced by checkUnsatisfiedActions().

◆ executeActionsWithAction()

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.

349 {
350  // Set the current task name
351  _current_task = task;
352 
354  ++_act_iter)
355  {
356  if (_show_actions)
357  _console << "[DBG][ACT] "
358  << "TASK (" << COLOR_YELLOW << std::setw(24) << task << COLOR_DEFAULT << ") "
359  << "TYPE (" << COLOR_YELLOW << std::setw(32) << (*_act_iter)->type() << COLOR_DEFAULT
360  << ") "
361  << "NAME (" << COLOR_YELLOW << std::setw(16) << (*_act_iter)->name() << COLOR_DEFAULT
362  << ")" << std::endl;
363 
364  (*_act_iter)->timedAct();
365  }
366 }

Referenced by executeAllActions().

◆ 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.

327 {
328  if (_show_actions)
329  {
330  _console << "[DBG][ACT] Action Dependency Sets:\n";
332 
333  _console << "\n[DBG][ACT] Executing actions:" << std::endl;
334  }
335 
336  for (const auto & task : _ordered_names)
337  {
339  if (_final_task != "" && task == _final_task)
340  break;
341  }
342 
343  if (_show_actions)
344  _console << "[DBG][ACT] Finished executing all actions" << std::endl;
345 }

Referenced by MooseApp::runInputFile().

◆ getAction()

template<class T >
const T& ActionWarehouse::getAction ( const std::string &  name)
inline

Retrieve an action with its name and the desired type.

Parameters
nameThe action name.

Definition at line 110 of file ActionWarehouse.h.

111  {
112  typename std::shared_ptr<T> p;
113  for (auto act_ptr : _all_ptrs)
114  {
115  if (act_ptr->name() == name)
116  {
117  p = std::dynamic_pointer_cast<T>(act_ptr);
118  if (p)
119  break;
120  }
121  }
122  if (!p)
123  mooseError("Action with name being ", name, " does not exist");
124  return *p;
125  }

◆ getActionByTask()

template<class T >
const T* ActionWarehouse::getActionByTask ( const std::string &  task)
inline

Retrieve the action on a specific task with its type.

Error will be thrown if more than one actions are found.

Parameters
taskThe task name.
Returns
The action pointer. Null means that such an action does not exist.

Definition at line 156 of file ActionWarehouse.h.

157  {
158  const auto it = _action_blocks.find(task);
159  if (it == _action_blocks.end())
160  return nullptr;
161 
162  T * p = nullptr;
163  for (const auto & action : it->second)
164  {
165  T * tp = dynamic_cast<T *>(action);
166  if (tp)
167  {
168  if (p)
169  mooseError("More than one actions have been detected in getActionByTask");
170  else
171  p = tp;
172  }
173  }
174  return p;
175  }

Referenced by CreateProblemDefaultAction::act().

◆ getActionListByName()

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.

189 {
190  const auto it = _action_blocks.find(task);
191  if (it == _action_blocks.end())
192  return _empty_action_list;
193  else
194  return it->second;
195 }

Referenced by SetupMeshAction::act(), MaterialOutputAction::act(), Console::Console(), MooseApp::getCheckpointDirectories(), OutputWarehouse::getOutputNames(), and MooseApp::setupOptions().

◆ getActions()

template<class T >
std::vector<const T *> ActionWarehouse::getActions ( )
inline

Retrieve all actions in a specific type ordered by their names.

Definition at line 131 of file ActionWarehouse.h.

132  {
133  // we need to create the map first to ensure that all actions in the map are unique
134  // and the actions are sorted by their names
135  typename std::map<std::string, const std::shared_ptr<T>> actions;
136  for (auto act_ptr : _all_ptrs)
137  {
138  auto p = std::dynamic_pointer_cast<T>(act_ptr);
139  if (p)
140  actions.insert(std::make_pair(act_ptr->name(), p));
141  }
142  // construct the vector from the map entries
143  std::vector<const T *> action_vector;
144  for (auto & pair : actions)
145  action_vector.push_back(pair.second.get());
146  return action_vector;
147  }

◆ getCurrentActionName()

std::string ActionWarehouse::getCurrentActionName ( ) const

Definition at line 419 of file ActionWarehouse.C.

420 {
421  return (*_act_iter)->parameters().blockFullpath();
422 }

Referenced by DumpObjectsProblem::dumpObjectHelper(), and DumpObjectsProblem::dumpVariableHelper().

◆ getCurrentTaskName()

const std::string& ActionWarehouse::getCurrentTaskName ( ) const
inline

Definition at line 222 of file ActionWarehouse.h.

222 { return _current_task; }

◆ getDisplacedMesh()

const std::shared_ptr<MooseMesh>& ActionWarehouse::getDisplacedMesh ( ) const
inline

Definition at line 217 of file ActionWarehouse.h.

217 { return _displaced_mesh; }

◆ getMesh()

const std::shared_ptr<MooseMesh>& ActionWarehouse::getMesh ( ) const
inline

Definition at line 214 of file ActionWarehouse.h.

214 { return _mesh; }

Referenced by MooseApp::getRelationshipManagerInfo().

◆ hasActions()

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.

199 {
200  return _action_blocks.find(task) != _action_blocks.end();
201 }

Referenced by CreateExecutionerAction::act(), MaterialOutputAction::act(), and OutputWarehouse::getOutputNames().

◆ mesh()

std::shared_ptr<MooseMesh>& ActionWarehouse::mesh ( )
inline

◆ mooseApp()

MooseApp& ActionWarehouse::mooseApp ( )
inline

Definition at line 221 of file ActionWarehouse.h.

221 { return _app; }

Referenced by ExodusFormatter::printInputFile().

◆ printActionDependencySets()

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.

255 {
265  std::ostringstream oss;
266 
267  const auto & ordered_names = _syntax.getSortedTaskSet();
268  for (const auto & task_vector : ordered_names)
269  {
270  oss << "[DBG][ACT] (" << COLOR_YELLOW;
271  std::copy(
272  task_vector.begin(), task_vector.end(), infix_ostream_iterator<std::string>(oss, ", "));
273  oss << COLOR_DEFAULT << ")\n";
274 
275  std::set<std::string> task_set(task_vector.begin(), task_vector.end());
276  for (const auto & task : task_set)
277  {
278  if (_action_blocks.find(task) == _action_blocks.end())
279  continue;
280 
281  for (const auto & act : _action_blocks.at(task))
282  {
283  // The Syntax of the Action if it exists
284  if (act->name() != "")
285  oss << "[DBG][ACT]\t" << COLOR_GREEN << act->name() << COLOR_DEFAULT << '\n';
286 
287  // The task sets
288  oss << "[DBG][ACT]\t" << act->type();
289  const std::set<std::string> tasks = act->getAllTasks();
290  if (tasks.size() > 1)
291  {
292  oss << " (";
293  // Break the current Action's tasks into 2 sets, those intersecting with current set and
294  // then the difference.
295  std::set<std::string> intersection, difference;
296  std::set_intersection(tasks.begin(),
297  tasks.end(),
298  task_set.begin(),
299  task_set.end(),
300  std::inserter(intersection, intersection.end()));
301  std::set_difference(tasks.begin(),
302  tasks.end(),
303  intersection.begin(),
304  intersection.end(),
305  std::inserter(difference, difference.end()));
306 
307  oss << COLOR_CYAN;
308  std::copy(intersection.begin(),
309  intersection.end(),
311  oss << COLOR_MAGENTA << (difference.empty() ? "" : ", ");
312  std::copy(
313  difference.begin(), difference.end(), infix_ostream_iterator<std::string>(oss, ", "));
314  oss << COLOR_DEFAULT << ")";
315  }
316  oss << '\n';
317  }
318  }
319  }
320 
321  if (_show_actions)
322  _console << oss.str() << std::endl;
323 }

Referenced by executeAllActions().

◆ printInputFile()

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.

Parameters
outA writable ostream object where the output will be sent.

Definition at line 369 of file ActionWarehouse.C.

370 {
371  InputFileFormatter tree(false);
372 
373  std::map<std::string, std::vector<Action *>>::iterator iter;
374 
375  std::vector<Action *> ordered_actions;
376  for (const auto & block : _action_blocks)
377  for (const auto & act : block.second)
378  ordered_actions.push_back(act);
379 
380  for (const auto & act : ordered_actions)
381  {
382  std::string name;
383  if (act->parameters().blockFullpath() != "")
384  name = act->parameters().blockFullpath();
385  else
386  name = act->name();
387  const std::set<std::string> & tasks = act->getAllTasks();
388  mooseAssert(!tasks.empty(), "Task list is empty");
389 
390  bool is_parent;
391  if (_syntax.isAssociated(name, &is_parent) != "")
392  {
393  InputParameters params = act->parameters();
394 
395  // TODO: Do we need to insert more nodes for each task?
396  tree.insertNode(name, *tasks.begin(), true, &params);
397 
398  MooseObjectAction * moose_object_action = dynamic_cast<MooseObjectAction *>(act);
399  if (moose_object_action)
400  {
401  InputParameters obj_params = moose_object_action->getObjectParams();
402  tree.insertNode(name, *tasks.begin(), false, &obj_params);
403  }
404  }
405  }
406 
407  out << tree.print("");
408 }

Referenced by Console::outputInput(), and ExodusFormatter::printInputFile().

◆ problem()

std::shared_ptr< FEProblem > ActionWarehouse::problem ( )

Definition at line 411 of file ActionWarehouse.C.

412 {
414  "ActionWarehouse::problem() is deprecated, please use ActionWarehouse::problemBase() \n");
415  return std::dynamic_pointer_cast<FEProblem>(_problem);
416 }

◆ problemBase()

std::shared_ptr<FEProblemBase>& ActionWarehouse::problemBase ( )
inline

Definition at line 219 of file ActionWarehouse.h.

219 { return _problem; }

Referenced by Factory::create().

◆ setFinalTask()

void ActionWarehouse::setFinalTask ( const std::string &  task)

Definition at line 39 of file ActionWarehouse.C.

40 {
41  if (!_syntax.hasTask(task))
42  mooseError("cannot use unregistered task '", task, "' as final task");
43  _final_task = task;
44 }

Referenced by MooseApp::setupOptions().

◆ showActions()

void ActionWarehouse::showActions ( bool  state = true)
inline

This method sets a Boolean which is used to show debugging information during various warehouse operations during the problem setup phase.

Parameters
stateFlag indicating whether to show action information.

Definition at line 201 of file ActionWarehouse.h.

201 { _show_actions = state; }

Referenced by SetupDebugAction::SetupDebugAction().

◆ showParser()

void ActionWarehouse::showParser ( bool  state = true)
inline

Definition at line 203 of file ActionWarehouse.h.

203 { _show_parser = state; }

Referenced by SetupDebugAction::SetupDebugAction().

◆ syntax()

Syntax& ActionWarehouse::syntax ( )
inline

Definition at line 206 of file ActionWarehouse.h.

206 { return _syntax; }

Referenced by DynamicObjectRegistrationAction::DynamicObjectRegistrationAction().

Member Data Documentation

◆ _act_iter

ActionIterator ActionWarehouse::_act_iter
private

Definition at line 283 of file ActionWarehouse.h.

Referenced by executeActionsWithAction().

◆ _action_blocks

std::map<std::string, std::list<Action *> > ActionWarehouse::_action_blocks
protected

◆ _action_factory

ActionFactory& ActionWarehouse::_action_factory
protected

The Factory that builds Actions.

Definition at line 243 of file ActionWarehouse.h.

Referenced by addActionBlock(), and buildBuildableActions().

◆ _all_ptrs

std::vector<std::shared_ptr<Action> > ActionWarehouse::_all_ptrs
protected

Definition at line 236 of file ActionWarehouse.h.

Referenced by addActionBlock(), allActionBlocks(), clear(), getAction(), and getActions().

◆ _app

MooseApp& ActionWarehouse::_app
protected

The MooseApp this Warehouse is associated with.

Definition at line 239 of file ActionWarehouse.h.

Referenced by mooseApp().

◆ _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(), 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().

◆ _current_task

std::string ActionWarehouse::_current_task
protected

Definition at line 264 of file ActionWarehouse.h.

Referenced by executeActionsWithAction(), and getCurrentTaskName().

◆ _displaced_mesh

std::shared_ptr<MooseMesh> ActionWarehouse::_displaced_mesh
protected

Possible mesh for displaced problem.

Definition at line 274 of file ActionWarehouse.h.

Referenced by clear(), displacedMesh(), and getDisplacedMesh().

◆ _empty_action_list

const std::list<Action *> ActionWarehouse::_empty_action_list
private

Definition at line 285 of file ActionWarehouse.h.

Referenced by getActionListByName().

◆ _final_task

std::string ActionWarehouse::_final_task
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().

◆ _generator_valid

bool ActionWarehouse::_generator_valid
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().

◆ _mesh

std::shared_ptr<MooseMesh> ActionWarehouse::_mesh
protected

Mesh class.

Definition at line 271 of file ActionWarehouse.h.

Referenced by clear(), getMesh(), and mesh().

◆ _ordered_names

std::vector<std::string> ActionWarehouse::_ordered_names
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().

◆ _problem

std::shared_ptr<FEProblemBase> ActionWarehouse::_problem
protected

Problem class.

Definition at line 277 of file ActionWarehouse.h.

Referenced by clear(), problem(), and problemBase().

◆ _show_actions

bool ActionWarehouse::_show_actions
protected

◆ _show_parser

bool ActionWarehouse::_show_parser
protected

Definition at line 260 of file ActionWarehouse.h.

Referenced by addActionBlock(), and showParser().

◆ _syntax

Syntax& ActionWarehouse::_syntax
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().

◆ _unsatisfied_dependencies

std::set<std::string> ActionWarehouse::_unsatisfied_dependencies
protected

Use to store the current list of unsatisfied dependencies.

Definition at line 249 of file ActionWarehouse.h.

Referenced by buildBuildableActions(), and checkUnsatisfiedActions().


The documentation for this class was generated from the following files:
Syntax::getSortedTask
const std::vector< std::string > & getSortedTask()
Get a list of serialized tasks in a correct dependency order.
Definition: Syntax.C:100
ActionFactory::getTasksByAction
std::set< std::string > getTasksByAction(const std::string &action) const
Definition: ActionFactory.C:133
ActionFactory::getValidParams
InputParameters getValidParams(const std::string &name)
Definition: ActionFactory.C:70
ActionWarehouse::printActionDependencySets
void printActionDependencySets() const
This method is used only during debugging when show_actions is set to true.
Definition: ActionWarehouse.C:254
Syntax::getSyntaxByAction
std::vector< std::string > getSyntaxByAction(const std::string &action, const std::string &task="")
Retrieve the syntax associated with the passed in action type string.
Definition: Syntax.C:192
Syntax::hasTask
bool hasTask(const std::string &task) const
Returns a Boolean indicating whether or not a task is registered with the syntax object.
Definition: Syntax.C:112
ActionWarehouse::_generator_valid
bool _generator_valid
Flag to indicate whether or not there is an active iterator on this class.
Definition: ActionWarehouse.h:256
ActionWarehouse::addActionBlock
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse.
Definition: ActionWarehouse.C:73
Syntax::isAssociated
std::string isAssociated(const std::string &real_id, bool *is_parent) const
Method for determining whether a piece of syntax is associated with an Action TODO: I need a better n...
Definition: Syntax.C:218
ActionWarehouse::empty
bool empty() const
returns a Boolean indicating whether the warehouse is empty or not.
Definition: ActionWarehouse.h:54
ActionWarehouse::_app
MooseApp & _app
The MooseApp this Warehouse is associated with.
Definition: ActionWarehouse.h:239
ActionWarehouse::_syntax
Syntax & _syntax
Reference to a "syntax" of actions.
Definition: ActionWarehouse.h:241
ActionWarehouse::_current_task
std::string _current_task
Definition: ActionWarehouse.h:264
ConsoleStreamInterface::_console
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
Definition: ConsoleStreamInterface.h:31
mooseError
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition: MooseError.h:210
ActionWarehouse
Storage for action instances.
Definition: ActionWarehouse.h:34
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
InputParameters::set
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Definition: InputParameters.h:987
ActionWarehouse::_problem
std::shared_ptr< FEProblemBase > _problem
Problem class.
Definition: ActionWarehouse.h:277
ActionFactory::getActionsByTask
std::pair< std::multimap< std::string, std::string >::const_iterator, std::multimap< std::string, std::string >::const_iterator > getActionsByTask(const std::string &task) const
Definition: ActionFactory.C:127
ActionWarehouse::syntax
Syntax & syntax()
Definition: ActionWarehouse.h:206
ActionWarehouse::_show_parser
bool _show_parser
Definition: ActionWarehouse.h:260
InputParameters::areAllRequiredParamsValid
bool areAllRequiredParamsValid() const
This method returns true if all of the parameters in this object are valid (i.e.
Definition: InputParameters.C:282
ActionFactory::create
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters &parameters)
Definition: ActionFactory.C:41
Syntax::shouldAutoBuild
bool shouldAutoBuild(const std::string &task) const
Returns a Boolean indicating whether MOOSE should attempt to automatically create an Action to satisf...
Definition: Syntax.C:125
ActionWarehouse::buildBuildableActions
void buildBuildableActions(const std::string &task)
This method auto-builds all Actions that needs to be built and adds them to ActionWarehouse.
Definition: ActionWarehouse.C:204
Syntax::verifyMooseObjectTask
bool verifyMooseObjectTask(const std::string &base, const std::string &task) const
Returns a Boolean indicating whether a task is associated with on of the MOOSE pluggable systems (BAS...
Definition: Syntax.C:286
mooseDeprecated
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:239
ActionWarehouse::_act_iter
ActionIterator _act_iter
Definition: ActionWarehouse.h:283
ActionWarehouse::actionBlocksWithActionEnd
ActionIterator actionBlocksWithActionEnd(const std::string &task)
Definition: ActionWarehouse.C:176
ActionWarehouse::_displaced_mesh
std::shared_ptr< MooseMesh > _displaced_mesh
Possible mesh for displaced problem.
Definition: ActionWarehouse.h:274
ActionWarehouse::actionBlocksWithActionBegin
ActionIterator actionBlocksWithActionBegin(const std::string &task)
Iterators to the Actions in the warehouse.
Definition: ActionWarehouse.C:170
MooseObjectAction::getObjectParams
InputParameters & getObjectParams()
Retreive the parameters of the object to be created by this action.
Definition: MooseObjectAction.h:34
ActionWarehouse::_mesh
std::shared_ptr< MooseMesh > _mesh
Mesh class.
Definition: ActionWarehouse.h:271
ActionWarehouse::_final_task
std::string _final_task
Last task to run before (optional) early termination - blank means no early termination.
Definition: ActionWarehouse.h:281
Syntax::getSortedTaskSet
const std::vector< std::vector< std::string > > & getSortedTaskSet()
Get a list of serialized tasks in a correct dependency order.
Definition: Syntax.C:106
ActionWarehouse::_ordered_names
std::vector< std::string > _ordered_names
The container that holds the sorted action names from the DependencyResolver.
Definition: ActionWarehouse.h:247
ActionWarehouse::_unsatisfied_dependencies
std::set< std::string > _unsatisfied_dependencies
Use to store the current list of unsatisfied dependencies.
Definition: ActionWarehouse.h:249
ActionWarehouse::_action_factory
ActionFactory & _action_factory
The Factory that builds Actions.
Definition: ActionWarehouse.h:243
ActionWarehouse::_action_blocks
std::map< std::string, std::list< Action * > > _action_blocks
Pointers to the actual parsed input file blocks.
Definition: ActionWarehouse.h:245
MooseObjectAction
Definition: MooseObjectAction.h:21
ActionWarehouse::executeActionsWithAction
void executeActionsWithAction(const std::string &name)
This method executes only the actions in the warehouse that satisfy the task passed in.
Definition: ActionWarehouse.C:348
ActionWarehouse::_empty_action_list
const std::list< Action * > _empty_action_list
Definition: ActionWarehouse.h:285
ActionWarehouse::_all_ptrs
std::vector< std::shared_ptr< Action > > _all_ptrs
Definition: ActionWarehouse.h:236
ActionWarehouse::_show_actions
bool _show_actions
Definition: ActionWarehouse.h:259
InputFileFormatter
This class produces produces a dump of the InputFileParameters that appears like the normal input fil...
Definition: InputFileFormatter.h:18
infix_ostream_iterator
Definition: InfixIterator.h:19
ConsoleStreamInterface::ConsoleStreamInterface
ConsoleStreamInterface(MooseApp &app)
A class for providing a helper stream object for writting message to all the Output objects.
Definition: ConsoleStreamInterface.C:14