This class interpolates values given a set of data pairs and an abscissa. More...
#include <MonotoneCubicInterpolation.h>
Public Member Functions | |
MonotoneCubicInterpolation () | |
Empty constructor. More... | |
MonotoneCubicInterpolation (const std::vector< Real > &x, const std::vector< Real > &y) | |
Constructor, Takes two vectors of points for which to apply the fit. More... | |
virtual | ~MonotoneCubicInterpolation ()=default |
virtual void | setData (const std::vector< Real > &x, const std::vector< Real > &y) |
Method generally used when MonotoneCubicInterpolation object was created using the empty constructor. More... | |
virtual Real | sample (const Real &x) const |
This function will take an independent variable input and will return the dependent variable based on the generated fit. More... | |
virtual Real | sampleDerivative (const Real &x) const |
This function will take an independent variable input and will return the derivative of the dependent variable with respect to the independent variable based on the generated fit. More... | |
virtual Real | sample2ndDerivative (const Real &x) const |
This function will take an independent variable input and will return the second derivative of the dependent variable with respect to the independent variable based on the generated fit. More... | |
virtual void | dumpCSV (std::string filename, const std::vector< Real > &xnew) |
This function takes an array of independent variable values and writes a CSV file with values corresponding to y, y', and y''. More... | |
virtual unsigned int | getSampleSize () |
This method returns the length of the independent variable vector. More... | |
Protected Member Functions | |
virtual void | errorCheck () |
Real | sign (const Real &x) const |
Real | phi (const Real &t) const |
Real | psi (const Real &t) const |
Real | phiPrime (const Real &t) const |
Real | psiPrime (const Real &t) const |
Real | phiDoublePrime (const Real &t) const |
Real | psiDoublePrime (const Real &t) const |
Real | h1 (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h2 (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h3 (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h4 (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h1Prime (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h2Prime (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h3Prime (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h4Prime (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h1DoublePrime (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h2DoublePrime (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h3DoublePrime (const Real &xhi, const Real &xlo, const Real &x) const |
Real | h4DoublePrime (const Real &xhi, const Real &xlo, const Real &x) const |
virtual Real | p (const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const |
virtual Real | pPrime (const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const |
virtual Real | pDoublePrime (const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const |
virtual void | initialize_derivs () |
virtual void | modify_derivs (const Real &alpha, const Real &beta, const Real &delta, Real &yp_lo, Real &yp_hi) |
virtual void | solve () |
virtual void | findInterval (const Real &x, unsigned int &klo, unsigned int &khi) const |
Protected Attributes | |
std::vector< Real > | _x |
std::vector< Real > | _y |
std::vector< Real > | _h |
std::vector< Real > | _yp |
std::vector< Real > | _delta |
std::vector< Real > | _alpha |
std::vector< Real > | _beta |
unsigned int | _n_knots |
unsigned int | _n_intervals |
unsigned int | _internal_knots |
This class interpolates values given a set of data pairs and an abscissa.
The interpolation is cubic with at least C1 continuity; C2 continuity can be violated in favor of ensuring the interpolation is monotonic. The algorithm used is laid out in Fritsch and Carlson, SIAM J. Numer. Anal. Vol. 17(2) April 1980
Definition at line 25 of file MonotoneCubicInterpolation.h.
MonotoneCubicInterpolation::MonotoneCubicInterpolation | ( | ) |
MonotoneCubicInterpolation::MonotoneCubicInterpolation | ( | const std::vector< Real > & | x, |
const std::vector< Real > & | y | ||
) |
Constructor, Takes two vectors of points for which to apply the fit.
One should be of the independent variable while the other should be of the dependent variable. These values should have a one-to-one correspondence, e.g. the vectors must be of the same size.
Definition at line 22 of file MonotoneCubicInterpolation.C.
|
virtualdefault |
|
virtual |
This function takes an array of independent variable values and writes a CSV file with values corresponding to y, y', and y''.
This can be used for sanity checks of the interpolation curve.
Definition at line 375 of file MonotoneCubicInterpolation.C.
|
protectedvirtual |
Definition at line 40 of file MonotoneCubicInterpolation.C.
Referenced by MonotoneCubicInterpolation(), and setData().
|
protectedvirtual |
Definition at line 330 of file MonotoneCubicInterpolation.C.
Referenced by sample(), sample2ndDerivative(), and sampleDerivative().
|
virtual |
This method returns the length of the independent variable vector.
Definition at line 394 of file MonotoneCubicInterpolation.C.
|
protected |
Definition at line 106 of file MonotoneCubicInterpolation.C.
Referenced by p().
|
protected |
Definition at line 123 of file MonotoneCubicInterpolation.C.
Referenced by pDoublePrime().
|
protected |
Definition at line 114 of file MonotoneCubicInterpolation.C.
Referenced by pPrime().
|
protected |
Definition at line 132 of file MonotoneCubicInterpolation.C.
Referenced by p().
|
protected |
Definition at line 149 of file MonotoneCubicInterpolation.C.
Referenced by pDoublePrime().
|
protected |
Definition at line 140 of file MonotoneCubicInterpolation.C.
Referenced by pPrime().
|
protected |
Definition at line 158 of file MonotoneCubicInterpolation.C.
Referenced by p().
|
protected |
Definition at line 175 of file MonotoneCubicInterpolation.C.
Referenced by pDoublePrime().
|
protected |
Definition at line 166 of file MonotoneCubicInterpolation.C.
Referenced by pPrime().
|
protected |
Definition at line 184 of file MonotoneCubicInterpolation.C.
Referenced by p().
|
protected |
Definition at line 201 of file MonotoneCubicInterpolation.C.
Referenced by pDoublePrime().
|
protected |
Definition at line 192 of file MonotoneCubicInterpolation.C.
Referenced by pPrime().
|
protectedvirtual |
Definition at line 249 of file MonotoneCubicInterpolation.C.
Referenced by solve().
|
protectedvirtual |
Definition at line 271 of file MonotoneCubicInterpolation.C.
Referenced by solve().
|
protectedvirtual |
Definition at line 210 of file MonotoneCubicInterpolation.C.
Referenced by sample().
|
protectedvirtual |
Definition at line 236 of file MonotoneCubicInterpolation.C.
Referenced by sample2ndDerivative().
Definition at line 70 of file MonotoneCubicInterpolation.C.
Definition at line 82 of file MonotoneCubicInterpolation.C.
Referenced by h1DoublePrime(), and h2DoublePrime().
Definition at line 76 of file MonotoneCubicInterpolation.C.
|
protectedvirtual |
Definition at line 223 of file MonotoneCubicInterpolation.C.
Referenced by sampleDerivative().
Definition at line 88 of file MonotoneCubicInterpolation.C.
Definition at line 100 of file MonotoneCubicInterpolation.C.
Referenced by h3DoublePrime(), and h4DoublePrime().
Definition at line 94 of file MonotoneCubicInterpolation.C.
This function will take an independent variable input and will return the dependent variable based on the generated fit.
Definition at line 347 of file MonotoneCubicInterpolation.C.
Referenced by dumpCSV().
This function will take an independent variable input and will return the second derivative of the dependent variable with respect to the independent variable based on the generated fit.
Note that this can be discontinous at the knots.
Definition at line 367 of file MonotoneCubicInterpolation.C.
Referenced by dumpCSV().
This function will take an independent variable input and will return the derivative of the dependent variable with respect to the independent variable based on the generated fit.
Definition at line 359 of file MonotoneCubicInterpolation.C.
Referenced by dumpCSV().
|
virtual |
Method generally used when MonotoneCubicInterpolation object was created using the empty constructor.
Takes two vectors of points for which to apply the fit. One should be of the independent variable while the other should be of the dependent variable. These values should have a one-to-one correspondence, e.g. the vectors must be of the same size.
Definition at line 31 of file MonotoneCubicInterpolation.C.
Definition at line 59 of file MonotoneCubicInterpolation.C.
Referenced by solve().
|
protectedvirtual |
Definition at line 282 of file MonotoneCubicInterpolation.C.
Referenced by MonotoneCubicInterpolation(), and setData().
|
protected |
Definition at line 146 of file MonotoneCubicInterpolation.h.
Referenced by solve().
|
protected |
Definition at line 147 of file MonotoneCubicInterpolation.h.
Referenced by solve().
|
protected |
Definition at line 145 of file MonotoneCubicInterpolation.h.
Referenced by solve().
|
protected |
Definition at line 143 of file MonotoneCubicInterpolation.h.
Referenced by initialize_derivs(), and solve().
|
protected |
Definition at line 151 of file MonotoneCubicInterpolation.h.
Referenced by solve().
|
protected |
Definition at line 150 of file MonotoneCubicInterpolation.h.
Referenced by initialize_derivs(), and solve().
|
protected |
Definition at line 149 of file MonotoneCubicInterpolation.h.
Referenced by findInterval(), initialize_derivs(), and solve().
|
protected |
Definition at line 141 of file MonotoneCubicInterpolation.h.
Referenced by errorCheck(), findInterval(), getSampleSize(), sample(), sample2ndDerivative(), sampleDerivative(), setData(), and solve().
|
protected |
Definition at line 142 of file MonotoneCubicInterpolation.h.
Referenced by errorCheck(), initialize_derivs(), sample(), sample2ndDerivative(), sampleDerivative(), setData(), and solve().
|
protected |
Definition at line 144 of file MonotoneCubicInterpolation.h.
Referenced by initialize_derivs(), sample(), sample2ndDerivative(), sampleDerivative(), and solve().