https://mooseframework.inl.gov
Action.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 "ParallelParamObject.h"
13 #include "InputParameters.h"
14 #include "MeshMetaDataInterface.h"
15 #include "Registry.h"
16 #include "PerfGraphInterface.h"
18 
19 #include <string>
20 #include <ostream>
21 
22 class ActionWarehouse;
23 class ActionFactory;
24 class MooseMesh;
25 class FEProblemBase;
26 class Executioner;
27 class MooseApp;
28 class Factory;
29 
34 {
35 public:
37 
39 
40  virtual ~Action() = default;
41 
45  void timedAct();
46 
47 private:
60  bool
62  const InputParameters & moose_object_pars,
63  std::string rm_name,
67 
68 protected:
81  const InputParameters & moose_object_pars);
82 
83 public:
94 
99 
100  const std::string & specificTaskName() const { return _specific_task_name; }
101 
102  const std::set<std::string> & getAllTasks() const { return _all_tasks; }
103 
104  void appendTask(const std::string & task) { _all_tasks.insert(task); }
105 
106 protected:
110  virtual void act() = 0;
111 
126  void associateWithParameter(const std::string & param_name, InputParameters & params) const;
127 
136  void associateWithParameter(const InputParameters & from_params,
137  const std::string & param_name,
138  InputParameters & params) const;
139 
140  // The registered syntax for this block if any
142 
149  std::string _specific_task_name;
150 
156  std::set<std::string> _all_tasks;
157 
160 
162  const std::string & _current_task;
163 
164  std::shared_ptr<MooseMesh> & _mesh;
165  std::shared_ptr<MooseMesh> & _displaced_mesh;
166 
168  std::shared_ptr<FEProblemBase> & _problem;
169 
172 
173  // Base classes have the same name for that attribute, pick one
174  using MooseBase::_app;
175 };
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:963
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Definition: Action.h:159
Generic factory class for build all sorts of objects.
Definition: Factory.h:28
Action(const InputParameters &parameters)
Definition: Action.C:44
Base class for MOOSE-based applications.
Definition: MooseApp.h:96
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:88
MooseObjectName uniqueActionName() const
The unique name for accessing input parameters of this action in the InputParameterWarehouse.
Definition: Action.h:98
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Base class for actions.
Definition: Action.h:33
unsigned int PerfID
Definition: MooseTypes.h:212
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:149
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:141
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:156
std::shared_ptr< MooseMesh > & _displaced_mesh
Definition: Action.h:165
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
Definition: MooseTypes.h:989
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:50
const std::set< std::string > & getAllTasks() const
Definition: Action.h:102
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:162
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:164
RMSystemType
Definition: MooseTypes.h:971
PerfID _act_timer
Timers.
Definition: Action.h:171
void timedAct()
The method called externally that causes the action to act()
Definition: Action.C:81
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:158
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:136
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:168
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:100
Base class shared by both Action and MooseObject.
A class for storing the names of MooseObject by tag and object name.
void appendTask(const std::string &task)
Definition: Action.h:104
virtual ~Action()=default