7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_TAYLORHOODBASIS_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_TAYLORHOODBASIS_HH
10#include <dune/common/exceptions.hh>
11#include <dune/common/reservedvector.hh>
12#include <dune/common/indices.hh>
59template<
typename GV,
bool HI=false>
62 static const bool useHybridIndices = HI;
64 static const int dim = GV::dimension;
130 template<
class SizePrefix>
133 return sizeImp<useHybridIndices>(prefix);
138 template<
bool hi,
class SizePrefix,
139 std::enable_if_t<not hi,int> = 0>
140 size_type sizeImp(
const SizePrefix& prefix)
const
142 if (prefix.size() == 0)
144 if (prefix.size() == 1)
151 assert(prefix.size() == 2);
155 template<
bool hi,
class SizePrefix,
156 std::enable_if_t<hi,int> = 0>
157 size_type sizeImp(
const SizePrefix& prefix)
const
159 if (prefix.size() == 0)
161 if (prefix.size() == 1)
168 if (prefix.size() == 2)
175 assert(prefix.size() == 3);
193 template<
typename It>
208 return CD::makeDescriptor(
210 CD::FlatArray<GV::dimension>{}),
211 CD::FlatVector{pq1PreBasis_.size()});
213 return CD::Array<CD::FlatVector,2>{
220 template<
class MultiIndex>
223 M.resize(M.size()+1);
224 for(std::size_t i=M.size()-1; i>0; --i)
229 template<
bool hi,
class It,
230 std::enable_if_t<not hi,int> = 0>
233 using namespace Dune::Indices;
234 for(std::size_t child=0; child<dim; ++child)
238 for (std::size_t i = 0; i<subTreeSize; ++i)
241 multiIndices[i][1] = multiIndices[i][1]*dim + child;
243 multiIndices += subTreeSize;
247 for (std::size_t i = 0; i<subTreeSize; ++i)
249 multiIndices += subTreeSize;
253 template<
bool hi,
class It,
254 std::enable_if_t<hi,int> = 0>
257 using namespace Dune::Indices;
258 for(std::size_t child=0; child<dim; ++child)
262 for (std::size_t i = 0; i<subTreeSize; ++i)
265 multiIndices[i].push_back(i);
267 multiIndices += subTreeSize;
271 for (std::size_t i = 0; i<subTreeSize; ++i)
273 multiIndices += subTreeSize;
295 for(
int i=0; i<GV::dimension; ++i)
303 TaylorHoodVelocityTree<GV>,
322namespace BasisFactory {
332 return [](
const auto& gridView) {
auto taylorHood()
Create a pre-basis factory that can create a Taylor-Hood pre-basis.
Definition taylorhoodbasis.hh:330
DefaultGlobalBasis< TaylorHoodPreBasis< GV > > TaylorHoodBasis
Nodal basis for a lowest order Taylor-Hood Lagrangean finite element space.
Definition taylorhoodbasis.hh:365
Definition monomialset.hh:19
Definition monomialset.hh:19
Definition containerfactory.hh:20
Global basis for given pre-basis.
Definition defaultglobalbasis.hh:53
Definition lagrangebasis.hh:379
A pre-basis for a PQ-lagrange bases with given order.
Definition lagrangebasis.hh:65
size_type size(const SizePrefix &prefix) const
Definition leafprebasismixin.hh:53
void setChild(Index i, TT &&t)
Definition nodes.hh:317
CompositeBasisNode()=default
const auto & child(Dune::index_constant< i > ii) const
Definition nodes.hh:408
void setChild(TT &&t, Dune::index_constant< i > ii={})
Definition nodes.hh:458
Definition taylorhoodbasis.hh:288
TaylorHoodVelocityTree()
Definition taylorhoodbasis.hh:293
Definition taylorhoodbasis.hh:306
TaylorHoodBasisTree()
Definition taylorhoodbasis.hh:313
Pre-basis for lowest order Taylor-Hood basis.
Definition taylorhoodbasis.hh:61
TaylorHoodPreBasis(const GridView &gv)
Constructor for a given grid view object.
Definition taylorhoodbasis.hh:89
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition taylorhoodbasis.hh:103
static constexpr size_type minMultiIndexSize
Definition taylorhoodbasis.hh:78
size_type size(const SizePrefix &prefix) const
Return number of possible values for next position in multi index.
Definition taylorhoodbasis.hh:131
GridView gridView_
Definition taylorhoodbasis.hh:277
GV GridView
The grid view that the FE basis is defined on.
Definition taylorhoodbasis.hh:69
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition taylorhoodbasis.hh:109
auto containerDescriptor() const
Return an container descriptor depending on the flag HI. Either return a Tuple if hybrid indices shou...
Definition taylorhoodbasis.hh:204
TaylorHoodBasisTree< GV > Node
Template mapping root tree path to type of created tree node.
Definition taylorhoodbasis.hh:75
PQ2PreBasis pq2PreBasis_
Definition taylorhoodbasis.hh:280
size_type size() const
Same as size(prefix) with empty prefix.
Definition taylorhoodbasis.hh:124
size_type dimension() const
Get the total dimension of the space spanned by this basis.
Definition taylorhoodbasis.hh:182
PQ1PreBasis pq1PreBasis_
Definition taylorhoodbasis.hh:279
static const void multiIndexPushFront(MultiIndex &M, size_type M0)
Definition taylorhoodbasis.hh:221
static constexpr size_type maxMultiIndexSize
Definition taylorhoodbasis.hh:77
Node makeNode() const
Create tree node.
Definition taylorhoodbasis.hh:118
It indices(const Node &node, It it) const
Definition taylorhoodbasis.hh:194
static constexpr size_type multiIndexBufferSize
Definition taylorhoodbasis.hh:79
void initializeIndices()
Initialize the global indices.
Definition taylorhoodbasis.hh:96
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition taylorhoodbasis.hh:188
std::size_t size_type
Type used for indices and size information.
Definition taylorhoodbasis.hh:72
It indicesImp(const Node &node, It multiIndices) const
Definition taylorhoodbasis.hh:231