LCOV - code coverage report
Current view: top level - src/chaincontrols - RealToBoolChainControl.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 16 17 94.1 %
Date: 2025-07-17 01:28:37 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       14397 : RealToBoolChainControl::validParams()
      17             : {
      18       14397 :   InputParameters params = ChainControl::validParams();
      19             : 
      20       14397 :   params.addClassDescription("Converts a Real-valued chain control data to boolean.");
      21             : 
      22       14397 :   params.addRequiredParam<std::string>("input",
      23             :                                        "The Real-valued chain control data to convert to boolean.");
      24             : 
      25       14397 :   return params;
      26           0 : }
      27             : 
      28          66 : RealToBoolChainControl::RealToBoolChainControl(const InputParameters & parameters)
      29             :   : ChainControl(parameters),
      30          66 :     _input(getChainControlData<Real>("input")),
      31         132 :     _output(declareChainControlData<bool>("value"))
      32             : {
      33          66 : }
      34             : 
      35             : void
      36         211 : RealToBoolChainControl::execute()
      37             : {
      38         211 :   if (MooseUtils::absoluteFuzzyEqual(_input, 1.0))
      39         107 :     _output = true;
      40         104 :   else if (MooseUtils::absoluteFuzzyEqual(_input, 0.0))
      41         100 :     _output = false;
      42             :   else
      43           4 :     mooseError("The current input value (", _input, ") is not equal to 1 or 0.");
      44         207 : }

Generated by: LCOV version 1.14