LCOV - code coverage report
Current view: top level - src/postprocessors - BoolControlDataValuePostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 20 22 90.9 %
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 "BoolControlDataValuePostprocessor.h"
      11             : #include "THMProblem.h"
      12             : 
      13             : registerMooseObject("ThermalHydraulicsApp", BoolControlDataValuePostprocessor);
      14             : 
      15             : InputParameters
      16         114 : BoolControlDataValuePostprocessor::validParams()
      17             : {
      18         114 :   InputParameters params = GeneralPostprocessor::validParams();
      19         114 :   params.addClassDescription("Output the value of a boolean ControlData as a postprocessor");
      20         228 :   params.addRequiredParam<std::string>("control_data_name",
      21             :                                        "The name of the control data to output.");
      22         114 :   return params;
      23           0 : }
      24             : 
      25          38 : BoolControlDataValuePostprocessor::BoolControlDataValuePostprocessor(
      26          38 :     const InputParameters & parameters)
      27          76 :   : GeneralPostprocessor(parameters), _control_data_name(getParam<std::string>("control_data_name"))
      28             : {
      29             :   THMProblem * thm_problem =
      30         114 :       dynamic_cast<THMProblem *>(getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"));
      31          38 :   if (thm_problem)
      32             :   {
      33          38 :     _thm_problem = thm_problem;
      34          38 :     _control_data_value = _thm_problem->getControlData<bool>(_control_data_name);
      35             :   }
      36             :   else
      37           0 :     mooseError(name(),
      38             :                ": Cannot use BoolControlDataValuePostprocessor without the component system.");
      39          38 : }
      40             : 
      41             : void
      42         262 : BoolControlDataValuePostprocessor::initialize()
      43             : {
      44         262 : }
      45             : 
      46             : void
      47         262 : BoolControlDataValuePostprocessor::execute()
      48             : {
      49         262 : }
      50             : 
      51             : Real
      52         262 : BoolControlDataValuePostprocessor::getValue() const
      53             : {
      54         262 :   if (_control_data_value->get())
      55             :     return 1.;
      56             :   else
      57         106 :     return 0.;
      58             : }

Generated by: LCOV version 1.14