A simple implementation of a natural cubic spline.
More...
#include <dumux/common/cubicspline.hh>
template<class Scalar = double>
class Dumux::CubicSpline< Scalar >
A simple implementation of a natural cubic spline.
- Note
- We follow the notation at http://mathworld.wolfram.com/CubicSpline.html
|
| CubicSpline ()=default |
| Default constructor. More...
|
|
| CubicSpline (const std::vector< Scalar > &x, const std::vector< Scalar > y) |
| Construct a natural cubic spline from the control points (x[i], y[i]) More...
|
|
void | updatePoints (const std::vector< Scalar > &x, const std::vector< Scalar > &y) |
| Create a natural cubic spline from the control points (x[i], y[i]) More...
|
|
Scalar | eval (const Scalar x) const |
| Evaluate the y value at a given x value. More...
|
|
Scalar | evalDerivative (const Scalar x) const |
| Evaluate the first derivative dy/dx at a given x value. More...
|
|
◆ CubicSpline() [1/2]
template<class Scalar = double>
◆ CubicSpline() [2/2]
template<class Scalar = double>
Dumux::CubicSpline< Scalar >::CubicSpline |
( |
const std::vector< Scalar > & |
x, |
|
|
const std::vector< Scalar > |
y |
|
) |
| |
|
inline |
Construct a natural cubic spline from the control points (x[i], y[i])
- Parameters
-
x | a vector of x-coordinates |
y | a vector of y-coordinates |
◆ eval()
template<class Scalar = double>
Evaluate the y value at a given x value.
- Parameters
-
- Note
- We extrapolate linearly if out of bounds
◆ evalDerivative()
template<class Scalar = double>
Evaluate the first derivative dy/dx at a given x value.
- Parameters
-
- Note
- We extrapolate linearly if out of bounds
◆ updatePoints()
template<class Scalar = double>
void Dumux::CubicSpline< Scalar >::updatePoints |
( |
const std::vector< Scalar > & |
x, |
|
|
const std::vector< Scalar > & |
y |
|
) |
| |
|
inline |
Create a natural cubic spline from the control points (x[i], y[i])
- Note
- we enforce continuous second derivatives in the inside and zero second derivatives at the boundary
- Parameters
-
x | a vector of x-coordinates |
y | a vector of y-coordinates |
The documentation for this class was generated from the following file: