LCOV - code coverage report
Current view: top level - src/chaincontrols - UnitTripChainControl.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31730 (e8b711) with base e0c998 Lines: 22 23 95.7 %
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 "UnitTripChainControl.h"
      11             : 
      12             : registerMooseObject("MooseApp", UnitTripChainControl);
      13             : 
      14             : InputParameters
      15       14979 : UnitTripChainControl::validParams()
      16             : {
      17       14979 :   InputParameters params = ChainControl::validParams();
      18             : 
      19       29958 :   params.addClassDescription("Trips a boolean value if an input boolean value is a certain value.");
      20             : 
      21       59916 :   params.addRequiredParam<std::string>("input",
      22             :                                        "The boolean chain control data to determine if tripped");
      23       44937 :   params.addParam<bool>("trip_on_true",
      24       29958 :                         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       29958 :   params.addParam<bool>(
      28       29958 :       "use_old_input", false, "Whether to use the input from the previous time step");
      29             : 
      30       14979 :   return params;
      31           0 : }
      32             : 
      33          56 : UnitTripChainControl::UnitTripChainControl(const InputParameters & parameters)
      34             :   : ChainControl(parameters),
      35          56 :     _trip_on_true(getParam<bool>("trip_on_true")),
      36         190 :     _input(getParam<bool>("use_old_input") ? getChainControlDataOld<bool>("input")
      37         138 :                                            : getChainControlData<bool>("input")),
      38         160 :     _tripped(declareChainControlData<bool>("tripped"))
      39             : {
      40          52 :   _tripped = false;
      41          52 : }
      42             : 
      43             : void
      44         220 : UnitTripChainControl::execute()
      45             : {
      46         220 :   if (_trip_on_true && _input)
      47          48 :     _tripped = true;
      48             : 
      49         220 :   if (!_trip_on_true && !_input)
      50          13 :     _tripped = true;
      51         220 : }

Generated by: LCOV version 1.14