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 "BoolComponentParameterValuePostprocessor.h" 11 : #include "ControllableParameter.h" 12 : #include "InputParameterWarehouse.h" 13 : 14 : registerMooseObject("ThermalHydraulicsApp", BoolComponentParameterValuePostprocessor); 15 : 16 : InputParameters 17 24 : BoolComponentParameterValuePostprocessor::validParams() 18 : { 19 24 : InputParameters params = GeneralPostprocessor::validParams(); 20 48 : params.addRequiredParam<std::string>("component", "The name of the component to be controlled."); 21 48 : params.addRequiredParam<std::string>( 22 : "parameter", "The name of the parameter in the component to be controlled."); 23 24 : params.addClassDescription( 24 : "Postprocessor for reading a boolean value from the control logic system."); 25 24 : return params; 26 0 : } 27 : 28 8 : BoolComponentParameterValuePostprocessor::BoolComponentParameterValuePostprocessor( 29 8 : const InputParameters & parameters) 30 : : GeneralPostprocessor(parameters), 31 16 : _input_parameter_warehouse(_app.getInputParameterWarehouse()), 32 16 : _component_name(getParam<std::string>("component")), 33 16 : _param_name(getParam<std::string>("parameter")), 34 24 : _ctrl_param_name("component/" + _component_name + "/" + _param_name) 35 : { 36 : std::vector<bool> values = 37 8 : _input_parameter_warehouse.getControllableParameterValues<bool>(_ctrl_param_name); 38 8 : if (values.size() == 0) 39 0 : paramError("component", 40 : "Either component '", 41 0 : _component_name, 42 : "' does not exist or parameter '", 43 0 : _param_name, 44 : "' does not exist in that component."); 45 8 : } 46 : 47 : void 48 80 : BoolComponentParameterValuePostprocessor::initialize() 49 : { 50 80 : } 51 : 52 : void 53 80 : BoolComponentParameterValuePostprocessor::execute() 54 : { 55 : std::vector<bool> values = 56 80 : _input_parameter_warehouse.getControllableParameterValues<bool>(_ctrl_param_name); 57 : 58 80 : _value = values[0]; 59 80 : } 60 : 61 : Real 62 80 : BoolComponentParameterValuePostprocessor::getValue() const 63 : { 64 80 : return _value; 65 : }