4 #ifndef DUNE_TYPETREE_VISITOR_HH
5 #define DUNE_TYPETREE_VISITOR_HH
57 template<
typename T,
typename TreePath>
69 template<
typename T,
typename TreePath>
80 template<
typename T,
typename TreePath>
90 template<
typename T,
typename TreePath>
104 template<
typename T,
typename Child,
typename TreePath,
typename ChildIndex>
119 template<
typename T,
typename Child,
typename TreePath,
typename ChildIndex>
173 template<
typename T1,
typename T2,
typename TreePath>
186 template<
typename T1,
typename T2,
typename TreePath>
198 template<
typename T1,
typename T2,
typename TreePath>
213 template<
typename T1,
typename T2,
typename TreePath>
229 template<
typename T1,
typename Child1,
typename T2,
typename Child2,
typename TreePath,
typename ChildIndex>
245 template<
typename T1,
typename Child1,
typename T2,
typename Child2,
typename TreePath,
typename ChildIndex>
251 namespace Experimental {
293 template<
typename T,
typename TreePath,
typename U>
303 template<
typename T,
typename TreePath,
typename U>
313 template<
typename T,
typename TreePath,
typename U>
323 template<
typename T,
typename TreePath,
typename U>
333 template<
typename T,
typename Child,
typename TreePath,
typename ChildIndex,
typename U>
343 template<
typename T,
typename Child,
typename TreePath,
typename ChildIndex,
typename U>
362 template<
typename Node1,
365 typename Child2 = void,
388 template<
typename Node1,
391 typename Child2 = void,
453 namespace Experimental::Info {
460 template<
class Tree,
class Child,
class TreePath,
class ChildIndex,
class U>
466 template<
class Tree,
class Child,
class TreePath,
class U>
469 return std::size_t{u};
472 template<
class Tree,
class TreePath,
class U>
475 return Hybrid::plus(u,Dune::Indices::_1);
483 template<
typename Tree,
typename TreePath,
typename U>
485 return Hybrid::plus(u,Indices::_1);
494 template<
class Tree,
class TreePath,
class U>
498 auto depth = Hybrid::plus(path_size,Indices::_1);
499 return Hybrid::max(
depth,u);
505 template<
typename Tree>
513 template<
typename Tree>
521 template<
typename Tree>
529 template<
typename Tree>
536 template<
typename Tree>
537 constexpr
bool isDynamic = std::is_same<std::size_t, decltype(leafCount(std::declval<Tree>()))>{};
typename impl::_Child< Node, indices... >::type Child
Template alias for the type of a child node given by a list of child indices.
Definition: childextraction.hh:223
constexpr std::size_t treePathSize(const HybridTreePath< T... > &)
Returns the size (number of components) of the given HybridTreePath.
Definition: treepath.hh:199
Definition: accumulate_static.hh:13
auto hybridApplyToTree(Tree &&tree, Visitor &&visitor, Init &&init)
Apply hybrid visitor to TypeTree.
Definition: accumulate_static.hh:698
Type
Definition: treepath.hh:30
@ fullyStatic
Definition: treepath.hh:30
@ dynamic
Definition: treepath.hh:30
constexpr bool isDynamic
true if any of the nodes in the tree only has dynamic degree.
Definition: visitor.hh:537
auto leafCount(const Tree &tree)
The number of leaf nodes in the Tree.
Definition: visitor.hh:530
auto nodeCount(const Tree &tree)
The total number of nodes in the Tree.
Definition: visitor.hh:522
auto depth(const Tree &tree)
The depth of the TypeTree.
Definition: visitor.hh:506
A hybrid version of TreePath that supports both compile time and run time indices.
Definition: treepath.hh:79
Visitor interface and base class for TypeTree visitors.
Definition: visitor.hh:47
void in(T &&, TreePath) const
Method for infix tree traversal.
Definition: visitor.hh:70
void afterChild(T &&, Child &&, TreePath, ChildIndex) const
Method for child-parent traversal.
Definition: visitor.hh:120
void beforeChild(T &&, Child &&, TreePath, ChildIndex) const
Method for parent-child traversal.
Definition: visitor.hh:105
void post(T &&, TreePath) const
Method for postfix tree traversal.
Definition: visitor.hh:81
void leaf(T &&, TreePath) const
Method for leaf traversal.
Definition: visitor.hh:91
void pre(T &&, TreePath) const
Method for prefix tree traversal.
Definition: visitor.hh:58
Visitor interface and base class for visitors of pairs of TypeTrees.
Definition: visitor.hh:162
void leaf(T1 &&, T2 &&, TreePath) const
Method for leaf traversal.
Definition: visitor.hh:214
void beforeChild(T1 &&, Child1 &&, T2 &&, Child2 &&, TreePath, ChildIndex) const
Method for parent-child traversal.
Definition: visitor.hh:230
void pre(T1 &&, T2 &&, TreePath) const
Method for prefix tree traversal.
Definition: visitor.hh:174
void post(T1 &&, T2 &&, TreePath) const
Method for postfix traversal.
Definition: visitor.hh:199
void in(T1 &&, T2 &&, TreePath) const
Method for infix tree traversal.
Definition: visitor.hh:187
void afterChild(T1 &&, Child1 &&, T2 &&, Child2 &&, TreePath, ChildIndex) const
Method for child-parent traversal.
Definition: visitor.hh:246
Hybrid visitor interface and base class for TypeTree hybrid visitors.
Definition: visitor.hh:284
auto post(T &&, TreePath, const U &u) const
Method for postfix tree traversal.
Definition: visitor.hh:314
auto pre(T &&, TreePath, const U &u) const
Method for prefix tree traversal.
Definition: visitor.hh:294
auto leaf(T &&, TreePath, const U &u) const
Method for leaf traversal.
Definition: visitor.hh:324
auto afterChild(T &&, Child &&, TreePath, ChildIndex, const U &u) const
Method for child-parent traversal.
Definition: visitor.hh:344
auto in(T &&, TreePath, const U &u) const
Method for infix tree traversal.
Definition: visitor.hh:304
auto beforeChild(T &&, Child &&, TreePath, ChildIndex, const U &u) const
Method for parent-child traversal.
Definition: visitor.hh:334
Mixin base class for visitors that only want to visit the direct children of a node.
Definition: visitor.hh:356
Template struct for determining whether or not to visit a given child.
Definition: visitor.hh:368
static const bool value
Do not visit any child.
Definition: visitor.hh:370
Mixin base class for visitors that want to visit the complete tree.
Definition: visitor.hh:382
Template struct for determining whether or not to visit a given child.
Definition: visitor.hh:394
static const bool value
Visit any child.
Definition: visitor.hh:396
Mixin base class for visitors that require a static TreePath during traversal.
Definition: visitor.hh:410
static const TreePathType::Type treePathType
Use the static tree traversal algorithm.
Definition: visitor.hh:412
Mixin base class for visitors that only need a dynamic TreePath during traversal.
Definition: visitor.hh:424
static const TreePathType::Type treePathType
Use the dynamic tree traversal algorithm.
Definition: visitor.hh:426
Convenience base class for visiting the entire tree.
Definition: visitor.hh:433
Convenience base class for visiting the direct children of a node.
Definition: visitor.hh:439
Convenience base class for visiting an entire tree pair.
Definition: visitor.hh:445
Convenience base class for visiting the direct children of a node pair.
Definition: visitor.hh:451
Definition: visitor.hh:459
auto leaf(Tree &&, TreePath, U u) const
Definition: visitor.hh:473
auto beforeChild(Tree &&, Child &&, TreePath, ChildIndex, U u) const
Definition: visitor.hh:461
std::size_t beforeChild(Tree &&, Child &&, TreePath, std::size_t, U u) const
Definition: visitor.hh:467
Definition: visitor.hh:482
auto pre(Tree &&, TreePath, U u) const
Definition: visitor.hh:484
Definition: visitor.hh:493
auto leaf(Tree &&, TreePath, U u) const
Definition: visitor.hh:495