3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Public Member Functions | List of all members
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 >

A simple implementation of a natural cubic spline.

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)
 Contruct 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

Default constructor.

◆ CubicSpline() [2/2]

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

Contruct a natural cubic spline from the control points (x[i], y[i])

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

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::CubicSpline< 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

◆ 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
xa vector of x-coordinates
ya vector of y-coordinates

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