3#ifndef DUNE_FUNCTIONS_COMMON_TREEDATA_HH
4#define DUNE_FUNCTIONS_COMMON_TREEDATA_HH
7#warning This file is deprecated. Please use TreeContainer from dune-typetree instead.
11#include <dune/common/shared_ptr.hh>
13#include <dune/typetree/pairtraversal.hh>
34template<
class SimpleNodeVisitorImp,
bool leafOnly>
36[[deprecated(
"This is an implementation detail of the deprecated class TreeDate and thus deprecated itself.")]]
38 public TypeTree::TreeVisitor,
39 public TypeTree::DynamicTraversal
44 template<
typename Node,
typename TreePath,
45 typename std::enable_if<(not leafOnly) and (not Node::isLeaf),
int>::type = 0>
46 void pre(Node& node, TreePath treePath)
48 static_cast<SimpleNodeVisitorImp*
>(
this)->apply(node, treePath);
51 template<
typename Node,
typename TreePath,
52 typename std::enable_if<(leafOnly) and (not Node::isLeaf),
int>::type = 0>
53 void pre(Node& node, TreePath treePath)
56 template<
typename Node,
typename TreePath>
57 void leaf(Node& node, TreePath treePath)
59 static_cast<SimpleNodeVisitorImp*
>(
this)->apply(node, treePath);
91template<
class T,
template<
class>
class ND,
bool LO>
93[[deprecated(
"This class is deprecated. Please use TreeContainer from dune-typetree instead.")]]
106 static const bool leafOnly = LO;
132 template<
typename Node,
typename TreePath>
133 void apply(Node& node, TreePath treePath)
135 auto&& index = node.treeIndex();
136 if (data_.size() < index+1)
137 data_.resize(index+1,
nullptr);
152 template<
typename Node,
typename TreePath>
153 void apply(Node& node, TreePath treePath)
155 auto&& index = node.treeIndex();
158 data_[index] =
nullptr;
172 template<
typename Node,
typename TreePath>
173 void apply(Node& node, TreePath treePath)
175 thisTD_[node] = otherTD_[node];
209 TypeTree::applyToTree(*tree_,
CopyVisitor(*
this, other));
218 TypeTree::applyToTree(*tree_,
CopyVisitor(*
this, other));
Definition: polynomial.hh:10
Mixin for visitors that should apply the same action on all nodes.
Definition: treedata.hh:40
void pre(Node &node, TreePath treePath)
Definition: treedata.hh:46
void leaf(Node &node, TreePath treePath)
Definition: treedata.hh:57
Container allowing to attach data to each node of a tree.
Definition: treedata.hh:95
TreeData(const TreeData &other)
Copy constructor.
Definition: treedata.hh:205
void init(const Tree &tree)
Initialize from tree.
Definition: treedata.hh:196
T Tree
Type of tree the data is associated with.
Definition: treedata.hh:100
const Tree * tree_
Definition: treedata.hh:253
void destroy()
Destroy data.
Definition: treedata.hh:223
const NodeData< Node > & operator[](const Node &node) const
Get reference to data associated to given node.
Definition: treedata.hh:246
TreeData & operator=(const TreeData &other)
Copy assignment.
Definition: treedata.hh:213
~TreeData()
Destructor.
Definition: treedata.hh:231
ND< Node > NodeData
Template to determine the data type for given node type.
Definition: treedata.hh:110
TreeData()
Default constructor.
Definition: treedata.hh:185
std::vector< void * > RawContainer
Definition: treedata.hh:113
NodeData< Node > & operator[](const Node &node)
Get mutable reference to data associated to given node.
Definition: treedata.hh:239
typename Tree::size_type size_type
Type used for indices and size information.
Definition: treedata.hh:103
RawContainer data_
Definition: treedata.hh:254
Definition: treedata.hh:127
InitVisitor(RawContainer &data)
Definition: treedata.hh:128
void apply(Node &node, TreePath treePath)
Definition: treedata.hh:133
RawContainer & data_
Definition: treedata.hh:142
Definition: treedata.hh:147
RawContainer & data_
Definition: treedata.hh:161
DestroyVisitor(RawContainer &data)
Definition: treedata.hh:148
void apply(Node &node, TreePath treePath)
Definition: treedata.hh:153
Definition: treedata.hh:166
CopyVisitor(TreeData &thisTD, const TreeData &otherTD)
Definition: treedata.hh:167
void apply(Node &node, TreePath treePath)
Definition: treedata.hh:173
TreeData & thisTD_
Definition: treedata.hh:178
const TreeData & otherTD_
Definition: treedata.hh:179