4#ifndef DUNE_TYPETREE_DYNAMICPOWERNODE_HH
5#define DUNE_TYPETREE_DYNAMICPOWERNODE_HH
12#include <dune/common/typetraits.hh>
13#include <dune/common/std/type_traits.hh>
49 return _children.size();
77 assert(i <
degree() &&
"child index out of range");
87 assert(i <
degree() &&
"child index out of range");
97 assert(i <
degree() &&
"child index out of range");
110 assert(i <
degree() &&
"child index out of range");
117 assert(i <
degree() &&
"child index out of range");
118 _children[i] = stackobject_to_shared_ptr(t);
124 assert(i <
degree() &&
"child index out of range");
125 _children[i] = convert_arg(std::move(t));
131 assert(i <
degree() &&
"child index out of range");
132 _children[i] = std::move(st);
166 : _children(std::move(children))
177 template<
typename... Children,
178 std::enable_if_t<(std::is_same_v<ChildType, std::decay_t<Children>> &&...),
bool> =
true>
181 _children =
NodeStorage{convert_arg(std::forward<Children>(children))...};
184 template<
typename... Children,
185 std::enable_if_t<(std::is_same_v<ChildType, std::decay_t<Children>> &&...),
bool> =
true>
Definition: accumulate_static.hh:13
Collect multiple instances of type T within a dune-typetree.
Definition: dynamicpowernode.hh:33
static const bool isPower
Mark this class as a power in the dune-typetree.
Definition: dynamicpowernode.hh:41
std::vector< ChildStorageType > NodeStorage
The type used for storing the children.
Definition: dynamicpowernode.hh:65
const NodeStorage & nodeStorage() const
Definition: dynamicpowernode.hh:135
ChildConstStorageType childStorage(std::size_t i) const
Returns the storage of the i-th child (const version).
Definition: dynamicpowernode.hh:108
const ChildType & child(std::size_t i) const
Returns the i-th child (const version).
Definition: dynamicpowernode.hh:85
std::shared_ptr< T > ChildStorageType
The storage type of each child.
Definition: dynamicpowernode.hh:59
DynamicPowerNode(T &t1, T &t2,...)
Initialize all children with the passed-in objects.
Definition: dynamicpowernode.hh:172
std::shared_ptr< const T > ChildConstStorageType
The const version of the storage type of each child.
Definition: dynamicpowernode.hh:62
DynamicPowerNode(NodeStorage children)
Initialize the DynamicPowerNode with a copy of the passed-in storage type.
Definition: dynamicpowernode.hh:165
DynamicPowerNodeTag NodeTag
The type tag that describes the node.
Definition: dynamicpowernode.hh:53
T ChildType
The type of each child.
Definition: dynamicpowernode.hh:56
void setChild(std::size_t i, ChildType &t)
Sets the i-th child to the passed-in value.
Definition: dynamicpowernode.hh:115
void setChild(std::size_t i, ChildStorageType st)
Sets the stored value representing the i-th child to the passed-in value.
Definition: dynamicpowernode.hh:129
DynamicPowerNode(std::size_t size)
Construct a node with the given number of children.
Definition: dynamicpowernode.hh:160
static const bool isComposite
Mark this class as a non composite in the dune-typetree.
Definition: dynamicpowernode.hh:44
void setChild(std::size_t i, ChildType &&t)
Store the passed value in i-th child.
Definition: dynamicpowernode.hh:122
ChildType & child(std::size_t i)
Returns the i-th child.
Definition: dynamicpowernode.hh:75
std::size_t degree() const
The number of children.
Definition: dynamicpowernode.hh:47
ChildStorageType childStorage(std::size_t i)
Returns the storage of the i-th child.
Definition: dynamicpowernode.hh:95
static const bool isLeaf
Mark this class as non leaf in the dune-typetree.
Definition: dynamicpowernode.hh:38
DynamicPowerNode()=delete
Tag designating a power node with runtime degree.
Definition: nodetags.hh:22