www.mooseframework.org
Action.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "MooseBase.h"
15 #include "InputParameters.h"
16 #include "MeshMetaDataInterface.h"
17 #include "Registry.h"
18 #include "PerfGraphInterface.h"
19 #include "DataFileInterface.h"
21 
22 #include "libmesh/parallel_object.h"
23 
24 #include <string>
25 #include <ostream>
26 
27 class ActionWarehouse;
28 class ActionFactory;
29 class MooseMesh;
30 class FEProblemBase;
31 class Executioner;
32 class MooseApp;
33 class Factory;
34 
38 class Action : public MooseBase,
41  public MeshMetaDataInterface,
42  public PerfGraphInterface,
44  public DataFileInterface<Action>
45 {
46 public:
48 
50 
51  virtual ~Action() = default;
52 
56  void timedAct();
57 
58 private:
71  bool
73  const InputParameters & moose_object_pars,
74  std::string rm_name,
78 
79 protected:
92  const InputParameters & moose_object_pars);
93 
94 public:
105 
110 
111  const std::string & specificTaskName() const { return _specific_task_name; }
112 
113  const std::set<std::string> & getAllTasks() const { return _all_tasks; }
114 
115  void appendTask(const std::string & task) { _all_tasks.insert(task); }
116 
117 protected:
121  virtual void act() = 0;
122 
137  void associateWithParameter(const std::string & param_name, InputParameters & params) const;
138 
147  void associateWithParameter(const InputParameters & from_params,
148  const std::string & param_name,
149  InputParameters & params) const;
150 
151  // The registered syntax for this block if any
153 
160  std::string _specific_task_name;
161 
167  std::set<std::string> _all_tasks;
168 
171 
173  const std::string & _current_task;
174 
175  std::shared_ptr<MooseMesh> & _mesh;
176  std::shared_ptr<MooseMesh> & _displaced_mesh;
177 
179  std::shared_ptr<FEProblemBase> & _problem;
180 
183 
184  // Base classes have the same name for that attribute, pick one
185  using MooseBase::_app;
186 };
Every object that can be built by the factory should be derived from this class.
Interface for objects that need to resolve data file paths (MooseObject and Action) ...
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:876
Base class for everything in MOOSE with a name and a type.
Definition: MooseBase.h:32
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Definition: Action.h:170
Generic factory class for build all sorts of objects.
Definition: Factory.h:28
Action(const InputParameters &parameters)
Definition: Action.C:43
Interface that provides APIs to output errors/warnings/info messages.
Base class for MOOSE-based applications.
Definition: MooseApp.h:73
Storage for action instances.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool addRelationshipManager(Moose::RelationshipManagerType input_rm_type, const InputParameters &moose_object_pars, std::string rm_name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback rm_input_parameter_func, Moose::RMSystemType sys_type=Moose::RMSystemType::NONE)
Method for adding a single relationship manager.
Definition: Action.C:90
MooseObjectName uniqueActionName() const
The unique name for accessing input parameters of this action in the InputParameterWarehouse.
Definition: Action.h:109
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Base class for actions.
Definition: Action.h:38
unsigned int PerfID
Definition: MooseTypes.h:201
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:160
MooseObjectName uniqueName() const
The unique name for accessing input parameters of this object in the InputParameterWarehouse.
static InputParameters validParams()
Definition: Action.C:24
std::string _registered_identifier
Definition: Action.h:152
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:167
std::shared_ptr< MooseMesh > & _displaced_mesh
Definition: Action.h:176
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
Definition: MooseTypes.h:902
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:50
const std::set< std::string > & getAllTasks() const
Definition: Action.h:113
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
const std::string & _current_task
The current action (even though we have separate instances for each action)
Definition: Action.h:173
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:30
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:84
Interface for objects interacting with the PerfGraph.
std::shared_ptr< MooseMesh > & _mesh
Definition: Action.h:175
RMSystemType
Definition: MooseTypes.h:884
PerfID _act_timer
Timers.
Definition: Action.h:182
void timedAct()
The method called externally that causes the action to act()
Definition: Action.C:83
void associateWithParameter(const std::string &param_name, InputParameters &params) const
Associates the object&#39;s parameters params with the input location from this Action&#39;s parameter with t...
Definition: Action.C:160
bool addRelationshipManagers(Moose::RelationshipManagerType when_type, const InputParameters &moose_object_pars)
Method to add a relationship manager for the objects being added to the system.
Definition: Action.C:138
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:179
const InputParameters & parameters() const
Get the parameters of the object.
virtual void act()=0
Method to add objects to the simulation or perform other setup tasks.
The Interface used to retrieve mesh meta data (attributes) set by the MeshGenerator system...
const std::string & specificTaskName() const
Definition: Action.h:111
A class for storing the names of MooseObject by tag and object name.
void appendTask(const std::string &task)
Definition: Action.h:115
virtual ~Action()=default