LCOV - code coverage report
Current view: top level - src/chaincontrols - LimitChainControl.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 18 19 94.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 "LimitChainControl.h"
      11             : 
      12             : registerMooseObject("MooseApp", LimitChainControl);
      13             : 
      14             : InputParameters
      15        3085 : LimitChainControl::validParams()
      16             : {
      17        3085 :   InputParameters params = ChainControl::validParams();
      18             : 
      19        6170 :   params.addClassDescription("Limits a control value by a range.");
      20             : 
      21       12340 :   params.addRequiredParam<std::string>("control_data", "Control data to limit");
      22        9255 :   params.addParam<Real>(
      23        6170 :       "min_value", std::numeric_limits<Real>::lowest(), "Minimum value for the control data");
      24        6170 :   params.addParam<Real>(
      25        6170 :       "max_value", std::numeric_limits<Real>::max(), "Maximum value for the control data");
      26             : 
      27        3085 :   return params;
      28           0 : }
      29             : 
      30          12 : LimitChainControl::LimitChainControl(const InputParameters & parameters)
      31             :   : ChainControl(parameters),
      32          12 :     _min_value(getParam<Real>("min_value")),
      33          24 :     _max_value(getParam<Real>("max_value")),
      34          24 :     _unlimited_value(getChainControlData<Real>("control_data")),
      35          36 :     _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