LCOV - code coverage report
Current view: top level - src/chaincontrols - UnitTripChainControl.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 22 23 95.7 %
Date: 2026-05-29 20:35:17 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        3163 : UnitTripChainControl::validParams()
      16             : {
      17        3163 :   InputParameters params = ChainControl::validParams();
      18             : 
      19        6326 :   params.addClassDescription("Trips a boolean value if an input boolean value is a certain value.");
      20             : 
      21       12652 :   params.addRequiredParam<std::string>("input",
      22             :                                        "The boolean chain control data to determine if tripped");
      23        9489 :   params.addParam<bool>("trip_on_true",
      24        6326 :                         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        6326 :   params.addParam<bool>(
      28        6326 :       "use_old_input", false, "Whether to use the input from the previous time step");
      29             : 
      30        3163 :   return params;
      31           0 : }
      32             : 
      33          51 : UnitTripChainControl::UnitTripChainControl(const InputParameters & parameters)
      34             :   : ChainControl(parameters),
      35          51 :     _trip_on_true(getParam<bool>("trip_on_true")),
      36         174 :     _input(getParam<bool>("use_old_input") ? getChainControlDataOld<bool>("input")
      37         126 :                                            : getChainControlData<bool>("input")),
      38         147 :     _tripped(declareChainControlData<bool>("tripped"))
      39             : {
      40          48 :   _tripped = false;
      41          48 : }
      42             : 
      43             : void
      44         202 : UnitTripChainControl::execute()
      45             : {
      46         202 :   if (_trip_on_true && _input)
      47          44 :     _tripped = true;
      48             : 
      49         202 :   if (!_trip_on_true && !_input)
      50          12 :     _tripped = true;
      51         202 : }

Generated by: LCOV version 1.14