dune-pdelab  2.7-git
bdm1simplex2dfem.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil -*-
2 #ifndef DUNE_PDELAB_FINITEELEMENTMAP_BDM1SIMPLEX2DFEM_HH
3 #define DUNE_PDELAB_FINITEELEMENTMAP_BDM1SIMPLEX2DFEM_HH
4 
5 #include <vector>
6 #include <dune/localfunctions/brezzidouglasmarini/brezzidouglasmarini1simplex2d.hh>
7 #include "finiteelementmap.hh"
8 
9 namespace Dune {
10  namespace PDELab {
11 
14  template<typename GV, typename D, typename R>
17  LocalFiniteElementMapTraits< Dune::BDM1Simplex2DLocalFiniteElement<D,R> >,
18  BDM1Simplex2DLocalFiniteElementMap<GV,D,R> >
19  {
20  typedef Dune::BDM1Simplex2DLocalFiniteElement<D,R> FE;
21  typedef typename GV::IndexSet IndexSet;
22 
23  public:
26 
28  static constexpr int dimension = GV::dimension;
29 
32  : gv(gv_), is(gv_.indexSet()), orient(gv_.size(0))
33  {
34  // create all variants
35  for (int i = 0; i < 8; i++)
36  {
37  variant[i] = FE(i);
38  }
39 
40  // compute orientation for all elements
41  //--------------------------------------------
42  // loop once over the grid
43  for (const auto& cell : elements(gv)) {
44  unsigned int myId = is.template index<0>(cell);
45  orient[myId] = 0;
46 
47  for (const auto& intersection : intersections(gv,cell)) {
48  if (intersection.neighbor()
49  && is.template index<0>(intersection.outside()) > myId)
50  {
51  orient[myId] |= 1 << intersection.indexInInside();
52  }
53  }
54  }
55  }
56 
58  template<class EntityType>
59  const typename Traits::FiniteElementType& find(const EntityType& e) const
60  {
61  return variant[orient[is.index(e)]];
62  }
63 
64  static constexpr bool fixedSize()
65  {
66  return true;
67  }
68 
69  static constexpr bool hasDOFs(int codim)
70  {
71  return codim == 1;
72  }
73 
74  static constexpr std::size_t size(GeometryType gt)
75  {
76  switch (gt.dim())
77  {
78  case 1:
79  return 2;
80  default:
81  return 0;
82  }
83  }
84 
85  static constexpr std::size_t maxLocalSize()
86  {
87  return 6;
88  }
89 
90  private:
91  GV gv;
92  FE variant[8];
93  const IndexSet& is;
94  std::vector<unsigned char> orient;
95  };
96  } // end namespace PDELab
97 } // end namespace Dune
98 
99 #endif // DUNE_PDELAB_FINITEELEMENTMAP_BDM1SIMPLEX2DFEM_HH
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap
Definition: bdm1simplex2dfem.hh:15
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap::maxLocalSize
static constexpr std::size_t maxLocalSize()
Definition: bdm1simplex2dfem.hh:85
Dune::PDELab::LocalFiniteElementMapInterface
interface for a finite element map
Definition: finiteelementmap.hh:42
Dune
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
e
const Entity & e
Definition: localfunctionspace.hh:121
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap::hasDOFs
static constexpr bool hasDOFs(int codim)
Definition: bdm1simplex2dfem.hh:69
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap::dimension
static constexpr int dimension
The dimension of the finite elements returned by this map.
Definition: bdm1simplex2dfem.hh:28
finiteelementmap.hh
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap::Traits
LocalFiniteElementMapTraits< FE > Traits
export type of the signature
Definition: bdm1simplex2dfem.hh:25
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap::find
const Traits::FiniteElementType & find(const EntityType &e) const
get local basis functions for entity
Definition: bdm1simplex2dfem.hh:59
Dune::PDELab::LocalFiniteElementMapTraits
collect types exported by a finite element map
Definition: finiteelementmap.hh:38
Dune::PDELab::FiniteElementMapTraits::FiniteElementType
T FiniteElementType
Type of finite element from local functions.
Definition: finiteelementmap.hh:30
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap::size
static constexpr std::size_t size(GeometryType gt)
Definition: bdm1simplex2dfem.hh:74
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap::fixedSize
static constexpr bool fixedSize()
Definition: bdm1simplex2dfem.hh:64
Dune::PDELab::BDM1Simplex2DLocalFiniteElementMap::BDM1Simplex2DLocalFiniteElementMap
BDM1Simplex2DLocalFiniteElementMap(const GV &gv_)
Use when Imp has a standard constructor.
Definition: bdm1simplex2dfem.hh:31