https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Control.C
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// MOOSE includes
11#include "Control.h"
13#include "FEProblemBase.h"
14
17{
22
23 ExecFlagEnum & exec_enum = params.set<ExecFlagEnum>("execute_on", true);
25 exec_enum = {EXEC_INITIAL, EXEC_TIMESTEP_END};
26
27 params.registerBase("Control");
28
29 params.addParam<std::vector<std::string>>(
30 "depends_on",
31 {},
32 "The Controls that this control relies upon (i.e. must execute before this one)");
33
34 return params;
35}
36
38 : MooseObject(parameters),
41 SetupInterface(this),
44 Restartable(this, "Controls"),
48 _fe_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
49 _depends_on(getParam<std::vector<std::string>>("depends_on")),
50 _input_parameter_warehouse(_app.getInputParameterWarehouse())
51{
53 paramInfo("execute_on",
54 "Controls executed on timestep_end often have undefined behavior when repeating "
55 "timesteps.");
56}
57
60{
61 ::mooseDeprecated("The 'getExecuteOptions' was replaced by the ExecFlagEnum class because MOOSE "
62 "was updated to use this for the execute flags and the new function provides "
63 "additional arguments for modification of the enum.");
65 execute_on = {EXEC_INITIAL, EXEC_TIMESTEP_END};
66 return execute_on;
67}
68
69bool
70Control::hasControllableParameterByName(const std::string & name) const
71{
74}
75
77Control::getControllableParameterByName(const std::string & param_name)
78{
79 MooseObjectParameterName desired(param_name);
80 return getControllableParameterByName(desired);
81}
82
85 const std::string & object_name,
86 const std::string & param_name)
87{
88 MooseObjectParameterName desired(tag, object_name, param_name);
89 return getControllableParameterByName(desired);
90}
91
94 const std::string & param_name)
95{
96 MooseObjectParameterName desired(object_name, param_name);
97 return getControllableParameterByName(desired);
98}
99
102{
104 if (out.empty())
105 mooseError("The desired parameter '",
106 param_name,
107 "' was not located for the '",
108 name(),
109 "' object, it either does not exist or has not been declared as controllable.");
110 out.checkExecuteOnType(_fe_problem.getCurrentExecuteOnFlag());
111 return out;
112}
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP
Definition Moose.C:56
const ExecFlagType EXEC_TIMESTEP_END
Definition Moose.C:36
const ExecFlagType EXEC_INITIAL
Definition Moose.C:30
static InputParameters validParams()
Class constructor.
Definition Control.C:16
static MultiMooseEnum getExecuteOptions()
(DEPRECATED) Return the valid "execute_on" options for Control objects
Definition Control.C:59
ControllableParameter getControllableParameterByName(const std::string &param_name)
Definition Control.C:77
bool hasControllableParameterByName(const std::string &name) const
Definition Control.C:70
InputParameterWarehouse & _input_parameter_warehouse
A reference to the InputParameterWarehouse which is used for access the parameter objects.
Definition Control.h:172
Control(const InputParameters &parameters)
Definition Control.C:37
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this object.
Definition Control.h:76
The ControllableParameter class is simply a set of ControllableItem objects.
bool empty()
Return true if the container is empty.
A MultiMooseEnum object to hold "execute_on" flags.
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
Interface for objects that need to use functions.
static InputParameters validParams()
ControllableParameter getControllableParameter(const MooseObjectParameterName &input) const
Returns a ControllableParameter object that contains all matches to ControllableItem objects for the ...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
bool testReStep() const
Whether or not this simulation should fail a timestep and repeat (for testing).
Definition MooseApp.h:530
void paramInfo(const std::string &param, Args... args) const
Emits an informational message prefixed with the file and line number of the given param (from the in...
Definition MooseBase.h:471
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition MooseBase.h:271
A class for storing the names of MooseObject by tag and object name.
A class for storing an input parameter name.
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
static InputParameters validParams()
Definition MooseObject.C:25
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Interface for objects interacting with the PerfGraph.
Interface class for classes which interact with Postprocessors.
Interface to allow object to consume Reporter values.
A class for creating restricted objects.
Definition Restartable.h:29
static InputParameters validParams()
const ExecFlagEnum & getExecuteOnEnum() const
Return the execute on MultiMooseEnum for this object.
void mooseDeprecated(Args &&... args) const
Interface for objects that needs transient capabilities.
static InputParameters validParams()
Interface for objects that need to use UserObjects.
ExecFlagEnum getDefaultExecFlagEnum()
Definition MooseUtils.C:972