3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Public Member Functions | List of all members
Dumux::MonotoneCubicSpline< Scalar > Class Template Reference

A monotone cubic spline. More...

#include <dumux/common/monotonecubicspline.hh>

Inheritance diagram for Dumux::MonotoneCubicSpline< Scalar >:

Description

template<class Scalar = double>
class Dumux::MonotoneCubicSpline< Scalar >

A monotone cubic spline.

Note
Construction after Fritsch & Butland (1984) (see https://doi.org/10.1137/0905021)
The resulting interpolation is globally monotone but only C^1

Public Member Functions

 MonotoneCubicSpline ()=default
 Default constructor. More...
 
 MonotoneCubicSpline (const std::vector< Scalar > &x, const std::vector< Scalar > &y)
 Construct a monotone 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 monotone 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...
 
Scalar evalInverse (const Scalar y) const
 Evaluate the inverse function. More...
 

Constructor & Destructor Documentation

◆ MonotoneCubicSpline() [1/2]

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

Default constructor.

◆ MonotoneCubicSpline() [2/2]

template<class Scalar = double>
Dumux::MonotoneCubicSpline< Scalar >::MonotoneCubicSpline ( const std::vector< Scalar > &  x,
const std::vector< Scalar > &  y 
)
inline

Construct a monotone cubic spline from the control points (x[i], y[i])

Note
if the data set is monotone, monotonicity is preserved
Parameters
xa vector of x-coordinates
ya vector of y-coordinates

Member Function Documentation

◆ eval()

template<class Scalar = double>
Scalar Dumux::MonotoneCubicSpline< Scalar >::eval ( const Scalar  x) const
inline

Evaluate the y value at a given x value.

Parameters
xthe x-coordinate
Note
We extrapolate linearly if out of bounds

◆ evalDerivative()

template<class Scalar = double>
Scalar Dumux::MonotoneCubicSpline< Scalar >::evalDerivative ( const Scalar  x) const
inline

Evaluate the first derivative dy/dx at a given x value.

Parameters
xthe x-coordinate
Note
We extrapolate linearly if out of bounds

◆ evalInverse()

template<class Scalar = double>
Scalar Dumux::MonotoneCubicSpline< Scalar >::evalInverse ( const Scalar  y) const
inline

Evaluate the inverse function.

Parameters
ythe y-coordinate
Note
We extrapolate linearly if out of bounds
Throws exception if inverse could not be found (e.g. not unique)

◆ updatePoints()

template<class Scalar = double>
void Dumux::MonotoneCubicSpline< Scalar >::updatePoints ( const std::vector< Scalar > &  x,
const std::vector< Scalar > &  y 
)
inline

Create a monotone cubic spline from the control points (x[i], y[i])

Parameters
xa vector of x-coordinates
ya vector of y-coordinates

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