LCOV - code coverage report
Current view: top level - src/functions - PiecewiseLinear.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 17 20 85.0 %
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 "PiecewiseLinear.h"
      11             : 
      12             : registerMooseObject("MooseApp", PiecewiseLinear);
      13             : registerMooseObjectRenamed("MooseApp", ADPiecewiseLinear, "02/03/2024 00:00", PiecewiseLinear);
      14             : 
      15             : InputParameters
      16        9202 : PiecewiseLinear::validParams()
      17             : {
      18        9202 :   InputParameters params = PiecewiseLinearBase::validParams();
      19       27606 :   params.addParam<bool>(
      20       18404 :       "extrap", false, "If true, extrapolates when sample point is outside of abscissa range");
      21        9202 :   params.addClassDescription("Linearly interpolates between pairs of x-y data");
      22        9202 :   return params;
      23           0 : }
      24             : 
      25        1620 : PiecewiseLinear::PiecewiseLinear(const InputParameters & parameters)
      26        1620 :   : PiecewiseLinearBase(parameters)
      27             : {
      28        1572 :   if (isRawDataLoaded())
      29             :   {
      30        3140 :     this->buildInterpolation(this->template getParam<bool>("extrap"));
      31        1570 :     _interpolation_created = true;
      32             :   }
      33        1572 : }
      34             : 
      35             : void
      36        1534 : PiecewiseLinear::initialSetup()
      37             : {
      38        1534 :   PiecewiseTabularBase::initialSetup();
      39        1534 :   if (isRawDataLoaded() && !_interpolation_created)
      40           0 :     this->buildInterpolation(this->template getParam<bool>("extrap"));
      41        1534 :   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        1534 : }

Generated by: LCOV version 1.14