LCOV - code coverage report
Current view: top level - src/chaincontrols - ScaleOldChainControl.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 17 18 94.4 %
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 "ScaleOldChainControl.h"
      11             : 
      12             : registerMooseObject("MooseApp", ScaleOldChainControl);
      13             : 
      14             : InputParameters
      15       14289 : ScaleOldChainControl::validParams()
      16             : {
      17       14289 :   InputParameters params = ChainControl::validParams();
      18             : 
      19       14289 :   params.addClassDescription("Scales an old control value by another control value.");
      20             : 
      21       14289 :   params.addParam<std::string>("control_data",
      22             :                                "Control data whose old value is to be scaled. If no name is "
      23             :                                "provided, this control data is used.");
      24       14289 :   params.addRequiredParam<std::string>("scale_factor", "Control data by which to scale value");
      25       14289 :   params.addRequiredParam<Real>("initial_value", "Initial value if scaling this control data");
      26             : 
      27       14289 :   return params;
      28           0 : }
      29             : 
      30          12 : ScaleOldChainControl::ScaleOldChainControl(const InputParameters & parameters)
      31             :   : ChainControl(parameters),
      32          12 :     _value(declareChainControlData<Real>("value")),
      33          36 :     _value_old(getChainControlDataOldByName<Real>(isParamValid("control_data")
      34          24 :                                                       ? getParam<std::string>("control_data")
      35             :                                                       : fullControlDataName("value"))),
      36          24 :     _scale_factor(getChainControlData<Real>("scale_factor"))
      37             : {
      38          12 :   _value = getParam<Real>("initial_value");
      39          12 : }
      40             : 
      41             : void
      42          45 : ScaleOldChainControl::execute()
      43             : {
      44          45 :   _value = _scale_factor * _value_old;
      45          45 : }

Generated by: LCOV version 1.14