https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PiecewiseLinearBase.h
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#pragma once
11
13
19{
20public:
22
24
25 virtual void initialSetup() override;
26
28 virtual Real value(Real t, const Point & p) const override;
29 virtual ADReal value(const ADReal & t, const ADPoint & p) const override;
30
31 virtual Real timeDerivative(Real t, const Point &) const override;
32 virtual RealGradient gradient(Real, const Point & p) const override;
33 virtual Real integral() const override;
34 virtual Real average() const override;
35 virtual Real timeIntegral(Real t1, Real t2, const Point & p) const override;
36 virtual void setData(const std::vector<Real> & x, const std::vector<Real> & y) override;
37
38protected:
44 void buildInterpolation(const bool extrap = false);
45
47 std::unique_ptr<LinearInterpolation> _linear_interp;
48
51};
DualNumber< Real, DNDerivativeType, true > ADReal
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
Definition Function.C:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Base class for functions which provides a piecewise continuous linear interpolation of an (x,...
virtual Real integral() const override
Returns the integral of the function over its domain.
std::unique_ptr< LinearInterpolation > _linear_interp
helper object to perform the linear interpolation of the function data
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
virtual Real average() const override
Returns the average of the function over its domain.
virtual Real value(Real t, const Point &p) const override
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
virtual RealGradient gradient(Real, const Point &p) const override
Function objects can optionally provide a gradient at a point.
virtual Real timeIntegral(Real t1, Real t2, const Point &p) const override
Computes the time integral at a spatial point between two time values.
void buildInterpolation(const bool extrap=false)
Builds the linear interpolation object from the x/y data.
static InputParameters validParams()
virtual void setData(const std::vector< Real > &x, const std::vector< Real > &y) override
Provides a means for explicitly setting the x and y data.
virtual Real timeDerivative(Real t, const Point &) const override
Get the time derivative of the function.
bool _interpolation_created
Whether the interpolation has been created.
Function base which provides a piecewise approximation to a provided (x,y) point data set via input p...