My Project
Spline.hpp File Reference
#include <opm/material/common/TridiagonalMatrix.hpp>
#include <opm/material/common/PolynomialUtils.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <ostream>
#include <vector>
#include <tuple>

Go to the source code of this file.

Classes

class  Opm::Spline< Scalar >
 Class implementing cubic splines. More...
 
struct  Opm::Spline< Scalar >::ComparatorX_
 Helper class needed to sort the input sampling points. More...
 

Detailed Description

Class implementing cubic splines.

This class supports full, natural, periodic and monotonic cubic splines.

Full a splines $s(x)$ are splines which, given $n$ sampling points $x_1, \dots, x_n$, fulfill the following conditions

\begin{align*}
   s(x_i)   & = y_i \quad \forall i \in \{1, \dots, n \} \\
   s'(x_1)  & = m_1 \\
   s'(x_n)  & = m_n
  \end{align*}

for any given boundary slopes $m_1$ and $m_n$.

Natural splines which are defined by

\begin{align*}
     s(x_i)     & = y_i \quad \forall i \in \{1, \dots, n \} \\
     s''(x_1)   & = 0 \\
     s''(x_n)   & = 0
*\end{align*}

For periodic splines of splines the slopes at the boundaries are identical:

\begin{align*}
     s(x_i)     & = y_i \quad \forall i \in \{1, \dots, n \} \\
     s'(x_1)    & = s'(x_n) \\
     s''(x_1)   & = s''(x_n) \;.
*\end{align*}

Finally, there are monotonic splines which guarantee that the curve is confined by its sampling points, i.e.,

\[
y_i \leq s(x) \leq y_{i+1} \quad \text{for} x_i \leq x \leq x_{i+1} \;.
  \]

For more information on monotonic splines, see http://en.wikipedia.org/wiki/Monotone_cubic_interpolation

Full, natural and periodic splines are continuous in their first and second derivatives, i.e.,

\[
s \in \mathcal{C}^2
  \]

holds for such splines. Monotonic splines are only continuous up to their first derivative, i.e., for these only

\[
s \in \mathcal{C}^1
  \]

is true.