https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PiecewiseLinear.C
Go to the documentation of this file.
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
13registerMooseObjectRenamed("MooseApp", ADPiecewiseLinear, "02/03/2024 00:00", PiecewiseLinear);
14
17{
19 params.addParam<bool>(
20 "extrap", false, "If true, extrapolates when sample point is outside of abscissa range");
21 params.addClassDescription("Linearly interpolates between pairs of x-y data");
22 return params;
23}
24
26 : PiecewiseLinearBase(parameters)
27{
28 if (isRawDataLoaded())
29 {
30 this->buildInterpolation(this->template getParam<bool>("extrap"));
32 }
33}
34
35void
37{
40 this->buildInterpolation(this->template getParam<bool>("extrap"));
41 else if (!isRawDataLoaded())
42 mooseError("Data has still not been loaded at setup time. Something has gone wrong during "
43 "Function initialization, contact a developer");
44}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObjectRenamed("MooseApp", ADPiecewiseLinear, "02/03/2024 00:00", PiecewiseLinear)
registerMooseObject("MooseApp", PiecewiseLinear)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
Base class for functions which provides a piecewise continuous linear interpolation of an (x,...
void buildInterpolation(const bool extrap=false)
Builds the linear interpolation object from the x/y data.
static InputParameters validParams()
bool _interpolation_created
Whether the interpolation has been created.
Function which provides a piecewise continuous linear interpolation of a provided (x,...
PiecewiseLinear(const InputParameters &parameters)
void initialSetup() override
Needed to process data from user objects that are not available at construction.
static InputParameters validParams()
void initialSetup() override
Needed to load data from user objects that are not available at construction.
bool isRawDataLoaded() const
Returns whether the raw data has been loaded already.