dune-pdelab  2.0.0
rt0cube2dfem.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil -*-
2 #ifndef DUNE_PDELAB_FINITEELEMENTMAP_RT0CUBE2DFEM_HH
3 #define DUNE_PDELAB_FINITEELEMENTMAP_RT0CUBE2DFEM_HH
4 
5 #include<vector>
6 #include<dune/localfunctions/raviartthomas/raviartthomas0cube2d.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::RT0Cube2DLocalFiniteElement<D,R> >,
18  RT0Cube2DLocalFiniteElementMap<GV,D,R> >
19  {
20  typedef Dune::RT0Cube2DLocalFiniteElement<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<16; i++)
33  variant[i] = FE(i);
34 
35  // compute orientation for all elements
36  typedef typename GV::Traits::template Codim<0>::Iterator ElementIterator;
37  typedef typename GV::IntersectionIterator IntersectionIterator;
38 
39  // loop once over the grid
40  for (ElementIterator it = gv.template begin<0>(); it!=gv.template end<0>(); ++it)
41  {
42  unsigned int myid = is.template index<0>(*it);
43  orient[myid] = 0;
44 
45  IntersectionIterator endit = gv.iend(*it);
46  for (IntersectionIterator iit = gv.ibegin(*it); iit!=endit; ++iit)
47  if (iit->neighbor())
48  {
49  if (is.template index<0>(*(iit->outside()))>myid)
50  orient[myid] |= 1<<iit->indexInInside();
51  }
52  }
53  }
54 
56  template<class EntityType>
57  const typename Traits::FiniteElementType& find (const EntityType& e) const
58  {
59  return variant[orient[is.template index<0>(e)]];
60  }
61 
62  bool fixedSize() const
63  {
64  return true;
65  }
66 
67  std::size_t size(GeometryType gt) const
68  {
69  return gt.isLine() ? 1 : 0;
70  }
71 
72  std::size_t maxLocalSize() const
73  {
74  return 4;
75  }
76 
77  private:
78  GV gv;
79  FE variant[16];
80  const IndexSet& is;
81  std::vector<unsigned char> orient;
82  };
83  }
84 }
85 
86 #endif // DUNE_PDELAB_FINITEELEMENTMAP_RT0CUBE2DFEM_HH
const Traits::FiniteElementType & find(const EntityType &e) const
get local basis functions for entity
Definition: rt0cube2dfem.hh:57
std::size_t maxLocalSize() const
Definition: rt0cube2dfem.hh:72
interface for a finite element map
Definition: finiteelementmap.hh:42
T FiniteElementType
Type of finite element from local functions.
Definition: finiteelementmap.hh:30
LocalFiniteElementMapTraits< FE > Traits
export type of the signature
Definition: rt0cube2dfem.hh:25
std::size_t size(GeometryType gt) const
Definition: rt0cube2dfem.hh:67
bool fixedSize() const
Definition: rt0cube2dfem.hh:62
RT0Cube2DLocalFiniteElementMap(const GV &gv_)
Use when Imp has a standard constructor.
Definition: rt0cube2dfem.hh:28
Definition: rt0cube2dfem.hh:16
collect types exported by a finite element map
Definition: finiteelementmap.hh:38
const E & e
Definition: interpolate.hh:172