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 The cubic hermite spline basis |
11 |
|
|
*/ |
12 |
|
|
#ifndef DUMUX_COMMON_CUBIC_SPLINE_HERMITE_BASIS_HH |
13 |
|
|
#define DUMUX_COMMON_CUBIC_SPLINE_HERMITE_BASIS_HH |
14 |
|
|
|
15 |
|
|
namespace Dumux { |
16 |
|
|
|
17 |
|
|
/*! |
18 |
|
|
* \ingroup Core |
19 |
|
|
* \brief The cubic spline hermite basis |
20 |
|
|
* \note see https://en.wikipedia.org/wiki/Cubic_Hermite_spline |
21 |
|
|
*/ |
22 |
|
|
template<class Scalar = double> |
23 |
|
|
struct CubicSplineHermiteBasis |
24 |
|
|
{ |
25 |
|
|
static constexpr Scalar h00(const Scalar t) |
26 |
|
53002962 |
{ return t*(2.0*t*t - 3.0*t) + 1.0; } |
27 |
|
|
|
28 |
|
|
static constexpr Scalar h10(const Scalar t) |
29 |
|
53002962 |
{ return t*(t*t - 2.0*t + 1.0); } |
30 |
|
|
|
31 |
|
|
static constexpr Scalar h01(const Scalar t) |
32 |
|
53002962 |
{ return t*t*(3.0 - 2.0*t); } |
33 |
|
|
|
34 |
|
|
static constexpr Scalar h11(const Scalar t) |
35 |
|
53002962 |
{ return t*t*(t - 1.0); } |
36 |
|
|
|
37 |
|
|
static constexpr Scalar dh00(const Scalar t) |
38 |
|
4007320 |
{ return 6.0*t*(t - 1.0); } |
39 |
|
|
|
40 |
|
|
static constexpr Scalar dh10(const Scalar t) |
41 |
|
4007320 |
{ return t*(3.0*t - 4.0) + 1.0; } |
42 |
|
|
|
43 |
|
|
static constexpr Scalar dh01(const Scalar t) |
44 |
|
4007320 |
{ return 6.0*t*(1.0 - t); } |
45 |
|
|
|
46 |
|
|
static constexpr Scalar dh11(const Scalar t) |
47 |
|
4007320 |
{ return t*(3.0*t - 2.0); } |
48 |
|
|
}; |
49 |
|
|
|
50 |
|
|
} // end namespace Dumux |
51 |
|
|
|
52 |
|
|
#endif |
53 |
|
|
|