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>
14#include <dune/typetree/powernode.hh>
15#include <dune/typetree/compositenode.hh>
39class TaylorHoodVelocityTree;
42class TaylorHoodBasisTree;
63template<
typename GV,
bool HI=false>
66 static const bool useHybridIndices = HI;
68 static const int dim = GV::dimension;
134 template<
class SizePrefix>
137 return sizeImp<useHybridIndices>(prefix);
142 template<
bool hi,
class SizePrefix,
143 std::enable_if_t<not hi,int> = 0>
144 size_type sizeImp(
const SizePrefix& prefix)
const
146 if (prefix.size() == 0)
148 if (prefix.size() == 1)
155 assert(prefix.size() == 2);
159 template<
bool hi,
class SizePrefix,
160 std::enable_if_t<hi,int> = 0>
161 size_type sizeImp(
const SizePrefix& prefix)
const
163 if (prefix.size() == 0)
165 if (prefix.size() == 1)
172 if (prefix.size() == 2)
179 assert(prefix.size() == 3);
197 template<
typename It>
200 return indicesImp<useHybridIndices>(node, it);
212 return CD::makeDescriptor(
214 CD::FlatArray<GV::dimension>{}),
217 return CD::Array<CD::FlatVector,2>{
224 template<
class MultiIndex>
227 M.resize(M.size()+1);
228 for(std::size_t i=M.size()-1; i>0; --i)
233 template<
bool hi,
class It,
234 std::enable_if_t<not hi,int> = 0>
237 using namespace Dune::Indices;
238 for(std::size_t child=0; child<dim; ++child)
242 for (std::size_t i = 0; i<subTreeSize; ++i)
245 multiIndices[i][1] = multiIndices[i][1]*dim + child;
247 multiIndices += subTreeSize;
251 for (std::size_t i = 0; i<subTreeSize; ++i)
253 multiIndices += subTreeSize;
257 template<
bool hi,
class It,
258 std::enable_if_t<hi,int> = 0>
261 using namespace Dune::Indices;
262 for(std::size_t child=0; child<dim; ++child)
266 for (std::size_t i = 0; i<subTreeSize; ++i)
269 multiIndices[i].push_back(i);
271 multiIndices += subTreeSize;
275 for (std::size_t i = 0; i<subTreeSize; ++i)
277 multiIndices += subTreeSize;
299 for(
int i=0; i<GV::dimension; ++i)
300 this->setChild(i, std::make_shared<PQ2Node>());
307 TaylorHoodVelocityTree<GV>,
319 this->
template setChild<0>(std::make_shared<VelocityNode>());
320 this->
template setChild<1>(std::make_shared<PressureNode>());
326namespace BasisFactory {
336 return [](
const auto& gridView) {
auto taylorHood()
Create a pre-basis factory that can create a Taylor-Hood pre-basis.
Definition taylorhoodbasis.hh:334
Definition polynomial.hh:17
Definition containerdescriptors.hh:47
Global basis for given pre-basis.
Definition defaultglobalbasis.hh:50
Definition lagrangebasis.hh:375
It indices(const Node &node, It it) const
Definition lagrangebasis.hh:180
void initializeIndices()
Initialize the global indices.
Definition lagrangebasis.hh:98
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition lagrangebasis.hh:128
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition lagrangebasis.hh:172
size_type size(const SizePrefix &prefix) const
Return number of possible values for next position in multi index.
Definition leafprebasismixin.hh:53
size_type size() const
Definition nodes.hh:147
Definition taylorhoodbasis.hh:292
TaylorHoodVelocityTree()
Definition taylorhoodbasis.hh:297
Definition taylorhoodbasis.hh:310
TaylorHoodBasisTree()
Definition taylorhoodbasis.hh:317
Pre-basis for lowest order Taylor-Hood basis.
Definition taylorhoodbasis.hh:65
TaylorHoodPreBasis(const GridView &gv)
Constructor for a given grid view object.
Definition taylorhoodbasis.hh:93
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition taylorhoodbasis.hh:107
static constexpr size_type minMultiIndexSize
Definition taylorhoodbasis.hh:82
size_type size(const SizePrefix &prefix) const
Return number of possible values for next position in multi index.
Definition taylorhoodbasis.hh:135
GridView gridView_
Definition taylorhoodbasis.hh:281
GV GridView
The grid view that the FE basis is defined on.
Definition taylorhoodbasis.hh:73
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition taylorhoodbasis.hh:113
auto containerDescriptor() const
Return an container descriptor depending on the flag HI. Either return a Tuple if hybrid indices shou...
Definition taylorhoodbasis.hh:208
PQ2PreBasis pq2PreBasis_
Definition taylorhoodbasis.hh:284
size_type size() const
Same as size(prefix) with empty prefix.
Definition taylorhoodbasis.hh:128
size_type dimension() const
Get the total dimension of the space spanned by this basis.
Definition taylorhoodbasis.hh:186
PQ1PreBasis pq1PreBasis_
Definition taylorhoodbasis.hh:283
static const void multiIndexPushFront(MultiIndex &M, size_type M0)
Definition taylorhoodbasis.hh:225
static constexpr size_type maxMultiIndexSize
Definition taylorhoodbasis.hh:81
Node makeNode() const
Create tree node.
Definition taylorhoodbasis.hh:122
It indices(const Node &node, It it) const
Definition taylorhoodbasis.hh:198
static constexpr size_type multiIndexBufferSize
Definition taylorhoodbasis.hh:83
void initializeIndices()
Initialize the global indices.
Definition taylorhoodbasis.hh:100
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition taylorhoodbasis.hh:192
std::size_t size_type
Type used for indices and size information.
Definition taylorhoodbasis.hh:76
It indicesImp(const Node &node, It multiIndices) const
Definition taylorhoodbasis.hh:235