4 #ifndef DUNE_PDELAB_FINITEELEMENTMAP_FINITEELEMENTMAP_HH 5 #define DUNE_PDELAB_FINITEELEMENTMAP_FINITEELEMENTMAP_HH 7 #include <dune/common/deprecated.hh> 10 #include <dune/geometry/referenceelements.hh> 41 template<
class T,
class Imp>
54 template<
class EntityType>
56 find (
const EntityType&
e)
const =
delete;
75 bool fixedSize()
const =
delete;
79 std::size_t size(GeometryType gt)
const =
delete;
84 bool hasDOFs(
int codim)
const =
delete;
90 std::size_t maxLocalSize()
const =
delete;
96 struct inject_dimension
98 static constexpr
int dimension =
dim;
102 struct inject_dimension<-1>
104 DUNE_DEPRECATED_MSG(
"Your FEM implementation does not export the dimension. This will cause compilation errors after PDELab 2.6.") inject_dimension() {};
110 template<
class Imp,
int dim_ = -1>
113 SimpleLocalFiniteElementMap<Imp> >,
114 public Impl::inject_dimension<dim_>
129 template<
class EntityType>
159 template<
typename GV,
typename FE,
typename Imp>
162 LocalFiniteElementMapTraits<FE>,
166 typedef typename GV::IndexSet IndexSet;
167 static const int dim = GV::dimension;
174 static constexpr
int dimension = GV::dimension;
178 : gv(gv_), orient(gv_.size(0))
180 using ct =
typename GV::Grid::ctype;
182 ReferenceElements<ct, dim>::general(FE().type());
184 auto &idSet = gv.grid().globalIdSet();
187 variant.resize(1 << refElem.size(dim-1));
188 for (std::size_t i=0; i<variant.size(); i++)
192 auto& indexSet = gv.indexSet();
195 for (
const auto& element : elements(gv))
197 auto elemid = indexSet.index(element);
200 std::vector<typename GV::Grid::GlobalIdSet::IdType> vid(refElem.size(dim));
201 for(std::size_t i = 0; i < vid.size(); ++i)
202 vid[i] = idSet.subId(element, i, dim);
205 for(
int i = 0; i < refElem.size(dim-1); ++i) {
206 auto v0 = refElem.subEntity(i, dim-1, 0, dim);
207 auto v1 = refElem.subEntity(i, dim-1, 1, dim);
209 if((v0 > v1) != (vid[v0] > vid[v1]))
210 orient[elemid] |= 1 << i;
216 template<
class EntityType>
219 return variant[orient[gv.indexSet().index(e)]];
224 std::vector<FE> variant;
225 std::vector<unsigned char> orient;
230 template<
typename GV,
typename FE,
typename Imp, std::
size_t Variants>
233 LocalFiniteElementMapTraits<FE>,
236 typedef FE FiniteElement;
237 typedef typename GV::IndexSet IndexSet;
244 static constexpr
int dimension = GV::dimension;
248 : gv(gv_), is(gv_.indexSet()), orient(gv_.size(0))
251 for (std::size_t i = 0; i < Variants; i++)
253 variant[i] = FiniteElement(i);
258 for(
const auto& cell : elements(gv))
260 auto myId = is.index(cell);
263 for (
const auto& intersection : intersections(gv,cell))
265 if (intersection.neighbor()
266 && is.index(intersection.outside()) > myId)
268 orient[myId] |= 1 << intersection.indexInInside();
275 template<
class EntityType>
278 return variant[orient[is.index(e)]];
283 std::array<FiniteElement,Variants> variant;
285 std::vector<unsigned char> orient;
293 #endif // DUNE_PDELAB_FINITEELEMENTMAP_FINITEELEMENTMAP_HH static const int dim
Definition: adaptivity.hh:84
const Entity & e
Definition: localfunctionspace.hh:120
Definition: finiteelementmap.hh:231
const Traits::FiniteElementType & find(const EntityType &e) const
get local basis functions for entity
Definition: finiteelementmap.hh:130
FiniteElementMap exception raised when trying to obtain a finite element for an unsupported GeometryT...
Definition: finiteelementmap.hh:23
LocalFiniteElementMapTraits< FE > Traits
export type of the signature
Definition: finiteelementmap.hh:241
collect types exported by a finite element map
Definition: finiteelementmap.hh:38
FiniteElementMap exception concerning the computation of the FiniteElementMap size.
Definition: finiteelementmap.hh:21
const Traits::FiniteElementType & find(const EntityType &e) const
get local basis functions for entity
Definition: finiteelementmap.hh:276
SimpleLocalFiniteElementMap(const Imp &imp_)
Constructor where an instance of Imp can be provided.
Definition: finiteelementmap.hh:125
implementation for finite elements requiring oriented edges
Definition: finiteelementmap.hh:160
T FiniteElementType
Type of finite element from local functions.
Definition: finiteelementmap.hh:30
T Traits
Export traits.
Definition: finiteelementmap.hh:46
RTLocalFiniteElementMap(const GV &gv_)
Use when Imp has a standard constructor.
Definition: finiteelementmap.hh:247
EdgeS0LocalFiniteElementMap(const GV &gv_)
construct EdgeSLocalFiniteElementMap
Definition: finiteelementmap.hh:177
SimpleLocalFiniteElementMap()
Use when Imp has a standard constructor.
Definition: finiteelementmap.hh:121
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
PDELab-specific exceptions.
LocalFiniteElementMapTraits< FE > Traits
export type of the signature
Definition: finiteelementmap.hh:171
const Traits::FiniteElementType & find(const EntityType &e) const
get local basis functions for entity
Definition: finiteelementmap.hh:217
LocalFiniteElementMapTraits< Imp > Traits
export type of the signature
Definition: finiteelementmap.hh:118
collect types exported by a finite element map
Definition: finiteelementmap.hh:27
Base class for all PDELab exceptions.
Definition: exceptions.hh:17
general FiniteElementMap exception
Definition: finiteelementmap.hh:19
T FiniteElement
Type of finite element from local functions.
Definition: finiteelementmap.hh:33
simple implementation where all entities have the same finite element
Definition: finiteelementmap.hh:111
interface for a finite element map
Definition: finiteelementmap.hh:42