LCOV - code coverage report
Current view: top level - src/chaincontrols - UnitTripChainControl.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 19 20 95.0 %
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 "UnitTripChainControl.h"
      11             : 
      12             : registerMooseObject("MooseApp", UnitTripChainControl);
      13             : 
      14             : InputParameters
      15       14321 : UnitTripChainControl::validParams()
      16             : {
      17       14321 :   InputParameters params = ChainControl::validParams();
      18             : 
      19       14321 :   params.addClassDescription("Trips a boolean value if an input boolean value is a certain value.");
      20             : 
      21       14321 :   params.addRequiredParam<std::string>("input",
      22             :                                        "The boolean chain control data to determine if tripped");
      23       42963 :   params.addParam<bool>("trip_on_true",
      24       28642 :                         true,
      25             :                         "If set to 'true', the trip occurs if the input has a value of 'true'; "
      26             :                         "else the trip occurs if the input has a value of 'false'.");
      27             : 
      28       14321 :   return params;
      29           0 : }
      30             : 
      31          28 : UnitTripChainControl::UnitTripChainControl(const InputParameters & parameters)
      32             :   : ChainControl(parameters),
      33          28 :     _trip_on_true(getParam<bool>("trip_on_true")),
      34          28 :     _input(getChainControlData<bool>("input")),
      35          52 :     _tripped(declareChainControlData<bool>("tripped"))
      36             : {
      37          24 :   _tripped = false;
      38          24 : }
      39             : 
      40             : void
      41         112 : UnitTripChainControl::execute()
      42             : {
      43         112 :   if (_trip_on_true && _input)
      44          11 :     _tripped = true;
      45             : 
      46         112 :   if (!_trip_on_true && !_input)
      47          12 :     _tripped = true;
      48         112 : }

Generated by: LCOV version 1.14