https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SplineInterpolation.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#include <string>
14
21{
22public:
33 SplineInterpolation(const std::vector<Real> & x,
34 const std::vector<Real> & y,
35 Real yp1 = _deriv_bound,
36 Real ypn = _deriv_bound);
37
38 virtual ~SplineInterpolation() = default;
39
43 void setData(const std::vector<Real> & x,
44 const std::vector<Real> & y,
45 Real yp1 = _deriv_bound,
46 Real ypn = _deriv_bound);
47
48 void errorCheck();
49
54 Real sample(Real x) const;
55 ADReal sample(const ADReal & x) const;
56
57 Real sampleDerivative(Real x) const;
58
59 Real sample2ndDerivative(Real x) const;
60
65 unsigned int getSampleSize();
66
67 Real domain(int i) const;
68 Real range(int i) const;
69
70protected:
71 std::vector<Real> _x;
72 std::vector<Real> _y;
74 Real _yp1, _ypn;
76 std::vector<Real> _y2;
77
78 void solve();
79
80 static int _file_number;
81};
DualNumber< Real, DNDerivativeType, true > ADReal
This class interpolates tabulated functions with cubic splines.
Real _yp1
boundary conditions
std::vector< Real > _y2
Second derivatives.
virtual ~SplineInterpolation()=default
Real domain(int i) const
Real sampleDerivative(Real x) const
Real sample(Real x) const
This function will take an independent variable input and will return the dependent variable based on...
std::vector< Real > _x
void setData(const std::vector< Real > &x, const std::vector< Real > &y, Real yp1=_deriv_bound, Real ypn=_deriv_bound)
Set the x-, y- values and first derivatives.
Real sample2ndDerivative(Real x) const
std::vector< Real > _y
unsigned int getSampleSize()
This function returns the size of the array holding the points, i.e.
Real range(int i) const