|
| Spline () |
| Default constructor for a spline. More...
|
|
| Spline (Scalar x0, Scalar x1, Scalar y0, Scalar y1, Scalar m0, Scalar m1) |
| Convenience constructor for a full spline with just two sampling points. More...
|
|
template<class ScalarArrayX , class ScalarArrayY > |
| Spline (size_t nSamples, const ScalarArrayX &x, const ScalarArrayY &y, SplineType splineType=Natural, bool sortInputs=true) |
| Convenience constructor for a natural or a periodic spline. More...
|
|
template<class PointArray > |
| Spline (size_t nSamples, const PointArray &points, SplineType splineType=Natural, bool sortInputs=true) |
| Convenience constructor for a natural or a periodic spline. More...
|
|
template<class ScalarContainer > |
| Spline (const ScalarContainer &x, const ScalarContainer &y, SplineType splineType=Natural, bool sortInputs=true) |
| Convenience constructor for a natural or a periodic spline. More...
|
|
template<class PointContainer > |
| Spline (const PointContainer &points, SplineType splineType=Natural, bool sortInputs=true) |
| Convenience constructor for a natural or a periodic spline. More...
|
|
template<class ScalarArray > |
| Spline (size_t nSamples, const ScalarArray &x, const ScalarArray &y, Scalar m0, Scalar m1, bool sortInputs=true) |
| Convenience constructor for a full spline. More...
|
|
template<class PointArray > |
| Spline (size_t nSamples, const PointArray &points, Scalar m0, Scalar m1, bool sortInputs=true) |
| Convenience constructor for a full spline. More...
|
|
template<class ScalarContainerX , class ScalarContainerY > |
| Spline (const ScalarContainerX &x, const ScalarContainerY &y, Scalar m0, Scalar m1, bool sortInputs=true) |
| Convenience constructor for a full spline. More...
|
|
template<class PointContainer > |
| Spline (const PointContainer &points, Scalar m0, Scalar m1, bool sortInputs=true) |
| Convenience constructor for a full spline. More...
|
|
void | set (Scalar x0, Scalar x1, Scalar y0, Scalar y1, Scalar m0, Scalar m1) |
| Set the sampling points and the boundary slopes of the spline with two sampling points. More...
|
|
template<class ScalarArrayX , class ScalarArrayY > |
void | setXYArrays (size_t nSamples, const ScalarArrayX &x, const ScalarArrayY &y, Scalar m0, Scalar m1, bool sortInputs=true) |
| Set the sampling points and the boundary slopes of a full spline using C-style arrays. More...
|
|
template<class ScalarContainerX , class ScalarContainerY > |
void | setXYContainers (const ScalarContainerX &x, const ScalarContainerY &y, Scalar m0, Scalar m1, bool sortInputs=true) |
| Set the sampling points and the boundary slopes of a full spline using STL-compatible containers. More...
|
|
template<class PointArray > |
void | setArrayOfPoints (size_t nSamples, const PointArray &points, Scalar m0, Scalar m1, bool sortInputs=true) |
| Set the sampling points and the boundary slopes of a full spline using a C-style array. More...
|
|
template<class XYContainer > |
void | setContainerOfPoints (const XYContainer &points, Scalar m0, Scalar m1, bool sortInputs=true) |
| Set the sampling points and the boundary slopes of a full spline using a STL-compatible container of array-like objects. More...
|
|
template<class XYContainer > |
void | setContainerOfTuples (const XYContainer &points, Scalar m0, Scalar m1, bool sortInputs=true) |
| Set the sampling points and the boundary slopes of a full spline using a STL-compatible container of tuple-like objects. More...
|
|
template<class ScalarArrayX , class ScalarArrayY > |
void | setXYArrays (size_t nSamples, const ScalarArrayX &x, const ScalarArrayY &y, SplineType splineType=Natural, bool sortInputs=true) |
| Set the sampling points natural spline using C-style arrays. More...
|
|
template<class ScalarContainerX , class ScalarContainerY > |
void | setXYContainers (const ScalarContainerX &x, const ScalarContainerY &y, SplineType splineType=Natural, bool sortInputs=true) |
| Set the sampling points of a natural spline using STL-compatible containers. More...
|
|
template<class PointArray > |
void | setArrayOfPoints (size_t nSamples, const PointArray &points, SplineType splineType=Natural, bool sortInputs=true) |
| Set the sampling points of a natural spline using a C-style array. More...
|
|
template<class XYContainer > |
void | setContainerOfPoints (const XYContainer &points, SplineType splineType=Natural, bool sortInputs=true) |
| Set the sampling points of a natural spline using a STL-compatible container of array-like objects. More...
|
|
template<class XYContainer > |
void | setContainerOfTuples (const XYContainer &points, SplineType splineType=Natural, bool sortInputs=true) |
| Set the sampling points of a natural spline using a STL-compatible container of tuple-like objects. More...
|
|
template<class Evaluation > |
bool | applies (const Evaluation &x) const |
| Return true iff the given x is in range [x1, xn].
|
|
size_t | numSamples () const |
| Return the number of (x, y) values.
|
|
Scalar | xAt (size_t sampleIdx) const |
| Return the x value of a given sampling point.
|
|
Scalar | valueAt (size_t sampleIdx) const |
| Return the x value of a given sampling point.
|
|
void | printCSV (Scalar xi0, Scalar xi1, size_t k, std::ostream &os=std::cout) const |
| Prints k tuples of the format (x, y, dx/dy, isMonotonic) to stdout. More...
|
|
template<class Evaluation > |
Evaluation | eval (const Evaluation &x, bool extrapolate=false) const |
| Evaluate the spline at a given position. More...
|
|
template<class Evaluation > |
Evaluation | evalDerivative (const Evaluation &x, bool extrapolate=false) const |
| Evaluate the spline's derivative at a given position. More...
|
|
template<class Evaluation > |
Evaluation | evalSecondDerivative (const Evaluation &x, bool extrapolate=false) const |
| Evaluate the spline's second derivative at a given position. More...
|
|
template<class Evaluation > |
Evaluation | evalThirdDerivative (const Evaluation &x, bool extrapolate=false) const |
| Evaluate the spline's third derivative at a given position. More...
|
|
template<class Evaluation > |
Evaluation | intersect (const Evaluation &a, const Evaluation &b, const Evaluation &c, const Evaluation &d) const |
| Find the intersections of the spline with a cubic polynomial in the whole interval, throws Opm::MathError exception if there is more or less than one solution.
|
|
template<class Evaluation > |
Evaluation | intersectInterval (Scalar x0, Scalar x1, const Evaluation &a, const Evaluation &b, const Evaluation &c, const Evaluation &d) const |
| Find the intersections of the spline with a cubic polynomial in a sub-interval of the spline, throws Opm::MathError exception if there is more or less than one solution.
|
|
int | monotonic (Scalar x0, Scalar x1, [[maybe_unused]] bool extrapolate=false) const |
| Returns 1 if the spline is monotonically increasing, -1 if the spline is mononously decreasing and 0 if the spline is not monotonous in the interval (x0, x1). More...
|
|
int | monotonic () const |
| Same as monotonic(x0, x1), but with the entire range of the spline as interval.
|
|
|
void | sortInput_ () |
| Sort the sample points in ascending order of their x value.
|
|
void | reverseSamplingPoints_ () |
| Reverse order of the elements in the arrays which contain the sampling points.
|
|
void | setNumSamples_ (size_t nSamples) |
| Resizes the internal vectors to store the sample points.
|
|
void | makeFullSpline_ (Scalar m0, Scalar m1) |
| Create a natural spline from the already set sampling points. More...
|
|
void | makeNaturalSpline_ () |
| Create a natural spline from the already set sampling points. More...
|
|
void | makePeriodicSpline_ () |
| Create a periodic spline from the already set sampling points. More...
|
|
template<class DestVector , class SourceVector > |
void | assignSamplingPoints_ (DestVector &destX, DestVector &destY, const SourceVector &srcX, const SourceVector &srcY, unsigned nSamples) |
| Set the sampling point vectors. More...
|
|
template<class DestVector , class ListIterator > |
void | assignFromArrayList_ (DestVector &destX, DestVector &destY, const ListIterator &srcBegin, const ListIterator &srcEnd, unsigned nSamples) |
|
template<class DestVector , class ListIterator > |
void | assignFromTupleList_ (DestVector &destX, DestVector &destY, ListIterator srcBegin, ListIterator srcEnd, unsigned nSamples) |
| Set the sampling points. More...
|
|
template<class Vector , class Matrix > |
void | makeFullSystem_ (Matrix &M, Vector &d, Scalar m0, Scalar m1) |
| Make the linear system of equations Mx = d which results in the moments of the full spline.
|
|
template<class Vector , class Matrix > |
void | makeNaturalSystem_ (Matrix &M, Vector &d) |
| Make the linear system of equations Mx = d which results in the moments of the natural spline.
|
|
template<class Matrix , class Vector > |
void | makePeriodicSystem_ (Matrix &M, Vector &d) |
| Make the linear system of equations Mx = d which results in the moments of the periodic spline.
|
|
template<class Vector > |
void | makeMonotonicSpline_ (Vector &slopes) |
| Create a monotonic spline from the already set sampling points. More...
|
|
template<class MomentsVector , class SlopeVector > |
void | setSlopesFromMoments_ (SlopeVector &slopes, const MomentsVector &moments) |
| Convert the moments at the sample points to slopes. More...
|
|
template<class Evaluation > |
Evaluation | eval_ (const Evaluation &x, size_t i) const |
|
template<class Evaluation > |
Evaluation | evalDerivative_ (const Evaluation &x, size_t i) const |
|
template<class Evaluation > |
Evaluation | evalDerivative2_ (const Evaluation &x, size_t i) const |
|
template<class Evaluation > |
Evaluation | evalDerivative3_ (const Evaluation &x, size_t i) const |
|
template<class Evaluation > |
Evaluation | h00_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h10_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h01_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h11_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h00_prime_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h10_prime_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h01_prime_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h11_prime_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h00_prime2_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h10_prime2_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h01_prime2_ (const Evaluation &t) const |
|
template<class Evaluation > |
Evaluation | h11_prime2_ (const Evaluation &t) const |
|
template<class Evaluation > |
Scalar | h00_prime3_ (const Evaluation &) const |
|
template<class Evaluation > |
Scalar | h10_prime3_ (const Evaluation &) const |
|
template<class Evaluation > |
Scalar | h01_prime3_ (const Evaluation &) const |
|
template<class Evaluation > |
Scalar | h11_prime3_ (const Evaluation &) const |
|
int | monotonic_ (size_t i, Scalar x0, Scalar x1, int &r) const |
|
template<class Evaluation > |
size_t | intersectSegment_ (Evaluation *sol, size_t segIdx, const Evaluation &a, const Evaluation &b, const Evaluation &c, const Evaluation &d, Scalar x0=-1e30, Scalar x1=1e30) const |
| Find all the intersections of a segment of the spline with a cubic polynomial within a specified interval.
|
|
size_t | segmentIdx_ (Scalar x) const |
|
Scalar | h_ (size_t i) const |
| Returns x[i] - x[i - 1].
|
|
Scalar | x_ (size_t i) const |
| Returns the y coordinate of the i-th sampling point.
|
|
Scalar | y_ (size_t i) const |
| Returns the y coordinate of the i-th sampling point.
|
|
Scalar | slope_ (size_t i) const |
| Returns the slope (i.e. More...
|
|
Scalar | a_ (size_t i) const |
|
Scalar | b_ (size_t i) const |
|
Scalar | c_ (size_t i) const |
|
Scalar | d_ (size_t i) const |
|
template<class Scalar>
class Opm::Spline< Scalar >
Class implementing cubic splines.
This class supports full, natural, periodic and monotonic cubic splines.
Full a splines
are splines which, given
sampling points
, fulfill the following conditions
for any given boundary slopes
and
.
Natural splines which are defined by
For periodic splines of splines the slopes at the boundaries are identical:
Finally, there are monotonic splines which guarantee that the curve is confined by its sampling points, i.e.,
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.,
holds for such splines. Monotonic splines are only continuous up to their first derivative, i.e., for these only
is true.