3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_TAYLORHOODBASIS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_TAYLORHOODBASIS_HH
6#include <dune/common/exceptions.hh>
7#include <dune/common/reservedvector.hh>
8#include <dune/common/indices.hh>
10#include <dune/typetree/powernode.hh>
11#include <dune/typetree/compositenode.hh>
35class TaylorHoodVelocityTree;
38class TaylorHoodBasisTree;
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 typename std::enable_if<not hi,int>::type = 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 typename std::enable_if<hi,int>::type = 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>
196 return indicesImp<useHybridIndices>(node, it);
201 template<
class MultiIndex>
204 M.resize(M.size()+1);
205 for(std::size_t i=M.size()-1; i>0; --i)
210 template<
bool hi,
class It,
211 typename std::enable_if<not hi,int>::type = 0>
214 using namespace Dune::Indices;
215 for(std::size_t child=0; child<dim; ++child)
219 for (std::size_t i = 0; i<subTreeSize; ++i)
222 multiIndices[i][1] = multiIndices[i][1]*dim + child;
224 multiIndices += subTreeSize;
228 for (std::size_t i = 0; i<subTreeSize; ++i)
230 multiIndices += subTreeSize;
234 template<
bool hi,
class It,
235 typename std::enable_if<hi,int>::type = 0>
238 using namespace Dune::Indices;
239 for(std::size_t child=0; child<dim; ++child)
243 for (std::size_t i = 0; i<subTreeSize; ++i)
246 multiIndices[i].push_back(i);
248 multiIndices += subTreeSize;
252 for (std::size_t i = 0; i<subTreeSize; ++i)
254 multiIndices += subTreeSize;
276 for(
int i=0; i<GV::dimension; ++i)
277 this->setChild(i, std::make_shared<PQ2Node>());
284 TaylorHoodVelocityTree<GV>,
296 this->
template setChild<0>(std::make_shared<VelocityNode>());
297 this->
template setChild<1>(std::make_shared<PressureNode>());
303namespace BasisFactory {
313 return [](
const auto& gridView) {
auto taylorHood()
Create a pre-basis factory that can create a Taylor-Hood pre-basis.
Definition: taylorhoodbasis.hh:311
Definition: polynomial.hh:10
Global basis for given pre-basis.
Definition: defaultglobalbasis.hh:46
Definition: lagrangebasis.hh:387
It indices(const Node &node, It it) const
Definition: lagrangebasis.hh:192
void initializeIndices()
Initialize the global indices.
Definition: lagrangebasis.hh:96
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition: lagrangebasis.hh:126
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition: lagrangebasis.hh:184
size_type size() const
Same as size(prefix) with empty prefix.
Definition: lagrangebasis.hh:140
size_type size() const
Definition: nodes.hh:142
Definition: taylorhoodbasis.hh:269
TaylorHoodVelocityTree()
Definition: taylorhoodbasis.hh:274
Definition: taylorhoodbasis.hh:287
TaylorHoodBasisTree()
Definition: taylorhoodbasis.hh:294
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:258
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
PQ2PreBasis pq2PreBasis_
Definition: taylorhoodbasis.hh:261
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:260
static const void multiIndexPushFront(MultiIndex &M, size_type M0)
Definition: taylorhoodbasis.hh:202
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:212