Commit 7cf76948 authored by Steffen Müthing's avatar Steffen Müthing

Merge branch 'feature/freestanding-degree-and-tag-functions' into 'master'

Add freestanding degree and tag functions

This merge requests does two things:

* Freestanding meta functions for accessing the `NodeTag` and
  `ImplementationTag`, which are called just like the tag that they
  extract. Just replace `typename Node::NodeTag` with `NodeTag<Node>`.
  This gets rid of a `typename` and improves readability as well as
  extensibility. The merge requests also switches all internal uses of
  those tags to the new meta functions.

* More importantly, it gets rid of the horrible node member `CHILDREN`.
  This is actually a leftover from TypeTree's predecessor. The new
  canonical way of accessing the degree of a node is either:

  * If you have a node instance lying around and only need the run time
    information, you can simply write `TypeTree::degree(node)`. At the
    moment, the degree of all nodes is fixed at compile time, but this
    might change in the future.

  * If you need compile time information, you can use the new variable
    template `TypeTree::staticDegree<Node>`. This expression directly
    evaluates to the actual number. If you are instead interested in a
    type, you can use `TypeTree::StaticDegree<Node>` to obtain a
    `std::integral_constant<std::size_t,...>`.

  Internally, the default implementation forwards to a static member
  function `Node::degree()`, but this can be changed by overloading the
  dispatch mechanism on the node tag.

* All internal uses of `Node::CHILDREN` have been replaced by calls to
  the new (meta) function.

* `Node::CHILDREN` is **deprecated** and will be removed after the
  release of TypeTree 3.0.

See merge request !10
parents fb38adaf 5954630d
......@@ -5,6 +5,7 @@
#define DUNE_TYPETREE_ACCUMULATE_STATIC_HH
#include <dune/common/typetraits.hh>
#include <dune/typetree/nodeinterface.hh>
#include <dune/typetree/nodetags.hh>
#include <dune/typetree/treepath.hh>
......@@ -149,7 +150,7 @@ namespace Dune {
typedef typename Node::template Child<i>::Type child;
static const result_type child_result = accumulate_value<child,Functor,Reduction,ParentChildReduction,current_value,child_tree_path,typename child::NodeTag>::result;
static const result_type child_result = accumulate_value<child,Functor,Reduction,ParentChildReduction,current_value,child_tree_path,NodeTag<child>>::result;
static const result_type result = accumulate_over_children<Node,Functor,Reduction,ParentChildReduction,child_result,TreePath,i+1,n>::result;
......@@ -174,7 +175,7 @@ namespace Dune {
typedef typename Functor::result_type result_type;
static const result_type child_result = accumulate_over_children<Node,Functor,Reduction,ParentChildReduction,current_value,TreePath,0,Node::CHILDREN>::result;
static const result_type child_result = accumulate_over_children<Node,Functor,Reduction,ParentChildReduction,current_value,TreePath,0,staticDegree<Node>>::result;
static const result_type result =
accumulate_node_helper<Node,Functor,ParentChildReduction,child_result,TreePath,Functor::template doVisit<Node,TreePath>::value>::result;
......@@ -261,7 +262,7 @@ namespace Dune {
typedef typename Functor::result_type result_type;
//! The accumulated result of the computation.
static const result_type result = accumulate_value<Tree,Functor,Reduction,ParentChildReduction,startValue,TreePath<>,typename Tree::NodeTag>::result;
static const result_type result = accumulate_value<Tree,Functor,Reduction,ParentChildReduction,startValue,TreePath<>,NodeTag<Tree>>::result;
};
......@@ -379,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<
......@@ -415,7 +416,7 @@ namespace Dune {
current_type,
TreePath,
0,
Node::CHILDREN
staticDegree<Node>
>::type children_result_type;
typedef typename accumulate_type_node_helper<
......@@ -557,7 +558,7 @@ namespace Dune {
Policy,
typename Policy::start_type,
TreePath<>,
typename Tree::NodeTag
NodeTag<Tree>
>::type type;
};
......
......@@ -6,6 +6,7 @@
#include <dune/common/typetraits.hh>
#include <dune/typetree/nodeinterface.hh>
#include <dune/typetree/nodetags.hh>
#include <dune/typetree/treepath.hh>
#include <dune/typetree/visitor.hh>
......@@ -65,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>());
......@@ -98,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>());
}
......@@ -136,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());
......@@ -164,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);
}
......@@ -219,9 +220,9 @@ namespace Dune {
v.pre(std::forward<N>(n),tp);
typedef typename std::remove_reference<N>::type Node;
typedef typename std::remove_reference<V>::type Visitor;
apply_to_children<Visitor::treePathType,Node::CHILDREN>::apply(std::forward<N>(n),
std::forward<V>(v),
tp);
apply_to_children<Visitor::treePathType,staticDegree<Node>>::apply(std::forward<N>(n),
std::forward<V>(v),
tp);
v.post(std::forward<N>(n),tp);
}
......
......@@ -6,6 +6,7 @@
#include <dune/common/typetraits.hh>
#include <dune/typetree/nodeinterface.hh>
#include <dune/typetree/nodetags.hh>
#include <dune/typetree/treepath.hh>
#include <dune/typetree/visitor.hh>
......@@ -51,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),
......@@ -91,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),
......@@ -139,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),
......@@ -180,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),
......@@ -242,17 +243,15 @@ namespace Dune {
apply(N1&& n1, N2&& n2, V&& v, TreePath tp)
{
v.pre(std::forward<N1>(n1),std::forward<N2>(n2),tp.view());
typedef typename std::remove_reference<N1>::type Node1;
typedef typename std::remove_reference<N2>::type Node2;
// make sure both nodes have the same number of children - otherwise, it
// would be difficult to match the children to each other.
static_assert(Node1::CHILDREN == Node2::CHILDREN,
static_assert(staticDegree<N1> == staticDegree<N2>,
"non-leaf nodes with different numbers of children " \
"are not allowed during simultaneous grid traversal");
apply_to_children_pair<treePathType,Node1::CHILDREN>::apply(std::forward<N1>(n1),
std::forward<N2>(n2),
std::forward<V>(v),
tp);
apply_to_children_pair<treePathType,staticDegree<N1>>::apply(std::forward<N1>(n1),
std::forward<N2>(n2),
std::forward<V>(v),
tp);
v.post(std::forward<N1>(n1),std::forward<N2>(n2),tp.view());
}
......
......@@ -46,6 +46,11 @@ namespace Dune {
//! The number of children.
static const std::size_t CHILDREN = sizeof...(Children);
static constexpr std::size_t degree()
{
return sizeof...(Children);
}
//! Access to the type and storage type of the i-th child.
template<std::size_t k>
struct Child {
......
......@@ -7,6 +7,7 @@
#include <array>
#include <memory>
#include <dune/typetree/nodeinterface.hh>
#include <dune/typetree/nodetags.hh>
#include <dune/typetree/powercompositenodetransformationtemplates.hh>
#include <dune/common/exceptions.hh>
......@@ -61,19 +62,19 @@ namespace Dune {
};
template<typename TC>
static typename result<TC>::type transform(const SourceNode& s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::type::CHILDREN>& children)
static typename result<TC>::type transform(const SourceNode& s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<typename result<TC>::type>>& children)
{
return typename result<TC>::type(s,t,children);
}
template<typename TC>
static typename result<TC>::type transform(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::type::CHILDREN>& children)
static typename result<TC>::type transform(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<typename result<TC>::type>>& children)
{
return typename result<TC>::type(s,t,children);
}
template<typename TC>
static typename result<TC>::storage_type transform_storage(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::type::CHILDREN>& children)
static typename result<TC>::storage_type transform_storage(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<typename result<TC>::type>>& children)
{
return std::make_shared<typename result<TC>::type>(s,t,children);
}
......
......@@ -41,6 +41,11 @@ namespace Dune {
//! The type tag that describes a LeafNode.
typedef LeafNodeTag NodeTag;
static constexpr std::size_t degree()
{
return 0;
}
protected:
//! Default constructor.
......
......@@ -5,6 +5,7 @@
#define DUNE_TYPETREE_NODEINTERFACE_HH
#include <cstddef>
#include <type_traits>
#include <dune/common/documentation.hh>
......@@ -56,6 +57,58 @@ namespace Dune {
typedef ImplementationDefined NodeStorage;
};
//! Returns the node tag of the given Node.
template<typename Node>
using NodeTag = typename std::decay_t<Node>::NodeTag;
//! Returns the implementation tag of the given Node.
template<typename T>
using ImplementationTag = typename std::decay_t<T>::ImplementationTag;
//! Returns the degree of node as run time information.
template<typename Node>
std::size_t degree(const Node& node)
{
return degree(&node,NodeTag<Node>());
}
#ifndef DOXYGEN
//! Default implementation of degree dispatch function.
/**
* This dispatches using a pointer to the node instead of a reference,
* as we can easily create a constexpr pointer to the node, while a constexpr
* reference might not even be possible to manufacture (std::declval is not
* constexpr).
*/
template<typename Node, typename NodeTag>
constexpr std::size_t degree(const Node* node, NodeTag)
{
return Node::degree();
}
#endif DOXYGEN
//! Returns the statically known degree of the given Node type as a std::integral_constant.
/**
* \note If you are only interested in the numeric value, take a look at staticDegree<Node>
* instead.
*/
template<typename Node>
using StaticDegree = std::integral_constant<
std::size_t,
degree(
static_cast<std::decay_t<Node>*>(nullptr),
NodeTag<std::decay_t<Node>>()
)
>;
//! Returns the statically known degree of the given Node type as a constant value.
template<typename Node>
constexpr std::size_t staticDegree = StaticDegree<Node>::value;
//! \} group Nodes
} // namespace TypeTree
......
......@@ -4,6 +4,7 @@
#ifndef DUNE_TYPETREE_PAIRTRAVERSAL_HH
#define DUNE_TYPETREE_PAIRTRAVERSAL_HH
#include <dune/typetree/nodeinterface.hh>
#include <dune/typetree/nodetags.hh>
#include <dune/typetree/treepath.hh>
#include <dune/typetree/visitor.hh>
......@@ -27,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),
......@@ -120,25 +121,25 @@ namespace Dune {
typedef typename std::remove_reference<N2>::type Node2;
typedef typename Node1::template Child<0>::Type C1;
typedef typename Node2::template Child<0>::Type C2;
static_assert(Node1::CHILDREN == Node2::CHILDREN,
static_assert(staticDegree<Node1> == staticDegree<Node2>,
"non-leaf nodes with different numbers of children " \
"are not allowed during simultaneous grid traversal");
const bool visit = std::remove_reference<V>::type
::template VisitChild<Node1,C1,Node2,C2,typename TreePath::ViewType>::value;
for (std::size_t k = 0; k < Node1::CHILDREN; ++k)
for (std::size_t k = 0; k < degree(n1); ++k)
{
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),
tp);
tp.pop_back();
v.afterChild(std::forward<N1>(n1),n1.child(k),std::forward<N2>(n2),n2.child(k),tp.view(),k);
if (k < Node1::CHILDREN-1)
if (k < degree(n1) - 1)
v.in(std::forward<N1>(n1),std::forward<N2>(n2),tp.view());
}
v.post(std::forward<N1>(n1),std::forward<N2>(n2),tp.view());
......
......@@ -6,6 +6,8 @@
#include <cstddef>
#include <dune/typetree/nodeinterface.hh>
namespace Dune {
namespace TypeTree {
......@@ -20,7 +22,7 @@ namespace Dune {
template<typename TC>
struct result
{
typedef TransformedNode<SourceNode,TC,SourceNode::CHILDREN> type;
typedef TransformedNode<SourceNode,TC,staticDegree<SourceNode>> type;
};
};
......
......@@ -105,6 +105,11 @@ namespace Dune {
//! The number of children.
static const std::size_t CHILDREN = k;
static constexpr std::size_t degree()
{
return k;
}
//! The type tag that describes a PowerNode.
typedef PowerNodeTag NodeTag;
......
......@@ -5,6 +5,7 @@
#define DUNE_TYPETREE_PROXYNODE_HH
#include <type_traits>
#include <dune/typetree/nodeinterface.hh>
#include <dune/typetree/nodetags.hh>
#include <dune/common/shared_ptr.hh>
......@@ -252,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;
......@@ -265,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;
......@@ -277,7 +278,12 @@ namespace Dune {
static const bool isComposite = Node::isComposite;
//! The number of children.
static const std::size_t CHILDREN = Node::CHILDREN;
static const std::size_t CHILDREN = staticDegree<Node>;
static constexpr std::size_t degree()
{
return staticDegree<Node>;
}
protected:
......
......@@ -7,6 +7,7 @@
#include <array>
#include <memory>
#include <dune/typetree/nodeinterface.hh>
#include <dune/typetree/nodetags.hh>
#include <dune/common/exceptions.hh>
......@@ -50,18 +51,18 @@ namespace Dune {
template<typename TC>
struct result
{
typedef TransformedNode<TC, SourceNode::CHILDREN> type;
typedef TransformedNode<TC, staticDegree<SourceNode>> type;
typedef std::shared_ptr<type> storage_type;
};
template<typename TC>
static typename result<TC>::type transform(const SourceNode& s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::type::CHILDREN>& children)
static typename result<TC>::type transform(const SourceNode& s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<typename result<TC>::type>>& children)
{
return typename result<TC>::type(children);
}
template<typename TC>
static typename result<TC>::storage_type transform_storage(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::type::CHILDREN>& children)
static typename result<TC>::storage_type transform_storage(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<result<TC>::type>>& children)
{
return std::make_shared<typename result<TC>::type>(children);
}
......
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());
}
};
......@@ -118,7 +118,7 @@ namespace Dune {
const bool visit = Visitor::template VisitChild<Node,C,typename TreePath::ViewType>::value;
// iterate over children
for (std::size_t k = 0; k < Node::CHILDREN; ++k)
for (std::size_t k = 0; k < degree(n); ++k)
{
// always call beforeChild(), regardless of the value of visit
v.beforeChild(std::forward<N>(n),n.child(k),tp.view(),k);
......@@ -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();
......@@ -136,7 +136,7 @@ namespace Dune {
v.afterChild(std::forward<N>(n),n.child(k),tp.view(),k);
// if this is not the last child, call infix callback
if (k < Node::CHILDREN-1)
if (k < degree(n) - 1)
v.in(std::forward<N>(n),tp.view());
}
......
......@@ -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(...);
......
......@@ -11,6 +11,7 @@
#include <dune/common/shared_ptr.hh>
#include <dune/common/indices.hh>
#include <dune/typetree/nodeinterface.hh>
#include <dune/typetree/nodetags.hh>
namespace Dune {
......@@ -66,7 +67,7 @@ namespace Dune {
private:
// Start the tree traversal
typedef TreeInfo<Tree,typename Tree::NodeTag> NodeInfo;
typedef TreeInfo<Tree,NodeTag<Tree>> NodeInfo;
public:
......@@ -108,13 +109,13 @@ 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;
static const std::size_t nodeCount = 1 + Node::CHILDREN * ChildInfo::nodeCount;
static const std::size_t nodeCount = 1 + staticDegree<Node> * ChildInfo::nodeCount;
static const std::size_t leafCount = Node::CHILDREN * ChildInfo::leafCount;
static const std::size_t leafCount = staticDegree<Node> * ChildInfo::leafCount;
};
......@@ -131,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
......@@ -162,7 +163,7 @@ namespace Dune {
struct GenericCompositeNodeInfo
{
typedef generic_compositenode_children_info<Node,0,Node::CHILDREN> Children;
typedef generic_compositenode_children_info<Node,0,staticDegree<Node>> Children;
static const std::size_t depth = 1 + Children::maxDepth;
......
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