Debian Codegraph @

dune/localfunctions/refined/refinedp0/refinedp0localcoefficients.hh

raw
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5 #ifndef DUNE_REFINED_P0_LOCALCOEFFICIENTS_HH
6 #define DUNE_REFINED_P0_LOCALCOEFFICIENTS_HH
7
8 #include <cstddef>
9 #include <iostream>
10 #include <vector>
11
12 #include <dune/localfunctions/common/localkey.hh>
13
14 namespace Dune
15 {
16
17 /**
18 \brief Layout map for RefinedP0 elements
19
20 \nosubgrouping
21 * \ingroup LocalFunctionsImpl
22 \implements Dune::LocalCoefficientsVirtualImp
23 */
24 template<unsigned int k>
25 class RefinedP0LocalCoefficients
26 {
27 // 2 to the k-th power
28 constexpr static int N = 1<<k;
29
30 public:
31 RefinedP0LocalCoefficients () :
32 localKeys_(N)
33 {
34 // All functions are associated to the element
35 for (int i = 0; i < N; ++i)
36 localKeys_[i] = LocalKey(0,0,i);
37 }
38
39 //! number of coefficients
40 std::size_t size () const
41 {
42 return N;
43 }
44
45 //! get i'th index
46 const LocalKey& localKey (std::size_t i) const
47 {
48 return localKeys_[i];
49 }
50
51 private:
52 std::vector<LocalKey> localKeys_;
53
54 };
55
56 }
57
58 #endif