version 3.10-dev
Dumux::CubicSpline< Scalar > Class Template Reference

A simple implementation of a natural cubic spline. More...

#include <dumux/common/cubicspline.hh>

Description

template<class Scalar = double>
class Dumux::CubicSpline< Scalar >
Note
We follow the notation at http://mathworld.wolfram.com/CubicSpline.html

Public Member Functions

 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...
 

Constructor & Destructor Documentation

◆ CubicSpline() [1/2]

template<class Scalar = double>
Dumux::CubicSpline< Scalar >::CubicSpline ( )
default

◆ CubicSpline() [2/2]

template<class Scalar = double>
Dumux::CubicSpline< Scalar >::CubicSpline ( const std::vector< Scalar > &  x,
const std::vector< Scalar >  y 
)
inline
Parameters
xa vector of x-coordinates
ya vector of y-coordinates

Member Function Documentation

◆ eval()

template<class Scalar = double>
Scalar Dumux::CubicSpline< Scalar >::eval ( const Scalar  x) const
inline
Parameters
xthe x-coordinate
Note
We extrapolate linearly if out of bounds

◆ evalDerivative()

template<class Scalar = double>
Scalar Dumux::CubicSpline< Scalar >::evalDerivative ( const Scalar  x) const
inline
Parameters
xthe x-coordinate
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
Note
we enforce continuous second derivatives in the inside and zero second derivatives at the boundary
Parameters
xa vector of x-coordinates
ya vector of y-coordinates

The documentation for this class was generated from the following file: