Dune Core Modules (2.7.0)

localcoefficients.hh
1#ifndef DUNE_LOCALFUNCTIONS_BREZZIDOUGLASFORTINMARINI_CUBE_LOCALCOEFFICIENTS_HH
2#define DUNE_LOCALFUNCTIONS_BREZZIDOUGLASFORTINMARINI_CUBE_LOCALCOEFFICIENTS_HH
3
4#include <cstddef>
5#include <vector>
6
7#include <dune/common/math.hh>
10
11#include <dune/localfunctions/common/localkey.hh>
12
13namespace Dune
14{
15
29 template<class D, class R, unsigned int dim, unsigned int order>
31 {
32 static constexpr unsigned int interiorDofs = dim*binomial(dim+order-2, order-2);
33 static constexpr unsigned int faceDofs = binomial(dim+order-2, order-1);
34
35 static constexpr std::size_t numFaces = 2*dim;
36 static constexpr std::size_t numDofs = numFaces*faceDofs + interiorDofs;
37
38 public:
41 {
42 for (auto j : range(numFaces))
43 for (auto i : range(faceDofs))
44 li[j*faceDofs + i] = LocalKey(j, 1, i);
45
46 for (auto i : range(interiorDofs))
47 li[numFaces*faceDofs + i] = LocalKey(0, 0, i);
48 }
49
51 std::size_t size () const { return numDofs; }
52
54 auto localKey (std::size_t i) const -> const LocalKey& { return li[i]; }
55
56 private:
57 std::vector<LocalKey> li;
58 };
59
60 template<class D, class R, unsigned int dim, unsigned int order>
61 constexpr unsigned int BDFMCubeLocalCoefficients<D, R, dim, order>::interiorDofs;
62
63 template<class D, class R, unsigned int dim, unsigned int order>
64 constexpr unsigned int BDFMCubeLocalCoefficients<D, R, dim, order>::faceDofs;
65
66 template<class D, class R, unsigned int dim, unsigned int order>
67 constexpr std::size_t BDFMCubeLocalCoefficients<D, R, dim, order>::numFaces;
68
69 // template<class D, class R, unsigned int dim, unsigned int order>
70 // constexpr std::size_t BDFMCubeLocalCoefficients<D, R, dim, order>::numDofs;
71
72
73#ifndef DOXYGEN
74 template<class D, class R, unsigned int dim>
75 class BDFMCubeLocalCoefficients<D, R, dim, 0>
76 {
77 static_assert( AlwaysFalse<D>::value,
78 "`BDFMCubeLocalCoefficients` not defined for order 0." );
79 };
80#endif // #ifndef DOXYGEN
81
82} // namespace Dune
83
84#endif // #ifndef DUNE_LOCALFUNCTIONS_BREZZIDOUGLASFORTINMARINI_CUBE_LOCALCOEFFICIENTS_HH
Layout map for Brezzi-Douglas-Fortin-Marini elements on cubes.
Definition: localcoefficients.hh:31
BDFMCubeLocalCoefficients()
Standard constructor.
Definition: localcoefficients.hh:40
std::size_t size() const
number of coefficients
Definition: localcoefficients.hh:51
auto localKey(std::size_t i) const -> const LocalKey &
geth i'th index
Definition: localcoefficients.hh:54
Describe position of one degree of freedom.
Definition: localkey.hh:21
Some useful basic math stuff.
Dune namespace.
Definition: alignedallocator.hh:14
static constexpr T binomial(const T &n, const T &k) noexcept
calculate the binomial coefficient n over k as a constexpr
Definition: math.hh:128
Utilities for reduction like operations on ranges.
static const bool value
always a false value
Definition: typetraits.hh:128
Traits for type conversions and type information.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)