Line data Source code
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 "RealFunctionControl.h" 12 : #include "Function.h" 13 : #include "MooseApp.h" 14 : 15 : registerMooseObject("MooseApp", RealFunctionControl); 16 : 17 : InputParameters 18 3229 : RealFunctionControl::validParams() 19 : { 20 3229 : InputParameters params = Control::validParams(); 21 6458 : params.addClassDescription( 22 : "Sets the value of a 'Real' input parameters to the value of a provided function."); 23 12916 : params.addRequiredParam<FunctionName>( 24 : "function", "The function to use for controlling the specified parameter."); 25 9687 : params.addRequiredParam<std::string>( 26 : "parameter", 27 : "The input parameter(s) to control. Specify a single parameter name and all " 28 : "parameters in all objects matching the name will be updated"); 29 3229 : return params; 30 0 : } 31 : 32 84 : RealFunctionControl::RealFunctionControl(const InputParameters & parameters) 33 168 : : Control(parameters), _function(getFunction("function")) 34 : { 35 84 : } 36 : 37 : void 38 381 : RealFunctionControl::execute() 39 : { 40 381 : const Real value = _function.value(_t); 41 762 : setControllableValue<Real>("parameter", value); 42 381 : } 43 : 44 : void 45 84 : RealFunctionControl::initialSetup() 46 : { 47 84 : if (_app.isRecovering()) 48 : { 49 7 : const Real value = _function.value(_t); 50 21 : setControllableValue<Real>("parameter", value); 51 : } 52 84 : }