LCOV - code coverage report
Current view: top level - src/chaincontrols - RealToBoolChainControl.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31730 (e8b711) with base e0c998 Lines: 16 17 94.1 %
Date: 2025-10-29 16:49:47 Functions: 3 3 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 "RealToBoolChainControl.h"
      11             : #include "MooseUtils.h"
      12             : 
      13             : registerMooseObject("MooseApp", RealToBoolChainControl);
      14             : 
      15             : InputParameters
      16       15083 : RealToBoolChainControl::validParams()
      17             : {
      18       15083 :   InputParameters params = ChainControl::validParams();
      19             : 
      20       30166 :   params.addClassDescription("Converts a Real-valued chain control data to boolean.");
      21             : 
      22       45249 :   params.addRequiredParam<std::string>("input",
      23             :                                        "The Real-valued chain control data to convert to boolean.");
      24             : 
      25       15083 :   return params;
      26           0 : }
      27             : 
      28         108 : RealToBoolChainControl::RealToBoolChainControl(const InputParameters & parameters)
      29             :   : ChainControl(parameters),
      30         108 :     _input(getChainControlData<Real>("input")),
      31         324 :     _output(declareChainControlData<bool>("value"))
      32             : {
      33         108 : }
      34             : 
      35             : void
      36         372 : RealToBoolChainControl::execute()
      37             : {
      38         372 :   if (MooseUtils::absoluteFuzzyEqual(_input, 1.0))
      39         163 :     _output = true;
      40         209 :   else if (MooseUtils::absoluteFuzzyEqual(_input, 0.0))
      41         205 :     _output = false;
      42             :   else
      43           4 :     mooseError("The current input value (", _input, ") is not equal to 1 or 0.");
      44         368 : }

Generated by: LCOV version 1.14