https://mooseframework.inl.gov
SetValueChainControl.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 #include "SetValueChainControl.h"
11 #include "MooseUtils.h"
12 #include "MooseApp.h"
13 
16 
17 template <typename T>
20 {
22  params.addRequiredParam<std::string>("parameter", "Parameter(s) to control");
23  params.addRequiredParam<std::string>("value",
24  "Control data to use for the value of the parameter(s)");
25  const std::string type_str = MooseUtils::prettyCppType<T>();
26  params.addClassDescription("Sets parameter(s) of type '" + type_str +
27  "' to a control data value of type '" + type_str + "'.");
28  return params;
29 }
30 
31 template <typename T>
33  : ChainControl(parameters), _value(getChainControlData<T>("value"))
34 {
35 }
36 
37 template <typename T>
38 void
40 {
41  setControllableValue<T>("parameter", _value);
42 }
43 
44 template <typename T>
45 void
47 {
48  if (_app.isRecovering())
49  setControllableValue<T>("parameter", _value);
50 }
virtual void execute() override
Execute the control.
Sets parameter(s) to a control data value.
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
static InputParameters validParams()
Definition: ChainControl.C:14
registerMooseObject("MooseApp", SetRealValueChainControl)
SetValueChainControlTempl(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
virtual void initialSetup() override
Called once at the beginning of the simulation, used to initialize recovered control values...
Control that additionally provides the capability to produce/consume data values, to allow control op...
Definition: ChainControl.h:21