LCOV - code coverage report
Current view: top level - src/chaincontrols - LimitChainControl.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 18 19 94.7 %
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 "LimitChainControl.h"
      11             : 
      12             : registerMooseObject("MooseApp", LimitChainControl);
      13             : 
      14             : InputParameters
      15       14289 : LimitChainControl::validParams()
      16             : {
      17       14289 :   InputParameters params = ChainControl::validParams();
      18             : 
      19       14289 :   params.addClassDescription("Limits a control value by a range.");
      20             : 
      21       14289 :   params.addRequiredParam<std::string>("control_data", "Control data to limit");
      22       42867 :   params.addParam<Real>(
      23       28578 :       "min_value", std::numeric_limits<Real>::lowest(), "Minimum value for the control data");
      24       42867 :   params.addParam<Real>(
      25       28578 :       "max_value", std::numeric_limits<Real>::max(), "Maximum value for the control data");
      26             : 
      27       14289 :   return params;
      28           0 : }
      29             : 
      30          12 : LimitChainControl::LimitChainControl(const InputParameters & parameters)
      31             :   : ChainControl(parameters),
      32          12 :     _min_value(getParam<Real>("min_value")),
      33          12 :     _max_value(getParam<Real>("max_value")),
      34          12 :     _unlimited_value(getChainControlData<Real>("control_data")),
      35          24 :     _limited_value(declareChainControlData<Real>("value"))
      36             : {
      37          12 : }
      38             : 
      39             : void
      40         122 : LimitChainControl::execute()
      41             : {
      42         122 :   _limited_value = std::max(std::min(_unlimited_value, _max_value), _min_value);
      43         122 : }

Generated by: LCOV version 1.14