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>
35 class TaylorHoodVelocityTree;
38 class TaylorHoodBasisTree;
60 template<
typename GV,
class MI,
bool HI=false>
63 static const bool useHybridIndices = HI;
65 static const int dim = GV::dimension;
79 using IndexSet = Impl::DefaultNodeIndexSet<TaylorHoodPreBasis>;
89 using PQMultiIndex = std::array<size_type, 1>;
137 [[deprecated(
"Warning: The IndexSet typedef and the makeIndexSet method are deprecated. "\
138 "As a replacement use the indices() method of the PreBasis directly.")]]
153 return sizeImp<useHybridIndices>(prefix);
159 typename std::enable_if<not hi,int>::type = 0>
162 if (prefix.size() == 0)
164 if (prefix.size() == 1)
171 assert(prefix.size() == 2);
176 typename std::enable_if<hi,int>::type = 0>
179 if (prefix.size() == 0)
181 if (prefix.size() == 1)
188 if (prefix.size() == 2)
195 assert(prefix.size() == 3);
213 template<
typename It>
216 return indicesImp<useHybridIndices>(node, it);
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 typename std::enable_if<not hi,int>::type = 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 typename std::enable_if<hi,int>::type = 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;
285 template<
typename GV>
295 for(
int i=0; i<GV::dimension; ++i)
296 this->setChild(i, std::make_shared<PQ2Node>());
300 template<
typename GV>
303 TaylorHoodVelocityTree<GV>,
315 this->
template setChild<0>(std::make_shared<VelocityNode>());
316 this->
template setChild<1>(std::make_shared<PressureNode>());
322 namespace BasisFactory {
326 class TaylorHoodPreBasisFactory
329 static const std::size_t requiredMultiIndexSize=2;
331 template<
class MultiIndex,
class Gr
idView>
334 return TaylorHoodPreBasis<GridView, MultiIndex>(
gridView);
349 return Imp::TaylorHoodPreBasisFactory();
379 template<
typename GV>
auto taylorHood()
Create a pre-basis factory that can create a Taylor-Hood pre-basis.
Definition: taylorhoodbasis.hh:347
Definition: polynomial.hh:10
Global basis for given pre-basis.
Definition: defaultglobalbasis.hh:47
Definition: lagrangebasis.hh:406
size_type size() const
Same as size(prefix) with empty prefix.
Definition: lagrangebasis.hh:161
It indices(const Node &node, It it) const
Definition: lagrangebasis.hh:212
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition: lagrangebasis.hh:133
void initializeIndices()
Initialize the global indices.
Definition: lagrangebasis.hh:103
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition: lagrangebasis.hh:204
size_type size() const
Definition: nodes.hh:140
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:62
It indices(const Node &node, It it) const
Definition: taylorhoodbasis.hh:214
size_type size(const SizePrefix prefix) const
Return number of possible values for next position in multi index.
Definition: taylorhoodbasis.hh:151
GV GridView
The grid view that the FE basis is defined on.
Definition: taylorhoodbasis.hh:70
MI MultiIndex
Type used for global numbering of the basis vectors.
Definition: taylorhoodbasis.hh:82
std::size_t size_type
Type used for indices and size information.
Definition: taylorhoodbasis.hh:73
GridView gridView_
Definition: taylorhoodbasis.hh:277
PQ1PreBasis pq1PreBasis_
Definition: taylorhoodbasis.hh:279
TaylorHoodPreBasis(const GridView &gv)
Constructor for a given grid view object.
Definition: taylorhoodbasis.hh:96
Dune::ReservedVector< size_type, 2 > SizePrefix
Type used for prefixes handed to the size() method.
Definition: taylorhoodbasis.hh:85
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition: taylorhoodbasis.hh:116
PQ2PreBasis pq2PreBasis_
Definition: taylorhoodbasis.hh:280
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition: taylorhoodbasis.hh:208
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition: taylorhoodbasis.hh:110
size_type size() const
Same as size(prefix) with empty prefix.
Definition: taylorhoodbasis.hh:145
Impl::DefaultNodeIndexSet< TaylorHoodPreBasis > IndexSet
Type of created tree node index set.
Definition: taylorhoodbasis.hh:79
void initializeIndices()
Initialize the global indices.
Definition: taylorhoodbasis.hh:103
static const void multiIndexPushFront(MultiIndex &M, size_type M0)
Definition: taylorhoodbasis.hh:221
It indicesImp(const Node &node, It multiIndices) const
Definition: taylorhoodbasis.hh:231
IndexSet makeIndexSet() const
Create tree node index set.
Definition: taylorhoodbasis.hh:139
size_type dimension() const
Get the total dimension of the space spanned by this basis.
Definition: taylorhoodbasis.hh:202
Node makeNode() const
Create tree node.
Definition: taylorhoodbasis.hh:125