Line | Branch | Exec | Source |
---|---|---|---|
1 | // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
2 | // vi: set et ts=4 sw=4 sts=4: | ||
3 | // | ||
4 | // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup Core | ||
10 | * \brief Provides 3rd order polynomial splines. | ||
11 | */ | ||
12 | #ifndef DUMUX_SPLINE_HH | ||
13 | #define DUMUX_SPLINE_HH | ||
14 | |||
15 | #include "fixedlengthspline_.hh" | ||
16 | #include "variablelengthspline_.hh" | ||
17 | #include "splinecommon_.hh" | ||
18 | |||
19 | namespace Dumux { | ||
20 | |||
21 | /*! | ||
22 | * \ingroup Core | ||
23 | * \brief A 3rd order polynomial spline. | ||
24 | |||
25 | * This class implements a spline \f$s(x)\f$ for which, given \f$n\f$ sampling | ||
26 | * points \f$x_1, \dots, x_n\f$, the following conditions hold | ||
27 | *\f{align*}{ | ||
28 | s(x_i) & = y_i \quad \forall i \in \{1, \dots, n \}\\ | ||
29 | s'(x_1) & = m_1 \\ | ||
30 | s'(x_n) & = m_n | ||
31 | \f} | ||
32 | * | ||
33 | * for any given boundary slopes \f$m_1\f$ and \f$m_n\f$. Alternatively, natural | ||
34 | * splines are supported which are defined by | ||
35 | *\f{align*}{ | ||
36 | s(x_i) & = y_i \quad \forall i \in \{1, \dots, n \} \\ | ||
37 | s''(x_1) & = 0 \\ | ||
38 | s''(x_n) & = 0 | ||
39 | \f} | ||
40 | */ | ||
41 | template<class Scalar, int numSamples = 2> | ||
42 |
17/52✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 1 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 1 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
|
18 | class Spline : public FixedLengthSpline_<Scalar, numSamples> |
43 | { | ||
44 | public: | ||
45 | /*! | ||
46 | * \brief Default constructor for a spline. | ||
47 | * | ||
48 | * To specify the actual curve, use one of the set() methods. | ||
49 | */ | ||
50 | 5 | Spline() | |
51 |
5/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
|
5 | { }; |
52 | |||
53 | /*! | ||
54 | * \brief Convenience constructor for a full spline | ||
55 | * | ||
56 | * \param x An array containing the \f$x\f$ values of the spline's sampling points | ||
57 | * \param y An array containing the \f$y\f$ values of the spline's sampling points | ||
58 | */ | ||
59 | template <class ScalarArray> | ||
60 | 4 | Spline(const ScalarArray &x, | |
61 | const ScalarArray &y) | ||
62 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
8 | { this->setXYArrays(numSamples, x, y); } |
63 | |||
64 | /*! | ||
65 | * \brief Convenience constructor for a full spline | ||
66 | * | ||
67 | * \param points An array of \f$(x,y)\f$ tuples of the spline's sampling points | ||
68 | */ | ||
69 | template <class PointArray> | ||
70 | Spline(const PointArray &points) | ||
71 | { this->setArrayOfPoints(numSamples, points); } | ||
72 | |||
73 | /*! | ||
74 | * \brief Convenience constructor for a full spline | ||
75 | * | ||
76 | * \param x An array containing the \f$x\f$ values of the spline's sampling points | ||
77 | * \param y An array containing the \f$y\f$ values of the spline's sampling points | ||
78 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
79 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
80 | */ | ||
81 | template <class ScalarArray> | ||
82 | 4 | Spline(const ScalarArray &x, | |
83 | const ScalarArray &y, | ||
84 | Scalar m0, | ||
85 | Scalar m1) | ||
86 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
8 | { this->setXYArrays(numSamples, x, y, m0, m1); } |
87 | |||
88 | /*! | ||
89 | * \brief Convenience constructor for a full spline | ||
90 | * | ||
91 | * \param points An array of \f$(x,y)\f$ tuples of the spline's sampling points | ||
92 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
93 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
94 | */ | ||
95 | template <class PointArray> | ||
96 | Spline(const PointArray &points, | ||
97 | Scalar m0, | ||
98 | Scalar m1) | ||
99 | { this->setArrayOfPoints(numSamples, points, m0, m1); } | ||
100 | }; | ||
101 | |||
102 | /*! | ||
103 | * \ingroup Core | ||
104 | * \brief Specialization of a spline with the number of sampling | ||
105 | * points only known at run time. | ||
106 | * | ||
107 | * This class implements a spline \f$s(x)\f$ for which, given \f$n\f$ sampling | ||
108 | * points \f$x_1, \dots, x_n\f$, the following conditions hold | ||
109 | *\f{align*}{ | ||
110 | s(x_i) & = y_i \quad \forall i \in \{1, \dots, n \}\\ | ||
111 | s'(x_1) & = m_1 \\ | ||
112 | s'(x_n) & = m_n | ||
113 | \f} | ||
114 | * | ||
115 | * for any given boundary slopes \f$m_1\f$ and \f$m_n\f$. Alternatively, natural | ||
116 | * splines are supported which are defined by | ||
117 | *\f{align*}{ | ||
118 | s(x_i) & = y_i \quad \forall i \in \{1, \dots, n \} \\ | ||
119 | s''(x_1) & = 0 \\ | ||
120 | s''(x_n) & = 0 | ||
121 | \f} | ||
122 | */ | ||
123 | template<class Scalar> | ||
124 |
1/2✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
|
11 | class Spline<Scalar, /*numSamples=*/-1> : public VariableLengthSpline_<Scalar> |
125 | { | ||
126 | public: | ||
127 | /*! | ||
128 | * \brief Default constructor for a spline. | ||
129 | * | ||
130 | * To specify the actual curve, use one of the set() methods. | ||
131 | */ | ||
132 | Spline() | ||
133 | 12 | { } | |
134 | |||
135 | /*! | ||
136 | * \brief Convenience constructor for a natural spline | ||
137 | * | ||
138 | * \param nSamples The number of sampling points (must be > 2) | ||
139 | * \param x An array containing the \f$x\f$ values of the spline's sampling points | ||
140 | * \param y An array containing the \f$y\f$ values of the spline's sampling points | ||
141 | */ | ||
142 | template <class ScalarArrayX, class ScalarArrayY> | ||
143 | 1 | Spline(int nSamples, | |
144 | const ScalarArrayX &x, | ||
145 | const ScalarArrayY &y) | ||
146 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { this->setXYArrays(nSamples, x, y); } |
147 | |||
148 | /*! | ||
149 | * \brief Convenience constructor for a natural spline | ||
150 | * | ||
151 | * \param nSamples The number of sampling points (must be > 2) | ||
152 | * \param points An array of \f$(x,y)\f$ tuples of the spline's sampling points | ||
153 | */ | ||
154 | template <class PointArray> | ||
155 | Spline(int nSamples, | ||
156 | const PointArray &points) | ||
157 | { this->setArrayOfPoints(nSamples, points); } | ||
158 | |||
159 | /*! | ||
160 | * \brief Convenience constructor for a natural spline | ||
161 | * | ||
162 | * \param x An array containing the \f$x\f$ values of the spline's sampling points (must have a size() method) | ||
163 | * \param y An array containing the \f$y\f$ values of the spline's sampling points (must have a size() method) | ||
164 | */ | ||
165 | template <class ScalarContainer> | ||
166 | 2 | Spline(const ScalarContainer &x, | |
167 | const ScalarContainer &y) | ||
168 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | { this->setXYContainers(x, y); } |
169 | |||
170 | /*! | ||
171 | * \brief Convenience constructor for a natural spline | ||
172 | * | ||
173 | * \param points An array of \f$(x,y)\f$ tuples of the spline's sampling points (must have a size() method) | ||
174 | */ | ||
175 | template <class PointContainer> | ||
176 | Spline(const PointContainer &points) | ||
177 | { this->setContainerOfPoints(points); } | ||
178 | |||
179 | /*! | ||
180 | * \brief Convenience constructor for a full spline | ||
181 | * | ||
182 | * \param nSamples The number of sampling points (must be >= 2) | ||
183 | * \param x An array containing the \f$x\f$ values of the spline's sampling points | ||
184 | * \param y An array containing the \f$y\f$ values of the spline's sampling points | ||
185 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
186 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
187 | */ | ||
188 | template <class ScalarArray> | ||
189 | 1 | Spline(int nSamples, | |
190 | const ScalarArray &x, | ||
191 | const ScalarArray &y, | ||
192 | Scalar m0, | ||
193 | Scalar m1) | ||
194 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { this->setXYArrays(nSamples, x, y, m0, m1); } |
195 | |||
196 | /*! | ||
197 | * \brief Convenience constructor for a full spline | ||
198 | * | ||
199 | * \param nSamples The number of sampling points (must be >= 2) | ||
200 | * \param points An array containing the \f$x\f$ and \f$x\f$ values of the spline's sampling points | ||
201 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
202 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
203 | */ | ||
204 | template <class PointArray> | ||
205 | Spline(int nSamples, | ||
206 | const PointArray &points, | ||
207 | Scalar m0, | ||
208 | Scalar m1) | ||
209 | { this->setArrayOfPoints(nSamples, points, m0, m1); } | ||
210 | |||
211 | /*! | ||
212 | * \brief Convenience constructor for a full spline | ||
213 | * | ||
214 | * \param x An array containing the \f$x\f$ values of the spline's sampling points (must have a size() method) | ||
215 | * \param y An array containing the \f$y\f$ values of the spline's sampling points (must have a size() method) | ||
216 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
217 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
218 | */ | ||
219 | template <class ScalarContainerX, class ScalarContainerY> | ||
220 | 1 | Spline(const ScalarContainerX &x, | |
221 | const ScalarContainerY &y, | ||
222 | Scalar m0, | ||
223 | Scalar m1) | ||
224 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | { this->setXYContainers(x, y, m0, m1); } |
225 | |||
226 | /*! | ||
227 | * \brief Convenience constructor for a full spline | ||
228 | * | ||
229 | * \param points An array of \f$(x,y)\f$ tuples of the spline's sampling points (must have a size() method) | ||
230 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
231 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
232 | */ | ||
233 | template <class PointContainer> | ||
234 | Spline(const PointContainer &points, | ||
235 | Scalar m0, | ||
236 | Scalar m1) | ||
237 | { this->setContainerOfPoints(points, m0, m1); } | ||
238 | }; | ||
239 | |||
240 | /*! | ||
241 | * \brief Do not allow splines with zero sampling points | ||
242 | */ | ||
243 | template<class Scalar> | ||
244 | class Spline<Scalar, /*numSamples=*/0> | ||
245 | // Splines with zero sampling points do not make sense! | ||
246 | { private: Spline() { }; }; | ||
247 | |||
248 | /*! | ||
249 | * \brief Do not allow splines with one sampling point | ||
250 | */ | ||
251 | template<class Scalar> | ||
252 | class Spline<Scalar, /*numSamples=*/1> | ||
253 | // Splines with one sampling point do not make sense! | ||
254 | { private: Spline() { }; }; | ||
255 | |||
256 | /*! | ||
257 | * \ingroup Core | ||
258 | * \brief Spline for two sampling points. | ||
259 | * | ||
260 | * For this type of spline there is no natural spline. | ||
261 | */ | ||
262 | template<class Scalar> | ||
263 | class Spline<Scalar, 2> : public SplineCommon_<Scalar, Spline<Scalar, 2> > | ||
264 | { | ||
265 | friend class SplineCommon_<Scalar, Spline<Scalar, 2> >; | ||
266 | using Vector = Dune::FieldVector<Scalar, 2>; | ||
267 | using Matrix = Dune::FieldMatrix<Scalar, 2, 2>; | ||
268 | |||
269 | public: | ||
270 | 424 | Spline() | |
271 | 1696 | {}; | |
272 | |||
273 | /*! | ||
274 | * \brief Convenience constructor for a full spline | ||
275 | * | ||
276 | * \param x An array containing the \f$x\f$ values of the spline's sampling points | ||
277 | * \param y An array containing the \f$y\f$ values of the spline's sampling points | ||
278 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
279 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
280 | */ | ||
281 | template <class ScalarArrayX, class ScalarArrayY> | ||
282 | Spline(const ScalarArrayX &x, | ||
283 | const ScalarArrayY &y, | ||
284 | Scalar m0, Scalar m1) | ||
285 | 3 | { setXYArrays(2, x, y, m0, m1); } | |
286 | |||
287 | /*! | ||
288 | * \brief Convenience constructor for a full spline | ||
289 | * | ||
290 | * \param points An array of \f$(x,y)\f$ tuples of the spline's sampling points | ||
291 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
292 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
293 | */ | ||
294 | template <class PointArray> | ||
295 | 1 | Spline(const PointArray &points, | |
296 | Scalar m0, | ||
297 | Scalar m1) | ||
298 | 3 | { this->setArrayOfPoints(2, points, m0, m1); } | |
299 | |||
300 | /*! | ||
301 | * \brief Convenience constructor for a full spline | ||
302 | * | ||
303 | * \param x0 The \f$x\f$ value of the first sampling point | ||
304 | * \param x1 The \f$x\f$ value of the second sampling point | ||
305 | * \param y0 The \f$y\f$ value of the first sampling point | ||
306 | * \param y1 The \f$y\f$ value of the second sampling point | ||
307 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
308 | * \param m1 The slope of the spline at \f$x_n\f$ | ||
309 | */ | ||
310 | 4 | Spline(Scalar x0, Scalar x1, | |
311 | Scalar y0, Scalar y1, | ||
312 | Scalar m0, Scalar m1) | ||
313 | 271827 | { | |
314 | 90609 | set(x0, x1, | |
315 | y0, y1, | ||
316 | m0, m1); | ||
317 | }; | ||
318 | |||
319 | /*! | ||
320 | * \brief Returns the number of sampling points. | ||
321 | */ | ||
322 | ✗ | int numSamples() const | |
323 | ✗ | { return 2; } | |
324 | |||
325 | /*! | ||
326 | * \brief Set the sampling points and the boundary slopes of the | ||
327 | * spline. | ||
328 | * | ||
329 | * \param x0 The \f$x\f$ value of the first sampling point | ||
330 | * \param x1 The \f$x\f$ value of the second sampling point | ||
331 | * \param y0 The \f$y\f$ value of the first sampling point | ||
332 | * \param y1 The \f$y\f$ value of the second sampling point | ||
333 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
334 | * \param m1 The slope of the spline at \f$x_1\f$ | ||
335 | */ | ||
336 | 90616 | void set(Scalar x0, Scalar x1, | |
337 | Scalar y0, Scalar y1, | ||
338 | Scalar m0, Scalar m1) | ||
339 | { | ||
340 | 90616 | Matrix M(numSamples()); | |
341 | 90616 | Vector d; | |
342 | 181232 | assignXY_(x0, x1, y0, y1); | |
343 | 90616 | this->makeFullSystem_(M, d, m0, m1); | |
344 | |||
345 | // solve for the moments | ||
346 | 181232 | M.solve(m_, d); | |
347 | 90616 | } | |
348 | |||
349 | /*! | ||
350 | * \brief Set the sampling points and the boundary slopes of the | ||
351 | * spline. | ||
352 | * | ||
353 | * \param nSamples The number of sampling points (must be >= 2) | ||
354 | * \param x An array containing the \f$x\f$ values of the sampling points | ||
355 | * \param y An array containing the \f$y\f$ values of the sampling points | ||
356 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
357 | * \param m1 The slope of the spline at \f$x_1\f$ | ||
358 | */ | ||
359 | template <class ScalarContainer> | ||
360 | ✗ | void setXYArrays(int nSamples, | |
361 | const ScalarContainer &x, | ||
362 | const ScalarContainer &y, | ||
363 | Scalar m0, Scalar m1) | ||
364 | { | ||
365 | ✗ | assert(nSamples == 2); | |
366 | 1 | set(x[0], x[1], y[0], y[1], m0, m1); | |
367 | ✗ | } | |
368 | |||
369 | /*! | ||
370 | * \brief Set the sampling points and the boundary slopes of the | ||
371 | * spline. | ||
372 | * | ||
373 | * \param x An array containing the \f$x\f$ values of the sampling points | ||
374 | * \param y An array containing the \f$y\f$ values of the sampling points | ||
375 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
376 | * \param m1 The slope of the spline at \f$x_1\f$ | ||
377 | */ | ||
378 | template <class ScalarContainerX, class ScalarContainerY> | ||
379 | void setXYContainers(const ScalarContainerX &x, | ||
380 | const ScalarContainerY &y, | ||
381 | Scalar m0, Scalar m1) | ||
382 | { | ||
383 | assert(x.size() == y.size()); | ||
384 | assert(x.size() == 2); | ||
385 | |||
386 | Matrix M(numSamples()); | ||
387 | Vector d; | ||
388 | |||
389 | typename ScalarContainerX::const_iterator xIt0 = x.begin(); | ||
390 | typename ScalarContainerX::const_iterator xIt1 = xIt0; | ||
391 | ++xIt1; | ||
392 | typename ScalarContainerY::const_iterator yIt0 = y.begin(); | ||
393 | typename ScalarContainerY::const_iterator yIt1 = yIt0; | ||
394 | ++yIt1; | ||
395 | set(*xIt0, *xIt1, *yIt0, *yIt1); | ||
396 | } | ||
397 | |||
398 | /*! | ||
399 | * \brief Set the sampling points and the boundary slopes of the | ||
400 | * spline. | ||
401 | * | ||
402 | * \param nSamples The number of sampling points (must be >= 2) | ||
403 | * \param points An array of \f$(x,y)\f$ tuples of the spline's sampling points | ||
404 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
405 | * \param m1 The slope of the spline at \f$x_1\f$ | ||
406 | */ | ||
407 | template <class PointArray> | ||
408 | void setArrayOfPoints(int nSamples, | ||
409 | const PointArray &points, | ||
410 | Scalar m0, | ||
411 | Scalar m1) | ||
412 | { | ||
413 | assert(nSamples == 2); | ||
414 | |||
415 | 2 | set(points[0][0], | |
416 | 2 | points[1][0], | |
417 | 2 | points[0][1], | |
418 | 2 | points[1][1], | |
419 | m0, m1); | ||
420 | } | ||
421 | |||
422 | /*! | ||
423 | * \brief Set the sampling points and the boundary slopes from an | ||
424 | * STL-like container of points. | ||
425 | * | ||
426 | * \param points An array of \f$(x,y)\f$ tuples of the spline's sampling points | ||
427 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
428 | * \param m1 The slope of the spline at \f$x_1\f$ | ||
429 | */ | ||
430 | template <class PointContainer> | ||
431 | void setContainerOfPoints(const PointContainer &points, | ||
432 | Scalar m0, | ||
433 | Scalar m1) | ||
434 | { | ||
435 | assert(points.size() == 2); | ||
436 | |||
437 | Matrix M; | ||
438 | Vector d; | ||
439 | typename PointContainer::const_iterator it0 = points.begin(); | ||
440 | typename PointContainer::const_iterator it1 = it0; | ||
441 | ++it1; | ||
442 | |||
443 | set((*it0)[0], | ||
444 | (*it0)[1], | ||
445 | (*it1)[0], | ||
446 | (*it1)[1], | ||
447 | m0, m1); | ||
448 | } | ||
449 | |||
450 | /*! | ||
451 | * \brief Set the sampling points and the boundary slopes from an | ||
452 | * STL-like container of tuples. | ||
453 | * | ||
454 | * \param tuples An array of \f$(x,y)\f$ tuples of the spline's sampling points | ||
455 | * \param m0 The slope of the spline at \f$x_0\f$ | ||
456 | * \param m1 The slope of the spline at \f$x_1\f$ | ||
457 | */ | ||
458 | template <class TupleContainer> | ||
459 | void setContainerOfTuples(const TupleContainer &tuples, | ||
460 | Scalar m0, | ||
461 | Scalar m1) | ||
462 | { | ||
463 | assert(tuples.size() == 2); | ||
464 | |||
465 | typename TupleContainer::const_iterator it0 = tuples.begin(); | ||
466 | typename TupleContainer::const_iterator it1 = it0; | ||
467 | ++it1; | ||
468 | |||
469 | set(std::get<0>(*it0), | ||
470 | std::get<1>(*it0), | ||
471 | std::get<0>(*it1), | ||
472 | std::get<1>(*it1), | ||
473 | m0, m1); | ||
474 | } | ||
475 | |||
476 | protected: | ||
477 | void assignXY_(Scalar x0, Scalar x1, | ||
478 | Scalar y0, Scalar y1) | ||
479 | { | ||
480 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 90616 times.
|
90616 | if (x0 > x1) { |
481 | ✗ | xPos_[0] = x1; | |
482 | ✗ | xPos_[1] = x0; | |
483 | ✗ | yPos_[0] = y1; | |
484 | ✗ | yPos_[1] = y0; | |
485 | } | ||
486 | else { | ||
487 | 90616 | xPos_[0] = x0; | |
488 | 90616 | xPos_[1] = x1; | |
489 | 90616 | yPos_[0] = y0; | |
490 | 181232 | yPos_[1] = y1; | |
491 | } | ||
492 | }; | ||
493 | |||
494 | /*! | ||
495 | * \brief Returns the x coordinate of the i-th sampling point. | ||
496 | */ | ||
497 | Scalar x_(int i) const | ||
498 |
92/140✗ Branch 0 not taken.
✓ Branch 1 taken 2103 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2103 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2103 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2103 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2109 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2109 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2109 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 2109 times.
✓ Branch 16 taken 12 times.
✓ Branch 17 taken 2091 times.
✓ Branch 18 taken 12 times.
✓ Branch 19 taken 2091 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 2103 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 2103 times.
✓ Branch 24 taken 6 times.
✓ Branch 25 taken 2085 times.
✓ Branch 26 taken 6 times.
✓ Branch 27 taken 2085 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 90610 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 90610 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 90610 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 90610 times.
✓ Branch 36 taken 18 times.
✓ Branch 37 taken 90610 times.
✓ Branch 38 taken 18 times.
✓ Branch 39 taken 90610 times.
✓ Branch 40 taken 1191442 times.
✓ Branch 41 taken 19799213 times.
✓ Branch 42 taken 1191442 times.
✓ Branch 43 taken 19799213 times.
✗ Branch 44 not taken.
✓ Branch 45 taken 20990637 times.
✗ Branch 46 not taken.
✓ Branch 47 taken 20990637 times.
✓ Branch 48 taken 155768 times.
✓ Branch 49 taken 144294 times.
✓ Branch 50 taken 155768 times.
✓ Branch 51 taken 144294 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 300062 times.
✗ Branch 54 not taken.
✓ Branch 55 taken 300062 times.
✓ Branch 56 taken 19499133 times.
✓ Branch 57 taken 144300 times.
✓ Branch 58 taken 19499133 times.
✓ Branch 59 taken 144300 times.
✗ Branch 60 not taken.
✓ Branch 61 taken 19643433 times.
✗ Branch 62 not taken.
✓ Branch 63 taken 19643433 times.
✓ Branch 64 taken 55769 times.
✓ Branch 65 taken 161577 times.
✓ Branch 66 taken 55769 times.
✓ Branch 67 taken 161577 times.
✓ Branch 68 taken 162 times.
✓ Branch 69 taken 2333952 times.
✓ Branch 70 taken 162 times.
✓ Branch 71 taken 2333952 times.
✓ Branch 72 taken 6 times.
✓ Branch 73 taken 2334108 times.
✓ Branch 74 taken 6 times.
✓ Branch 75 taken 2334108 times.
✓ Branch 76 taken 201294 times.
✓ Branch 77 taken 6 times.
✓ Branch 78 taken 201294 times.
✓ Branch 79 taken 6 times.
✗ Branch 80 not taken.
✓ Branch 81 taken 201300 times.
✗ Branch 82 not taken.
✓ Branch 83 taken 201300 times.
✓ Branch 84 taken 55789 times.
✓ Branch 85 taken 89887 times.
✓ Branch 86 taken 55789 times.
✓ Branch 87 taken 89887 times.
✓ Branch 88 taken 55769 times.
✓ Branch 89 taken 1236210 times.
✓ Branch 90 taken 55769 times.
✓ Branch 91 taken 1236210 times.
✓ Branch 92 taken 55769 times.
✓ Branch 93 taken 1146309 times.
✓ Branch 94 taken 55769 times.
✓ Branch 95 taken 1146309 times.
✗ Branch 96 not taken.
✓ Branch 97 taken 1247211 times.
✗ Branch 98 not taken.
✓ Branch 99 taken 1247211 times.
✓ Branch 100 taken 2222539 times.
✓ Branch 101 taken 1191442 times.
✓ Branch 102 taken 2222539 times.
✓ Branch 103 taken 1191442 times.
✗ Branch 104 not taken.
✓ Branch 105 taken 2222755 times.
✗ Branch 106 not taken.
✓ Branch 107 taken 2222755 times.
✗ Branch 108 not taken.
✓ Branch 109 taken 216 times.
✗ Branch 110 not taken.
✓ Branch 111 taken 216 times.
✗ Branch 112 not taken.
✓ Branch 113 taken 176 times.
✗ Branch 114 not taken.
✓ Branch 115 taken 176 times.
✗ Branch 116 not taken.
✓ Branch 117 taken 176 times.
✗ Branch 118 not taken.
✓ Branch 119 taken 176 times.
✓ Branch 120 taken 1146519 times.
✗ Branch 121 not taken.
✓ Branch 122 taken 1146519 times.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✓ Branch 125 taken 1146519 times.
✗ Branch 126 not taken.
✓ Branch 127 taken 1146519 times.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
|
147790776 | { return xPos_[i]; } |
499 | |||
500 | /*! | ||
501 | * \brief Returns the y coordinate of the i-th sampling point. | ||
502 | */ | ||
503 | Scalar y_(int i) const | ||
504 |
9/18✗ Branch 0 not taken.
✓ Branch 1 taken 2097 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2097 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2097 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2097 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 55769 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 144294 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 144294 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 144294 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 88525 times.
|
697114 | { return yPos_[i]; } |
505 | |||
506 | /*! | ||
507 | * \brief Returns the moment (i.e. second derivative) of the | ||
508 | * spline at the i-th sampling point. | ||
509 | */ | ||
510 | Scalar moment_(int i) const | ||
511 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 55775 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 55775 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 55775 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 55775 times.
|
198494228 | { return m_[i]; } |
512 | |||
513 | Vector xPos_; | ||
514 | Vector yPos_; | ||
515 | Vector m_; | ||
516 | }; | ||
517 | |||
518 | } // end namespace Dumux | ||
519 | |||
520 | #endif | ||
521 |