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 : #include "BoolFunctionControl.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", BoolFunctionControl); 14 : 15 : InputParameters 16 14289 : BoolFunctionControl::validParams() 17 : { 18 14289 : InputParameters params = Control::validParams(); 19 14289 : params.addClassDescription( 20 : "Sets the value of a 'bool' input parameters to the value of a provided function."); 21 14289 : params.addRequiredParam<FunctionName>( 22 : "function", "The function to use for controlling the specified parameter."); 23 14289 : params.addRequiredParam<std::string>( 24 : "parameter", 25 : "The input parameter(s) to control. Specify a single parameter name and all " 26 : "parameters in all objects matching the name will be updated"); 27 14289 : return params; 28 0 : } 29 : 30 12 : BoolFunctionControl::BoolFunctionControl(const InputParameters & parameters) 31 12 : : Control(parameters), _function(getFunction("function")) 32 : { 33 12 : } 34 : 35 : void 36 110 : BoolFunctionControl::execute() 37 : { 38 110 : Real value = _function.value(_t); 39 110 : setControllableValue<bool>("parameter", value != 0.); 40 110 : }