DUNE PDELab (git)

qkfem.hh
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 
4 #ifndef DUNE_PDELAB_FINITEELEMENTMAP_QKFEM_HH
5 #define DUNE_PDELAB_FINITEELEMENTMAP_QKFEM_HH
6 
7 #include <cstddef>
8 
9 #include <dune/localfunctions/lagrange/lagrangecube.hh>
10 #include <dune/pdelab/finiteelementmap/finiteelementmap.hh>
11 
12 namespace Dune {
13  namespace PDELab {
14 
17  template<typename GV, typename D, typename R, std::size_t k>
19  : public SimpleLocalFiniteElementMap<Dune::LagrangeCubeLocalFiniteElement<D,R,GV::dimension,k>,GV::dimension>
20  {
21 
22  public:
23 
24  static_assert(
25  (k == 1) or (GV::dimension == 2 or GV::dimension == 3),
26  "QkLocalFiniteElementMap with k = 2 is only implemented for d = 2,3"
27  );
28 
29  static_assert(
30  k == 1 or k == 2,
31  "QkLocalFiniteElementMap is only implemented for k = 1,2"
32  );
33 
34  QkLocalFiniteElementMap(const GV& gv)
35  {}
36 
37  static constexpr bool fixedSize()
38  {
39  return true;
40  }
41 
42  static constexpr bool hasDOFs(int codim)
43  {
44  switch(k)
45  {
46  case 1:
47  return codim == GV::dimension;
48  case 2:
49  return true;
50  default:
51  return false;
52  }
53  }
54 
55  static constexpr std::size_t size(GeometryType gt)
56  {
57  switch (k)
58  {
59  case 1:
60  return gt == GeometryTypes::vertex ? 1 : 0;
61  case 2:
62  // Q1 simply attaches a single DOF to each subentity
63  return 1;
64  default:
65  return 0;
66  }
67  }
68 
69  static constexpr std::size_t maxLocalSize()
70  {
71  std::size_t r = 1;
72  for (std::size_t i = 0; i < GV::dimension; ++i)
73  r *= (k + 1);
74  return r;
75  }
76 
77  };
78 
79  }
80 }
81 
82 #endif // DUNE_PDELAB_FINITEELEMENTMAP_QKFEM_HH
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
simple implementation where all entities have the same finite element
Definition: finiteelementmap.hh:101
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:158
constexpr GeometryType vertex
GeometryType representing a vertex.
Definition: type.hh:492
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)