Commit 5954630d authored by Steffen Müthing's avatar Steffen Müthing

[Cleanup] Use freestanding metafunctions to access node tags

parent 96bb98d2
......@@ -380,7 +380,7 @@ namespace Dune {
typename Policy::reduction_strategy
>::type,
child_tree_path,
typename child::NodeTag
NodeTag<child>
>::type child_result_type;
typedef typename accumulate_type_over_children<
......@@ -558,7 +558,7 @@ namespace Dune {
Policy,
typename Policy::start_type,
TreePath<>,
typename Tree::NodeTag
NodeTag<Tree>
>::type type;
};
......
......@@ -66,9 +66,9 @@ namespace Dune {
v.beforeChild(std::forward<N>(n),n.template child<count-inverse_k>(),tp,std::integral_constant<std::size_t,count-inverse_k>());
// traverse to child
ApplyToTree<Visitor::treePathType,typename C::NodeTag,visit>::apply(n.template child<count-inverse_k>(),
std::forward<V>(v),
ChildTreePath());
ApplyToTree<Visitor::treePathType,NodeTag<C>,visit>::apply(n.template child<count-inverse_k>(),
std::forward<V>(v),
ChildTreePath());
// afterChild() gets called regardless of the value of visit
v.afterChild(std::forward<N>(n),n.template child<count-inverse_k>(),tp,std::integral_constant<std::size_t,count-inverse_k>());
......@@ -99,9 +99,9 @@ namespace Dune {
typedef typename TreePathPushBack<TreePath,count-1>::type ChildTreePath;
const bool visit = Visitor::template VisitChild<Node,C,ChildTreePath>::value;
v.beforeChild(std::forward<N>(n),n.template child<count-1>(),tp,std::integral_constant<std::size_t,count-1>());
ApplyToTree<Visitor::treePathType,typename C::NodeTag,visit>::apply(n.template child<count-1>(),
std::forward<V>(v),
ChildTreePath());
ApplyToTree<Visitor::treePathType,NodeTag<C>,visit>::apply(n.template child<count-1>(),
std::forward<V>(v),
ChildTreePath());
v.afterChild(std::forward<N>(n),n.template child<count-1>(),tp,std::integral_constant<std::size_t,count-1>());
}
......@@ -137,9 +137,9 @@ namespace Dune {
const bool visit = Visitor::template VisitChild<Node,C,typename TreePath::ViewType>::value;
v.beforeChild(std::forward<N>(n),n.template child<count-inverse_k>(),tp.view(),count-inverse_k);
tp.push_back(count-inverse_k);
ApplyToTree<Visitor::treePathType,typename C::NodeTag,visit>::apply(n.template child<count-inverse_k>(),
std::forward<V>(v),
tp);
ApplyToTree<Visitor::treePathType,NodeTag<C>,visit>::apply(n.template child<count-inverse_k>(),
std::forward<V>(v),
tp);
tp.pop_back();
v.afterChild(std::forward<N>(n),n.template child<count-inverse_k>(),tp.view(),count-inverse_k);
v.in(std::forward<N>(n),tp.view());
......@@ -165,9 +165,9 @@ namespace Dune {
const bool visit = Visitor::template VisitChild<Node,C,typename TreePath::ViewType>::value;
v.beforeChild(std::forward<N>(n),n.template child<count-1>(),tp.view(),count-1);
tp.push_back(count-1);
ApplyToTree<Visitor::treePathType,typename C::NodeTag,visit>::apply(n.template child<count-1>(),
std::forward<V>(v),
tp);
ApplyToTree<Visitor::treePathType,NodeTag<C>,visit>::apply(n.template child<count-1>(),
std::forward<V>(v),
tp);
tp.pop_back();
v.afterChild(std::forward<N>(n),n.template child<count-1>(),tp.view(),count-1);
}
......
......@@ -52,8 +52,8 @@ namespace Dune {
std::forward<N2>(n2),n2.template child<count-inverse_k>(),
tp,std::integral_constant<std::size_t,count-inverse_k>());
ApplyToTreePair<std::remove_reference<V>::type::treePathType,
typename C1::NodeTag,
typename C2::NodeTag,
NodeTag<C1>,
NodeTag<C2>,
visit>::apply(n1.template child<count-inverse_k>(),
n2.template child<count-inverse_k>(),
std::forward<V>(v),
......@@ -92,8 +92,8 @@ namespace Dune {
std::forward<N2>(n2),n2.template child<count-1>(),
tp,std::integral_constant<std::size_t,count-1>());
ApplyToTreePair<std::remove_reference<V>::type::treePathType,
typename C1::NodeTag,
typename C2::NodeTag,
NodeTag<C1>,
NodeTag<C2>,
visit>::apply(n1.template child<count-1>(),
n2.template child<count-1>(),
std::forward<V>(v),
......@@ -140,8 +140,8 @@ namespace Dune {
tp.view(),count-inverse_k);
tp.push_back(count-inverse_k);
ApplyToTreePair<std::remove_reference<V>::type::treePathType,
typename C1::NodeTag,
typename C2::NodeTag,
NodeTag<C1>,
NodeTag<C2>,
visit>::apply(n1.template child<count-inverse_k>(),
n2.template child<count-inverse_k>(),
std::forward<V>(v),
......@@ -181,8 +181,8 @@ namespace Dune {
tp.view(),count-1);
tp.push_back(count-1);
ApplyToTreePair<std::remove_reference<V>::type::treePathType,
typename C1::NodeTag,
typename C2::NodeTag,
NodeTag<C1>,
NodeTag<C2>,
visit>::apply(n1.template child<count-1>(),
n2.template child<count-1>(),
std::forward<V>(v),
......
......@@ -28,8 +28,8 @@ namespace Dune {
static void apply(Node1&& node1, Node2&& node2, Visitor&& visitor)
{
ApplyToTreePair<tpType,
typename std::remove_reference<Node1>::type::NodeTag,
typename std::remove_reference<Node2>::type::NodeTag
NodeTag<Node1>,
NodeTag<Node2>
>::apply(std::forward<Node1>(node1),
std::forward<Node2>(node2),
std::forward<Visitor>(visitor),
......@@ -131,8 +131,8 @@ namespace Dune {
v.beforeChild(std::forward<N1>(n1),n1.child(k),std::forward<N2>(n2),n2.child(k),tp.view(),k);
tp.push_back(k);
ApplyToTreePair<TreePathType::dynamic, // we know that due to the specialization
typename C1::NodeTag,
typename C2::NodeTag,
NodeTag<C1>,
NodeTag<C2>,
visit>::apply(n1.child(k),
n2.child(k),
std::forward<V>(v),
......
......@@ -253,7 +253,7 @@ namespace Dune {
*/
template<typename Node>
class ProxyNode
: public ProxyNodeBase<Node,typename Node::NodeTag>
: public ProxyNodeBase<Node,NodeTag<Node>>
{
static const bool proxiedNodeIsConst = std::is_const<typename std::remove_reference<Node>::type>::value;
......@@ -266,7 +266,7 @@ namespace Dune {
typedef Node ProxiedNode;
typedef typename Node::NodeTag NodeTag;
typedef Dune::TypeTree::NodeTag<Node> NodeTag;
//! Mark this class as non leaf in the \ref TypeTree.
static const bool isLeaf = Node::isLeaf;
......
This diff is collapsed.
......@@ -38,9 +38,9 @@ namespace Dune {
template<typename Node, typename Visitor>
static void apply(Node&& node, Visitor&& visitor)
{
ApplyToTree<tpType,typename std::remove_reference<Node>::type::NodeTag>::apply(std::forward<Node>(node),
std::forward<Visitor>(visitor),
TreePathFactory<tpType>::create(node).mutablePath());
ApplyToTree<tpType,NodeTag<Node>>::apply(std::forward<Node>(node),
std::forward<Visitor>(visitor),
TreePathFactory<tpType>::create(node).mutablePath());
}
};
......@@ -127,7 +127,7 @@ namespace Dune {
tp.push_back(k);
// descend to child
ApplyToTree<Visitor::treePathType,typename C::NodeTag,visit>::apply(n.child(k),std::forward<V>(v),tp);
ApplyToTree<Visitor::treePathType,NodeTag<C>,visit>::apply(n.child(k),std::forward<V>(v),tp);
// restore TreePath
tp.pop_back();
......
......@@ -8,6 +8,7 @@
#include <dune/common/typetraits.hh>
#include <dune/typetree/treepath.hh>
#include <dune/typetree/nodeinterface.hh>
namespace Dune {
......@@ -32,7 +33,7 @@ namespace Dune {
struct no { char dummy[2]; };
template<typename X>
static yes test(typename X::NodeTag *);
static yes test(NodeTag<X> *);
template<typename X>
static no test(...);
......@@ -51,8 +52,8 @@ namespace Dune {
struct no { char dummy[1]; };
template<typename X>
static maybe<std::is_base_of<V, typename X::NodeTag>::value>
test(typename X::NodeTag * a);
static maybe<std::is_base_of<V, NodeTag<X>>::value>
test(NodeTag<X> * a);
template<typename X>
static no test(...);
......@@ -69,7 +70,7 @@ namespace Dune {
struct no { char dummy[2]; };
template<typename X>
static yes test(typename X::ImplementationTag *);
static yes test(ImplementationTag<X> *);
template<typename X>
static no test(...);
......@@ -88,8 +89,8 @@ namespace Dune {
struct no { char dummy[1]; };
template<typename X>
static maybe<std::is_base_of<V, typename X::ImplementationTag>::value>
test(typename X::ImplementationTag * a);
static maybe<std::is_base_of<V, ImplementationTag<X>>::value>
test(ImplementationTag<X> * a);
template<typename X>
static no test(...);
......
......@@ -67,7 +67,7 @@ namespace Dune {
private:
// Start the tree traversal
typedef TreeInfo<Tree,typename Tree::NodeTag> NodeInfo;
typedef TreeInfo<Tree,NodeTag<Tree>> NodeInfo;
public:
......@@ -109,7 +109,7 @@ namespace Dune {
struct TreeInfo<Node,PowerNodeTag>
{
typedef TreeInfo<typename Node::ChildType,typename Node::ChildType::NodeTag> ChildInfo;
typedef TreeInfo<typename Node::ChildType,NodeTag<typename Node::ChildType>> ChildInfo;
static const std::size_t depth = 1 + ChildInfo::depth;
......@@ -132,7 +132,7 @@ namespace Dune {
// extract child info
typedef typename Node::template Child<k>::Type Child;
typedef typename Child::NodeTag ChildTag;
typedef NodeTag<Child> ChildTag;
typedef TreeInfo<Child,ChildTag> ChildInfo;
// combine information of current child with info about following children
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment