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"
19 
20 #include <string>
21 #include <ostream>
22 
23 class ActionWarehouse;
24 class ActionFactory;
25 class MooseMesh;
26 class FEProblemBase;
27 class Executioner;
28 class MooseApp;
29 class Factory;
30 
34 class Action : public ParallelParamObject,
35  public MeshMetaDataInterface,
36  public PerfGraphInterface,
38 {
39 public:
41  static const std::string unique_action_name_param;
42 
44 
46 
47  virtual ~Action() = default;
48 
52  void timedAct();
53 
54  // To get warnings tracked in the SolutionInvalidityOutput
56 
57 private:
70  bool
72  const InputParameters & moose_object_pars,
73  std::string rm_name,
77 
78 protected:
91  const InputParameters & moose_object_pars);
92 
93 public:
104 
109 
110  const std::string & specificTaskName() const { return _specific_task_name; }
111 
112  const std::set<std::string> & getAllTasks() const { return _all_tasks; }
113 
114  void appendTask(const std::string & task) { _all_tasks.insert(task); }
115 
116 protected:
120  virtual void act() = 0;
121 
136  void associateWithParameter(const std::string & param_name, InputParameters & params) const;
137 
146  void associateWithParameter(const InputParameters & from_params,
147  const std::string & param_name,
148  InputParameters & params) const;
149 
150  // The registered syntax for this block if any
152 
159  std::string _specific_task_name;
160 
166  std::set<std::string> _all_tasks;
167 
170 
172  const std::string & _current_task;
173 
174  std::shared_ptr<MooseMesh> & _mesh;
175  std::shared_ptr<MooseMesh> & _displaced_mesh;
176 
178  std::shared_ptr<FEProblemBase> & _problem;
179 
182 
183  // Base classes have the same name for that attribute, pick one
184  using MooseBase::_app;
185 };
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:964
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Definition: Action.h:169
Generic factory class for build all sorts of objects.
Definition: Factory.h:28
Action(const InputParameters &parameters)
Definition: Action.C:46
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
Base class for MOOSE-based applications.
Definition: MooseApp.h:103
Storage for action instances.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static const std::string unique_action_name_param
The name of the parameter that contains the unique action name.
Definition: Action.h:41
MooseObjectName uniqueName() const
Definition: MooseBase.C:69
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:83
MooseObjectName uniqueActionName() const
The unique name for accessing input parameters of this action in the InputParameterWarehouse.
Definition: Action.h:108
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Base class for actions.
Definition: Action.h:34
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:159
An interface that allows the marking of invalid solutions during a solve.
static InputParameters validParams()
Definition: Action.C:26
std::string _registered_identifier
Definition: Action.h:151
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:166
std::shared_ptr< MooseMesh > & _displaced_mesh
Definition: Action.h:175
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
Definition: MooseTypes.h:990
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:48
const std::set< std::string > & getAllTasks() const
Definition: Action.h:112
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:92
const std::string & _current_task
The current action (even though we have separate instances for each action)
Definition: Action.h:172
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:357
Interface for objects interacting with the PerfGraph.
std::shared_ptr< MooseMesh > & _mesh
Definition: Action.h:174
RMSystemType
Definition: MooseTypes.h:972
PerfID _act_timer
Timers.
Definition: Action.h:181
void timedAct()
The method called externally that causes the action to act()
Definition: Action.C:76
usingCombinedWarningSolutionWarnings
Definition: Action.h:55
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:153
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:131
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:178
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:110
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:114
virtual ~Action()=default