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