LCOV - code coverage report
Current view: top level - src/functions - PiecewiseLinear.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 17 20 85.0 %
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 "PiecewiseLinear.h"
      11             : 
      12             : registerMooseObject("MooseApp", PiecewiseLinear);
      13             : registerMooseObjectRenamed("MooseApp", ADPiecewiseLinear, "02/03/2024 00:00", PiecewiseLinear);
      14             : 
      15             : InputParameters
      16       31459 : PiecewiseLinear::validParams()
      17             : {
      18       31459 :   InputParameters params = PiecewiseLinearBase::validParams();
      19       94377 :   params.addParam<bool>(
      20       62918 :       "extrap", false, "If true, extrapolates when sample point is outside of abscissa range");
      21       31459 :   params.addClassDescription("Linearly interpolates between pairs of x-y data");
      22       31459 :   return params;
      23           0 : }
      24             : 
      25        1553 : PiecewiseLinear::PiecewiseLinear(const InputParameters & parameters)
      26        1553 :   : PiecewiseLinearBase(parameters)
      27             : {
      28        1489 :   if (isRawDataLoaded())
      29             :   {
      30        1489 :     this->buildInterpolation(this->template getParam<bool>("extrap"));
      31        1489 :     _interpolation_created = true;
      32             :   }
      33        1489 : }
      34             : 
      35             : void
      36        1456 : PiecewiseLinear::initialSetup()
      37             : {
      38        1456 :   PiecewiseTabularBase::initialSetup();
      39        1456 :   if (isRawDataLoaded() && !_interpolation_created)
      40           0 :     this->buildInterpolation(this->template getParam<bool>("extrap"));
      41        1456 :   else if (!isRawDataLoaded())
      42           0 :     mooseError("Data has still not been loaded at setup time. Something has gone wrong during "
      43             :                "Function initialization, contact a developer");
      44        1456 : }

Generated by: LCOV version 1.14