7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_NODES_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_NODES_HH
23#ifdef HAVE_DUNE_TYPETREE
37 struct BasisNodeSetupHelper
40 template<
class Node,
class size_type>
41 static void setSize(Node& node,
const size_type
size)
46 template<
class Node,
class size_type>
47 static void setOffset(Node& node,
const size_type offset)
49 node.setOffset(offset);
52 template<
class Node,
class size_type>
53 static void setTreeIndex(Node& node,
const size_type
index)
55 node.setTreeIndex(
index);
67 class ChildAccessMixIn
72 return static_cast<Impl&
>(*this);
75 const Impl& asImpl()
const
77 return static_cast<const Impl&
>(*this);
88 const auto&
child(II... ii)
const
89 requires (
sizeof...(II) != 1)
100 template<
class... II>
101 auto&
child(II... ii)
102 requires (
sizeof...(II) != 1)
112 template<
class... II>
123 template<
class... II>
137 friend struct Impl::BasisNodeSetupHelper;
230 static const bool isLeaf [[deprecated]] =
true;
231 static const bool isPower [[deprecated]] =
false;
233#ifdef HAVE_DUNE_TYPETREE
243 template<
typename Node,
typename Element>
249 void bind(
const Element& entity)
251 Node& self = *
static_cast<Node*
>(
this);
254 bindTree(self.child(i), entity, offset);
255 offset += self.child(i).size();
264 template<
typename T, std::
size_t n>
267 public Impl::ChildAccessMixIn<PowerBasisNode<T, n>>
278 template<
class Index>
279 requires (std::is_convertible_v<Index, std::size_t>)
282 return children_[i].value();
285 template<
class Index>
286 requires (std::is_convertible_v<Index, std::size_t>)
289 return children_[i].value();
298 static const bool isLeaf [[deprecated]] =
false;
299 static const bool isPower [[deprecated]] =
true;
301#ifdef HAVE_DUNE_TYPETREE
316 template<
class Index,
class TT>
319 children_[i].emplace(std::forward<TT>(t));
331 public Impl::ChildAccessMixIn<DynamicPowerBasisNode<T>>
339 return children_.
size();
342 template<
class Index>
343 requires (std::is_convertible_v<Index, std::size_t>)
346 return children_[i].value();
349 template<
class Index>
350 requires (std::is_convertible_v<Index, std::size_t>)
353 return children_[i].value();
362 static const bool isLeaf [[deprecated]] =
false;
363 static const bool isPower [[deprecated]] =
true;
365#ifdef HAVE_DUNE_TYPETREE
374 : children_(children)
382 template<
class Index,
class TT>
385 children_[i].
emplace(std::forward<TT>(t));
393 template<
typename... T>
395 public InnerBasisNodeMixin<CompositeBasisNode<T...>, typename TypeListEntry_t<0, TypeList<T...>>::Element>,
396 public Impl::ChildAccessMixIn<CompositeBasisNode<T...>>
407 template<std::
size_t i>
410 return children_[ii].value();
413 template<std::
size_t i>
416 return children_[ii].value();
425 static const bool isLeaf [[deprecated]] =
false;
426 static const bool isPower [[deprecated]] =
false;
428#ifdef HAVE_DUNE_TYPETREE
432 template<std::
size_t k>
434 static_assert((k < degree()),
"child index out of range");
449 children_(children...)
457 template<std::
size_t i,
class TT>
460 children_[ii].emplace(std::forward<TT>(t));
468 template<
typename Tree,
typename Entity>
471 Impl::BasisNodeSetupHelper::setOffset(tree, offset);
475 template<
typename Tree>
479 Impl::BasisNodeSetupHelper::setTreeIndex(node, treeIndexOffset);
void bindTree(Tree &tree, const Entity &entity, std::size_t offset=0)
Definition nodes.hh:469
void initializeTree(Tree &tree, std::size_t treeIndexOffset=0)
Definition nodes.hh:476
constexpr index_constant< 0 > _0
static constexpr IntegralRange< std::decay_t< T > > range(T &&from, U &&to) noexcept
constexpr void forEach(Range &&range, F &&f)
std::ptrdiff_t index() const
decltype(auto) child(Node &&node, TreePath< Indices... > treePath)
void forEachNode(Tree &&tree, PreNodeFunc &&preNodeFunc, LeafNodeFunc &&leafNodeFunc, PostNodeFunc &&postNodeFunc)
size_type treeIndex() const
Definition nodes.hh:180
size_type localIndex(size_type i) const
Definition nodes.hh:149
size_type offset() const
Definition nodes.hh:187
bool empty() const
Check if the node is empty.
Definition nodes.hh:175
size_type size() const
Obtain the number of basis function in the local node.
Definition nodes.hh:162
void setOffset(const size_type offset)
Definition nodes.hh:192
std::size_t size_type
Definition nodes.hh:141
BasisNodeMixin()
Definition nodes.hh:143
void setSize(const size_type size)
Definition nodes.hh:197
void setTreeIndex(size_type treeIndex)
Definition nodes.hh:202
static const bool isLeaf
Definition nodes.hh:230
static const bool isComposite
Definition nodes.hh:232
static const bool isPower
Definition nodes.hh:231
static constexpr auto degree()
Definition nodes.hh:223
void bind(const Element &entity)
Definition nodes.hh:249
T ChildType
Definition nodes.hh:296
auto & child(Index i)
Definition nodes.hh:287
static const bool isLeaf
Definition nodes.hh:298
const Element & element() const
Definition nodes.hh:311
typename T::Element Element
Definition nodes.hh:307
const auto & child(Index i) const
Definition nodes.hh:280
static constexpr auto degree()
Definition nodes.hh:273
static const bool isPower
Definition nodes.hh:299
static const bool isComposite
Definition nodes.hh:300
void setChild(Index i, TT &&t)
Definition nodes.hh:317
const Element & element() const
Definition nodes.hh:377
static const bool isLeaf
Definition nodes.hh:362
T ChildType
Definition nodes.hh:360
void setChild(Index i, TT &&t)
Definition nodes.hh:383
const auto & child(Index i) const
Definition nodes.hh:344
static const bool isPower
Definition nodes.hh:363
DynamicPowerBasisNode(std::size_t children)
Definition nodes.hh:373
auto & child(Index i)
Definition nodes.hh:351
static const bool isComposite
Definition nodes.hh:364
std::size_t degree() const
Definition nodes.hh:337
typename T::Element Element
Definition nodes.hh:371
CompositeBasisNode()=default
static constexpr auto degree()
Definition nodes.hh:402
typename std::tuple_element_t< 0, std::tuple< T... > >::Element Element
Definition nodes.hh:444
static const bool isLeaf
Definition nodes.hh:425
auto & child(Dune::index_constant< i > ii)
Definition nodes.hh:414
static const bool isPower
Definition nodes.hh:426
const Element & element() const
Definition nodes.hh:452
const auto & child(Dune::index_constant< i > ii) const
Definition nodes.hh:408
static const bool isComposite
Definition nodes.hh:427
void setChild(TT &&t, Dune::index_constant< i > ii={})
Definition nodes.hh:458
CompositeBasisNode(const T &... children)
Definition nodes.hh:448
Type type
Definition nodes.hh:439
typename std::tuple_element_t< k, std::tuple< T... > > Type
The type of the child.
Definition nodes.hh:437