www.mooseframework.org
Control.C
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 // MOOSE includes
11 #include "Control.h"
13 
14 template <>
17 {
20  params += validParams<SetupInterface>();
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  "The Controls that this control relies upon (i.e. must execute before this one)");
32 
33  return params;
34 }
35 
36 Control::Control(const InputParameters & parameters)
37  : MooseObject(parameters),
38  TransientInterface(this),
39  SetupInterface(this),
40  FunctionInterface(this),
41  UserObjectInterface(this),
42  Restartable(this, "Controls"),
45  _fe_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
46  _depends_on(getParam<std::vector<std::string>>("depends_on")),
47  _input_parameter_warehouse(_app.getInputParameterWarehouse())
48 {
49 }
50 
53 {
54  ::mooseDeprecated("The 'getExecuteOptions' was replaced by the ExecFlagEnum class because MOOSE "
55  "was updated to use this for the execute flags and the new function provides "
56  "additional arguments for modification of the enum.");
58  execute_on = {EXEC_INITIAL, EXEC_TIMESTEP_END};
59  return execute_on;
60 }
61 
63 Control::getControllableParameterByName(const std::string & param_name)
64 {
65  MooseObjectParameterName desired(param_name);
66  return getControllableParameterByName(desired);
67 }
68 
71  const std::string & object_name,
72  const std::string & param_name)
73 {
74  MooseObjectParameterName desired(tag, object_name, param_name);
75  return getControllableParameterByName(desired);
76 }
77 
80  const std::string & param_name)
81 {
82  MooseObjectParameterName desired(object_name, param_name);
83  return getControllableParameterByName(desired);
84 }
85 
88 {
90  if (out.empty())
91  mooseError("The desired parameter '",
92  param_name,
93  "' was not located for the '",
94  name(),
95  "' object, it either does not exist or has not been declared as controllable.");
97  return out;
98 }
bool empty()
Return true if the container is empty.
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:24
A class for creating restricted objects.
Definition: Restartable.h:29
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
The ControllableParameter class is simply a set of ControllableItem objects.
InputParameterWarehouse & _input_parameter_warehouse
A reference to the InputParameterWarehouse which is used for access the parameter objects...
Definition: Control.h:166
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Definition: ExecFlagEnum.h:84
InputParameters validParams< SetupInterface >()
const ExecFlagType EXEC_TIMESTEP_END
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
InputParameters validParams< FunctionInterface >()
ExecFlagEnum getDefaultExecFlagEnum()
Return the default ExecFlagEnum for MOOSE.
Definition: MooseUtils.C:667
void checkExecuteOnType(const ExecFlagType &current) const
Check the execute flags.
Interface for objects that needs transient capabilities.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this object.
Definition: Control.h:75
ControllableParameter getControllableParameter(const MooseObjectParameterName &input) const
Returns a ControllableParameter object that contains all matches to ControllableItem objects for the ...
Interface for objects that need to use UserObjects.
InputParameters validParams< Control >()
Definition: Control.C:16
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:25
static MultiMooseEnum getExecuteOptions()
(DEPRECATED) Return the valid "execute_on" options for Control objects
Definition: Control.C:52
Control(const InputParameters &parameters)
Class constructor.
Definition: Control.C:36
void mooseDeprecated(Args &&... args) const
Definition: MooseObject.h:161
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
ControllableParameter getControllableParameterByName(const std::string &param_name)
Definition: Control.C:63
A class for storing an input parameter name.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
A class for storing the names of MooseObject by tag and object name.
Interface for objects that need to use functions.
InputParameters validParams< TransientInterface >()
Interface class for classes which interact with Postprocessors.
const ExecFlagType EXEC_INITIAL