www.mooseframework.org
Action.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef ACTION_H
16 #define ACTION_H
17 
18 #include "InputParameters.h"
19 #include "ConsoleStreamInterface.h"
20 
21 #include <string>
22 #include <ostream>
23 
24 class Action;
25 class ActionWarehouse;
26 class ActionFactory;
27 class MooseMesh;
28 class FEProblemBase;
29 class Executioner;
30 class MooseApp;
31 class Factory;
32 
33 template <>
35 
40 {
41 public:
43 
44  virtual ~Action() {}
45 
46  virtual void act() = 0;
47 
51  const std::string & name() const { return _name; }
52 
54 
57  std::string getBaseName() const;
58  std::string getShortName() const;
60 
61  const std::string & type() const { return _action_type; }
62 
64  const InputParameters & parameters() const { return _pars; }
65 
66  const std::string & specificTaskName() const { return _specific_task_name; }
67 
68  const std::set<std::string> & getAllTasks() const { return _all_tasks; }
69 
71 
76  template <typename T>
77  const T & getParam(const std::string & name) const;
79 
80  inline bool isParamValid(const std::string & name) const { return _pars.isParamValid(name); }
81 
82  void appendTask(const std::string & task) { _all_tasks.insert(task); }
83 
84 protected:
87 
88  // The registered syntax for this block if any
90 
92  std::string _name;
93 
94  // The type name of this Action instance
95  std::string _action_type;
96 
99 
102 
105 
112  std::string _specific_task_name;
113 
119  std::set<std::string> _all_tasks;
120 
123 
125  const std::string & _current_task;
126 
127  std::shared_ptr<MooseMesh> & _mesh;
128  std::shared_ptr<MooseMesh> & _displaced_mesh;
129 
131  std::shared_ptr<FEProblemBase> & _problem;
132 
134  std::shared_ptr<Executioner> & _executioner;
135 };
136 
137 template <typename T>
138 const T &
139 Action::getParam(const std::string & name) const
140 {
141  return InputParameters::getParamHelper(name, _pars, static_cast<T *>(0));
142 }
143 
144 #endif // ACTION_H
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type)
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Definition: Action.h:122
ActionFactory & _action_factory
Builds Actions.
Definition: Action.h:104
Generic factory class for build all sorts of objects.
Definition: Factory.h:152
const InputParameters & parameters() const
Definition: Action.h:64
Action(InputParameters parameters)
Definition: Action.C:51
Base class for MOOSE-based applications.
Definition: MooseApp.h:58
Storage for action instances.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Factory & _factory
The Factory associated with the MooseApp.
Definition: Action.h:101
InputParameters & parameters()
Definition: Action.h:63
std::string getBaseName() const
Deprecated name methods, use name()
Definition: Action.C:82
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Base class for actions.
Definition: Action.h:39
std::string _name
The name of the action.
Definition: Action.h:92
std::string _specific_task_name
This member will only be populated if this Action instance is only designed to handle one task...
Definition: Action.h:112
std::string _action_type
Definition: Action.h:95
const std::string & type() const
Definition: Action.h:61
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
std::string _registered_identifier
Definition: Action.h:89
const std::string & specificTaskName() const
Definition: Action.h:66
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const std::set< std::string > & getAllTasks() const
Definition: Action.h:68
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:119
std::shared_ptr< MooseMesh > & _displaced_mesh
Definition: Action.h:128
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:70
An inteface for the _console for outputting to the Console object.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
const std::string & _current_task
The current action (even though we have seperate instances for each action)
Definition: Action.h:125
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:41
std::shared_ptr< Executioner > & _executioner
Convenience reference to an executioner.
Definition: Action.h:134
bool isParamValid(const std::string &name) const
Definition: Action.h:80
std::shared_ptr< MooseMesh > & _mesh
Definition: Action.h:127
const std::string & name() const
The name of the action.
Definition: Action.h:51
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:131
virtual void act()=0
virtual ~Action()
Definition: Action.h:44
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:98
std::string getShortName() const
DEPRECATED METHODS.
Definition: Action.C:75
void appendTask(const std::string &task)
Definition: Action.h:82
InputParameters validParams< Action >()
Definition: Action.C:23
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: Action.h:139