3 #ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_RANNACHERTUREKBASIS_HH 4 #define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_RANNACHERTUREKBASIS_HH 6 #include <dune/common/exceptions.hh> 8 #include <dune/localfunctions/rannacherturek.hh> 10 #include <dune/typetree/leafnode.hh> 32 template<
typename GV,
typename TP>
35 template<
typename GV,
class MI,
class TP>
38 template<
typename GV,
class MI>
54 template<
typename GV,
class MI>
57 static const int dim = GV::dimension;
142 assert(prefix.size() == 0 || prefix.size() == 1);
143 return (prefix.size() == 0) ?
size() : 0;
155 return 2*GV::dimension;
164 template<
typename GV,
typename TP>
168 static const int dim = GV::dimension;
169 static const int maxSize = 2*dim;
177 using Element =
typename GV::template Codim<0>::Entity;
178 using FiniteElement = RannacherTurekLocalFiniteElement<typename GV::ctype, double, dim>;
198 return finiteElement_;
206 if (e.type() != finiteElement_.type())
207 DUNE_THROW(Dune::Exception,
208 "Rannacher-Turek elements do not exist for elements of type " << e.type());
210 this->setSize(finiteElement_.size());
221 template<
typename GV,
class MI,
class TP>
224 enum {dim = GV::dimension};
262 return (
size_type)(node_->finiteElement().size());
266 template<
typename It>
271 Dune::LocalKey localKey = node_->finiteElement().localCoefficients().localKey(i);
272 const auto& gridIndexSet = preBasis_->gridView().indexSet();
273 const auto& element = node_->element();
275 *it = {{ (
size_type)(gridIndexSet.subIndex(element,localKey.subEntity(),1)) }};
288 namespace BasisBuilder {
292 template<
class Dummy=
void>
293 class RannacherTurekPreBasisFactory
296 static const std::size_t requiredMultiIndexSize = 1;
298 template<
class MultiIndex,
class Gr
idView>
315 template<
class Dummy=
void>
318 return Imp::RannacherTurekPreBasisFactory<void>();
338 template<
typename GV>
344 #endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_PQ1NODALBASIS_HH typename GV::template Codim< 0 >::Entity Element
Definition: rannacherturekbasis.hh:177
Node< TP > node(const TP &tp) const
Create tree node with given root tree path.
Definition: rannacherturekbasis.hh:113
TP TreePath
Definition: nodes.hh:126
Definition: rannacherturekbasis.hh:33
std::size_t size_type
Definition: nodes.hh:127
size_type size() const
Same as size(prefix) with empty prefix.
Definition: rannacherturekbasis.hh:134
Pre-basis for a Rannacher-Turek basis.
Definition: rannacherturekbasis.hh:39
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition: rannacherturekbasis.hh:91
MI MultiIndex
Type used for global numbering of the basis vectors.
Definition: rannacherturekbasis.hh:231
const Node * node_
Definition: rannacherturekbasis.hh:283
const FiniteElement finiteElement_
Definition: rannacherturekbasis.hh:215
IndexSet< TP > indexSet() const
Create tree node index set with given root tree path.
Definition: rannacherturekbasis.hh:128
Dune::ReservedVector< size_type, 1 > SizePrefix
Type used for prefixes handed to the size() method.
Definition: rannacherturekbasis.hh:79
RannacherTurekLocalFiniteElement< typename GV::ctype, double, dim > FiniteElement
Definition: rannacherturekbasis.hh:178
std::size_t size_type
Definition: rannacherturekbasis.hh:228
MI MultiIndex
Type used for global numbering of the basis vectors.
Definition: rannacherturekbasis.hh:76
void bind(const Node &node)
Bind the view to a grid element.
Definition: rannacherturekbasis.hh:246
Definition: rannacherturekbasis.hh:36
Global basis for given pre-basis.
Definition: defaultglobalbasis.hh:42
size_type dimension() const
Get the total dimension of the space spanned by this basis.
Definition: rannacherturekbasis.hh:147
RannacherTurekPreBasis(const GridView &gv)
Constructor for a given grid view object.
Definition: rannacherturekbasis.hh:82
const PreBasis * preBasis_
Definition: rannacherturekbasis.hh:281
std::size_t size_type
Type used for indices and size information.
Definition: rannacherturekbasis.hh:65
auto rannacherTurek()
Create a pre-basis factory that can create a Rannacher-Turek pre-basis.
Definition: rannacherturekbasis.hh:316
const Element & element() const
Return current element, throw if unbound.
Definition: rannacherturekbasis.hh:187
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition: rannacherturekbasis.hh:153
It indices(It it) const
Maps from subtree index set [0..size-1] to a globally unique multi index in global basis...
Definition: rannacherturekbasis.hh:267
const FiniteElement & finiteElement() const
Return the LocalFiniteElement for the element we are bound to.
Definition: rannacherturekbasis.hh:196
Definition: polynomial.hh:7
GridView gridView_
Definition: rannacherturekbasis.hh:159
size_type size(const SizePrefix prefix) const
Return number of possible values for next position in multi index.
Definition: rannacherturekbasis.hh:140
RannacherTurekNode(const TreePath &treePath)
Definition: rannacherturekbasis.hh:180
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition: rannacherturekbasis.hh:97
size_type size() const
Size of subtree rooted in this node (element-local)
Definition: rannacherturekbasis.hh:260
GV GridView
The grid view that the FE basis is defined on.
Definition: rannacherturekbasis.hh:62
void bind(const Element &e)
Bind to element.
Definition: rannacherturekbasis.hh:202
typename PreBasis::template Node< TP > Node
Definition: rannacherturekbasis.hh:235
void initializeIndices()
Initialize the global indices.
Definition: rannacherturekbasis.hh:87
RannacherTurekNodeIndexSet(const PreBasis &preBasis)
Definition: rannacherturekbasis.hh:237
const Element * element_
Definition: rannacherturekbasis.hh:216
void unbind()
Unbind the view.
Definition: rannacherturekbasis.hh:253