LCOV - code coverage report
Current view: top level - src/postprocessors - RealComponentParameterValuePostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 27 28 96.4 %
Date: 2025-07-30 13:02:48 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14