4 #ifndef DUNE_PDELAB_FINITELEMENTMAP_HH
5 #define DUNE_PDELAB_FINITELEMENTMAP_HH
7 #include <dune/common/deprecated.hh>
10 #include <dune/geometry/referenceelements.hh>
41 template<
class T,
class Imp>
54 template<
class EntityType>
57 return asImp().find(e);
79 return asImp().fixedSize();
84 std::size_t
size(GeometryType gt)
const
86 return asImp().size();
97 return asImp().maxLocalSize();
101 Imp& asImp () {
return static_cast<Imp &
> (*this);}
102 const Imp& asImp ()
const {
return static_cast<const Imp &
>(*this);}
109 SimpleLocalFiniteElementMap<Imp> >
124 template<
class EntityType>
154 template<
typename GV,
typename FE,
typename Imp>
157 LocalFiniteElementMapTraits<FE>,
161 typedef typename GV::IndexSet IndexSet;
162 static const int dim = GV::dimension;
170 : gv(gv_), orient(gv_.
size(0))
172 typedef typename GV::Grid::ctype ct;
173 const ReferenceElement<ct, dim> &refElem =
174 ReferenceElements<ct, dim>::general(FE().type());
176 const typename GV::Grid::GlobalIdSet &idSet = gv.grid().globalIdSet();
179 variant.resize(1 << refElem.size(dim-1));
180 for (
unsigned int i=0; i<variant.size(); i++)
184 typedef typename GV::Traits::template Codim<0>::Iterator ElementIterator;
186 const typename GV::IndexSet& indexSet = gv.indexSet();
189 for (ElementIterator it = gv.template begin<0>(); it!=gv.template end<0>(); ++it)
191 unsigned int elemid = indexSet.template index<0>(*it);
194 std::vector<typename GV::Grid::GlobalIdSet::IdType> vid(refElem.size(dim));
195 for(
unsigned int i = 0; i < vid.size(); ++i)
196 vid[i] = idSet.subId(*it, i, dim);
199 for(
int i = 0; i < refElem.size(dim-1); ++i) {
200 int v0 = refElem.subEntity(i, dim-1, 0, dim);
201 int v1 = refElem.subEntity(i, dim-1, 1, dim);
203 if((v0 > v1) != (vid[v0] > vid[v1]))
204 orient[elemid] |= 1 << i;
210 template<
class EntityType>
213 return variant[orient[gv.indexSet().template index<0>(
e)]];
218 std::vector<FE> variant;
219 std::vector<unsigned char> orient;
FiniteElementMap exception concerning the computation of the FiniteElementMap size.
Definition: finiteelementmap.hh:21
FiniteElementMap exception raised when trying to obtain a finite element for an unsupported GeometryT...
Definition: finiteelementmap.hh:23
const Traits::FiniteElementType & find(const EntityType &e) const
Return local basis for the given entity.
Definition: finiteelementmap.hh:55
std::size_t maxLocalSize() const
compute an upper bound for the local number of DOFs.
Definition: finiteelementmap.hh:95
interface for a finite element map
Definition: finiteelementmap.hh:42
collect types exported by a finite element map
Definition: finiteelementmap.hh:27
PDELab-specific exceptions.
T FiniteElement
Type of finite element from local functions.
Definition: finiteelementmap.hh:33
T FiniteElementType
Type of finite element from local functions.
Definition: finiteelementmap.hh:30
SimpleLocalFiniteElementMap(const Imp &imp_)
Constructor where an instance of Imp can be provided.
Definition: finiteelementmap.hh:120
EdgeS0LocalFiniteElementMap(const GV &gv_)
construct EdgeSLocalFiniteElementMap
Definition: finiteelementmap.hh:169
bool fixedSize() const
a FiniteElementMap is fixedSize iif the size of the local functions space for each GeometryType is fi...
Definition: finiteelementmap.hh:77
const Traits::FiniteElementType & find(const EntityType &e) const
get local basis functions for entity
Definition: finiteelementmap.hh:211
general FiniteElementMap exception
Definition: finiteelementmap.hh:19
std::size_t size(GeometryType gt) const
if the FiniteElementMap is fixedSize, the size methods computes the number of DOFs for given Geometry...
Definition: finiteelementmap.hh:84
simple implementation where all entities have the same finite element
Definition: finiteelementmap.hh:107
LocalFiniteElementMapTraits< Imp > Traits
export type of the signature
Definition: finiteelementmap.hh:113
const Traits::FiniteElementType & find(const EntityType &e) const
get local basis functions for entity
Definition: finiteelementmap.hh:125
Base class for all PDELab exceptions.
Definition: exceptions.hh:17
SimpleLocalFiniteElementMap()
Use when Imp has a standard constructor.
Definition: finiteelementmap.hh:116
collect types exported by a finite element map
Definition: finiteelementmap.hh:38
implementation for finite elements requiring oriented edges
Definition: finiteelementmap.hh:155
const E & e
Definition: interpolate.hh:172
LocalFiniteElementMapTraits< FE > Traits
export type of the signature
Definition: finiteelementmap.hh:166
T Traits
Export traits.
Definition: finiteelementmap.hh:46