24#ifndef DUMUX_SPLINE_HH
25#define DUMUX_SPLINE_HH
53template<
class Scalar,
int numSamples = 2>
71 template <
class ScalarArray>
81 template <
class Po
intArray>
93 template <
class ScalarArray>
107 template <
class Po
intArray>
135template<
class Scalar>
154 template <
class ScalarArrayX,
class ScalarArrayY>
156 const ScalarArrayX &x,
157 const ScalarArrayY &y)
166 template <
class Po
intArray>
168 const PointArray &points)
177 template <
class ScalarContainer>
179 const ScalarContainer &y)
187 template <
class Po
intContainer>
200 template <
class ScalarArray>
202 const ScalarArray &x,
203 const ScalarArray &y,
216 template <
class Po
intArray>
218 const PointArray &points,
231 template <
class ScalarContainerX,
class ScalarContainerY>
233 const ScalarContainerY &y,
245 template <
class Po
intContainer>
255template<
class Scalar>
258{
private:
Spline() { }; };
263template<
class Scalar>
274template<
class Scalar>
278 using Vector = Dune::FieldVector<Scalar, 2>;
279 using Matrix = Dune::FieldMatrix<Scalar, 2, 2>;
293 template <
class ScalarArrayX,
class ScalarArrayY>
295 const ScalarArrayY &y,
296 Scalar m0, Scalar m1)
306 template <
class Po
intArray>
323 Scalar y0, Scalar y1,
324 Scalar m0, Scalar m1)
348 void set(Scalar x0, Scalar x1,
349 Scalar y0, Scalar y1,
350 Scalar m0, Scalar m1)
354 assignXY_(x0, x1, y0, y1);
371 template <
class ScalarContainer>
373 const ScalarContainer &x,
374 const ScalarContainer &y,
375 Scalar m0, Scalar m1)
377 assert(nSamples == 2);
378 set(x[0], x[1], y[0], y[1], m0, m1);
390 template <
class ScalarContainerX,
class ScalarContainerY>
392 const ScalarContainerY &y,
393 Scalar m0, Scalar m1)
395 assert(x.size() == y.size());
396 assert(x.size() == 2);
401 typename ScalarContainerX::const_iterator xIt0 = x.begin();
402 typename ScalarContainerX::const_iterator xIt1 = xIt0;
404 typename ScalarContainerY::const_iterator yIt0 = y.begin();
405 typename ScalarContainerY::const_iterator yIt1 = yIt0;
407 set(*xIt0, *xIt1, *yIt0, *yIt1);
419 template <
class Po
intArray>
421 const PointArray &points,
425 assert(nSamples == 2);
442 template <
class Po
intContainer>
447 assert(points.size() == 2);
451 typename PointContainer::const_iterator it0 = points.begin();
452 typename PointContainer::const_iterator it1 = it0;
470 template <
class TupleContainer>
475 assert(tuples.size() == 2);
477 typename TupleContainer::const_iterator it0 = tuples.begin();
478 typename TupleContainer::const_iterator it1 = it0;
481 set(std::get<0>(*it0),
490 Scalar y0, Scalar y1)
509 Scalar
x_(
int i)
const
515 Scalar
y_(
int i)
const
Implements a spline with a fixed number of sampling points.
Implements a spline with a variable number of sampling points.
The common code for all 3rd order polynomial splines.
The common code for all 3rd order polynomial splines with more than two sampling points.
Definition: fixedlengthspline_.hh:44
BlockVector m_
Definition: fixedlengthspline_.hh:409
Vector xPos_
Definition: fixedlengthspline_.hh:407
void setContainerOfPoints(const XYContainer &points, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes of a full spline using a STL-compatible container of ...
Definition: fixedlengthspline_.hh:164
void setXYArrays(int numberSamples, const ScalarArrayX &x, const ScalarArrayY &y, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes of a full spline using C-style arrays.
Definition: fixedlengthspline_.hh:84
void setArrayOfPoints(int numberSamples, const PointArray &points, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes of a full spline using a C-style array.
Definition: fixedlengthspline_.hh:135
Vector yPos_
Definition: fixedlengthspline_.hh:408
int numSamples() const
Returns the number of sampling points.
Definition: fixedlengthspline_.hh:61
void setXYContainers(const ScalarContainerX &x, const ScalarContainerY &y, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes of a full spline using STL-compatible containers.
Definition: fixedlengthspline_.hh:110
A 3rd order polynomial spline.
Definition: spline.hh:55
Spline()
Default constructor for a spline.
Definition: spline.hh:62
Spline(const PointArray &points, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:108
Spline(const PointArray &points)
Convenience constructor for a full spline.
Definition: spline.hh:82
Spline(const ScalarArray &x, const ScalarArray &y)
Convenience constructor for a full spline.
Definition: spline.hh:72
Spline(const ScalarArray &x, const ScalarArray &y, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:94
Spline(const ScalarContainer &x, const ScalarContainer &y)
Convenience constructor for a natural spline.
Definition: spline.hh:178
Spline()
Default constructor for a spline.
Definition: spline.hh:144
Spline(int nSamples, const ScalarArray &x, const ScalarArray &y, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:201
Spline(const PointContainer &points, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:246
Spline(int nSamples, const PointArray &points)
Convenience constructor for a natural spline.
Definition: spline.hh:167
Spline(const PointContainer &points)
Convenience constructor for a natural spline.
Definition: spline.hh:188
Spline(int nSamples, const PointArray &points, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:217
Spline(int nSamples, const ScalarArrayX &x, const ScalarArrayY &y)
Convenience constructor for a natural spline.
Definition: spline.hh:155
Spline(const ScalarContainerX &x, const ScalarContainerY &y, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:232
int numSamples() const
Returns the number of sampling points.
Definition: spline.hh:334
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.
Definition: spline.hh:348
Scalar y_(int i) const
Returns the y coordinate of the i-th sampling point.
Definition: spline.hh:515
void setContainerOfPoints(const PointContainer &points, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes from an STL-like container of points.
Definition: spline.hh:443
Vector m_
Definition: spline.hh:527
Spline(Scalar x0, Scalar x1, Scalar y0, Scalar y1, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:322
Spline(const PointArray &points, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:307
void setXYContainers(const ScalarContainerX &x, const ScalarContainerY &y, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes of the spline.
Definition: spline.hh:391
Vector yPos_
Definition: spline.hh:526
void setContainerOfTuples(const TupleContainer &tuples, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes from an STL-like container of tuples.
Definition: spline.hh:471
Spline(const ScalarArrayX &x, const ScalarArrayY &y, Scalar m0, Scalar m1)
Convenience constructor for a full spline.
Definition: spline.hh:294
void assignXY_(Scalar x0, Scalar x1, Scalar y0, Scalar y1)
Definition: spline.hh:489
Scalar moment_(int i) const
Returns the moment (i.e. second derivative) of the spline at the i-th sampling point.
Definition: spline.hh:522
Spline()
Definition: spline.hh:282
void setXYArrays(int nSamples, const ScalarContainer &x, const ScalarContainer &y, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes of the spline.
Definition: spline.hh:372
Scalar x_(int i) const
Returns the x coordinate of the i-th sampling point.
Definition: spline.hh:509
void setArrayOfPoints(int nSamples, const PointArray &points, Scalar m0, Scalar m1)
Set the sampling points and the boundary slopes of the spline.
Definition: spline.hh:420
Vector xPos_
Definition: spline.hh:525
The common code for all 3rd order polynomial splines.
Definition: splinecommon_.hh:45
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.
Definition: splinecommon_.hh:429
The common code for all 3rd order polynomial splines with where the number of sampling points only kn...
Definition: variablelengthspline_.hh:45