LCOV - code coverage report
Current view: top level - src/postprocessors - RealComponentParameterValuePostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 27 28 96.4 %
Date: 2026-05-29 20:41:18 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         340 : RealComponentParameterValuePostprocessor::validParams()
      18             : {
      19         340 :   InputParameters params = GeneralPostprocessor::validParams();
      20         680 :   params.addRequiredParam<std::string>("component", "The name of the component to be controlled.");
      21         680 :   params.addRequiredParam<std::string>(
      22             :       "parameter", "The name of the parameter in the component to be controlled.");
      23         340 :   params.addClassDescription(
      24             :       "Postprocessor for reading a Real (floating point) value from the control logic system.");
      25         340 :   return params;
      26           0 : }
      27             : 
      28         114 : RealComponentParameterValuePostprocessor::RealComponentParameterValuePostprocessor(
      29         114 :     const InputParameters & parameters)
      30             :   : GeneralPostprocessor(parameters),
      31         228 :     _fe_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
      32         114 :     _input_parameter_warehouse(_app.getInputParameterWarehouse()),
      33         228 :     _component_name(getParam<std::string>("component")),
      34         228 :     _param_name(getParam<std::string>("parameter")),
      35         342 :     _ctrl_param_name("component/" + _component_name + "/" + _param_name)
      36             : {
      37             :   std::vector<Real> values =
      38         114 :       _input_parameter_warehouse.getControllableParameterValues<Real>(_ctrl_param_name);
      39         114 :   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         112 : }
      47             : 
      48             : void
      49        1078 : RealComponentParameterValuePostprocessor::initialize()
      50             : {
      51        1078 : }
      52             : 
      53             : void
      54        1078 : RealComponentParameterValuePostprocessor::execute()
      55             : {
      56             :   std::vector<Real> values =
      57        1078 :       _input_parameter_warehouse.getControllableParameterValues<Real>(_ctrl_param_name);
      58             : 
      59        1078 :   _value = values[0];
      60        1078 : }
      61             : 
      62             : Real
      63        1078 : RealComponentParameterValuePostprocessor::getValue() const
      64             : {
      65        1078 :   return _value;
      66             : }

Generated by: LCOV version 1.14