3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_RANNACHERTUREKBASIS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_RANNACHERTUREKBASIS_HH
6#include <dune/common/exceptions.hh>
8#include <dune/grid/common/capabilities.hh>
10#include <dune/localfunctions/common/localfiniteelementvariant.hh>
11#include <dune/localfunctions/rannacherturek.hh>
12#include <dune/localfunctions/crouzeixraviart.hh>
34class RannacherTurekNode;
36template<
typename GV,
class MI>
37class RannacherTurekPreBasis;
52template<
typename GV,
class MI>
55 static const int dim = GV::dimension;
69 using IndexSet = Impl::DefaultNodeIndexSet<RannacherTurekPreBasis>;
81 for(
auto type : gv.indexSet().types(0))
82 if (!type.isSimplex() && !type.isCube())
83 DUNE_THROW(Dune::NotImplemented,
"Rannacher-Turek or Crouzeix-Raviart elements are only implemented for grids with simplex or cube elements.");
117 [[deprecated(
"Warning: The IndexSet typedef and the makeIndexSet method are deprecated. "\
118 "As a replacement use the indices() method of the PreBasis directly.")]]
133 assert(prefix.size() == 0 || prefix.size() == 1);
134 return (prefix.size() == 0) ?
size() : 0;
146 return 2*GV::dimension;
149 template<
typename It>
152 for (
size_type i = 0, end = node.
size() ; i < end ; ++i, ++it)
154 Dune::LocalKey localKey = node.
finiteElement().localCoefficients().localKey(i);
155 const auto& gridIndexSet =
gridView().indexSet();
156 const auto& element = node.
element();
158 *it = {{ (
size_type)(gridIndexSet.subIndex(element,localKey.subEntity(),1)) }};
173 static const int dim = GV::dimension;
174 static const int maxSize = 2*dim;
176 constexpr static bool hasFixedElementType = Capabilities::hasSingleGeometryType<typename GV::Grid>::v;
178 using CubeFiniteElement = RannacherTurekLocalFiniteElement<typename GV::ctype,double,dim>;
179 using SimplexFiniteElement = CrouzeixRaviartLocalFiniteElement<typename GV::ctype,double,dim>;
181 constexpr static unsigned int topologyId = Capabilities::hasSingleGeometryType<typename GV::Grid>::topologyId;
182 constexpr static GeometryType type = GeometryType(topologyId, GV::dimension);
187 using Element =
typename GV::template Codim<0>::Entity;
189 std::conditional_t<type.isCube(),CubeFiniteElement,SimplexFiniteElement>,
190 LocalFiniteElementVariant<CubeFiniteElement, SimplexFiniteElement> >;
216 if constexpr (!hasFixedElementType)
230namespace BasisFactory {
234template<
class Dummy=
void>
235class RannacherTurekPreBasisFactory
238 static const std::size_t requiredMultiIndexSize = 1;
240 template<
class MultiIndex,
class Gr
idView>
241 auto makePreBasis(
const GridView& gridView)
const
257template<
class Dummy=
void>
260 return Imp::RannacherTurekPreBasisFactory<void>();
auto rannacherTurek()
Create a pre-basis factory that can create a Rannacher-Turek pre-basis.
Definition: rannacherturekbasis.hh:258
Definition: polynomial.hh:10
Global basis for given pre-basis.
Definition: defaultglobalbasis.hh:47
size_type size() const
Definition: nodes.hh:140
void setSize(const size_type size)
Definition: nodes.hh:162
Definition: rannacherturekbasis.hh:172
std::conditional_t< hasFixedElementType, std::conditional_t< type.isCube(), CubeFiniteElement, SimplexFiniteElement >, LocalFiniteElementVariant< CubeFiniteElement, SimplexFiniteElement > > FiniteElement
Definition: rannacherturekbasis.hh:190
void bind(const Element &e)
Bind to element.
Definition: rannacherturekbasis.hh:213
FiniteElement finiteElement_
Definition: rannacherturekbasis.hh:224
std::size_t size_type
Definition: rannacherturekbasis.hh:186
typename GV::template Codim< 0 >::Entity Element
Definition: rannacherturekbasis.hh:187
RannacherTurekNode()
Definition: rannacherturekbasis.hh:192
const Element * element_
Definition: rannacherturekbasis.hh:225
const FiniteElement & finiteElement() const
Return the LocalFiniteElement for the element we are bound to.
Definition: rannacherturekbasis.hh:207
const Element & element() const
Return current element, throw if unbound.
Definition: rannacherturekbasis.hh:198
Pre-basis for a Rannacher-Turek basis.
Definition: rannacherturekbasis.hh:54
Impl::DefaultNodeIndexSet< RannacherTurekPreBasis > IndexSet
Type of created tree node index set.
Definition: rannacherturekbasis.hh:69
Dune::ReservedVector< size_type, 1 > SizePrefix
Type used for prefixes handed to the size() method.
Definition: rannacherturekbasis.hh:75
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition: rannacherturekbasis.hh:144
It indices(const Node &node, It it) const
Definition: rannacherturekbasis.hh:150
IndexSet makeIndexSet() const
Create tree node index set.
Definition: rannacherturekbasis.hh:119
std::size_t size_type
Type used for indices and size information.
Definition: rannacherturekbasis.hh:63
size_type dimension() const
Get the total dimension of the space spanned by this basis.
Definition: rannacherturekbasis.hh:138
GV GridView
The grid view that the FE basis is defined on.
Definition: rannacherturekbasis.hh:60
size_type size() const
Same as size(prefix) with empty prefix.
Definition: rannacherturekbasis.hh:125
MI MultiIndex
Type used for global numbering of the basis vectors.
Definition: rannacherturekbasis.hh:72
size_type size(const SizePrefix prefix) const
Return number of possible values for next position in multi index.
Definition: rannacherturekbasis.hh:131
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition: rannacherturekbasis.hh:97
Node makeNode() const
Create tree node.
Definition: rannacherturekbasis.hh:105
GridView gridView_
Definition: rannacherturekbasis.hh:164
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition: rannacherturekbasis.hh:91
void initializeIndices()
Initialize the global indices.
Definition: rannacherturekbasis.hh:87
RannacherTurekPreBasis(const GridView &gv)
Constructor for a given grid view object.
Definition: rannacherturekbasis.hh:78