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