LCOV - code coverage report
Current view: top level - src/postprocessors - BoolComponentParameterValuePostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 23 27 85.2 %
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 "BoolComponentParameterValuePostprocessor.h"
      11             : #include "ControllableParameter.h"
      12             : #include "InputParameterWarehouse.h"
      13             : 
      14             : registerMooseObject("ThermalHydraulicsApp", BoolComponentParameterValuePostprocessor);
      15             : 
      16             : InputParameters
      17          18 : BoolComponentParameterValuePostprocessor::validParams()
      18             : {
      19          18 :   InputParameters params = GeneralPostprocessor::validParams();
      20          36 :   params.addRequiredParam<std::string>("component", "The name of the component to be controlled.");
      21          36 :   params.addRequiredParam<std::string>(
      22             :       "parameter", "The name of the parameter in the component to be controlled.");
      23          18 :   params.addClassDescription(
      24             :       "Postprocessor for reading a boolean value from the control logic system.");
      25          18 :   return params;
      26           0 : }
      27             : 
      28           6 : BoolComponentParameterValuePostprocessor::BoolComponentParameterValuePostprocessor(
      29           6 :     const InputParameters & parameters)
      30             :   : GeneralPostprocessor(parameters),
      31          12 :     _input_parameter_warehouse(_app.getInputParameterWarehouse()),
      32          12 :     _component_name(getParam<std::string>("component")),
      33          12 :     _param_name(getParam<std::string>("parameter")),
      34          18 :     _ctrl_param_name("component/" + _component_name + "/" + _param_name)
      35             : {
      36             :   std::vector<bool> values =
      37           6 :       _input_parameter_warehouse.getControllableParameterValues<bool>(_ctrl_param_name);
      38           6 :   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           6 : }
      46             : 
      47             : void
      48          60 : BoolComponentParameterValuePostprocessor::initialize()
      49             : {
      50          60 : }
      51             : 
      52             : void
      53          60 : BoolComponentParameterValuePostprocessor::execute()
      54             : {
      55             :   std::vector<bool> values =
      56          60 :       _input_parameter_warehouse.getControllableParameterValues<bool>(_ctrl_param_name);
      57             : 
      58          60 :   _value = values[0];
      59          60 : }
      60             : 
      61             : Real
      62          60 : BoolComponentParameterValuePostprocessor::getValue() const
      63             : {
      64          60 :   return _value;
      65             : }

Generated by: LCOV version 1.14