Commit d196c372 authored by Carsten Gräser's avatar Carsten Gräser

Avoid using variable template

Use StaticDegree<N>::value instead of staticDegree<N>.
parent 6d5f7866
......@@ -175,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,staticDegree<Node>>::result;
static const result_type child_result = accumulate_over_children<Node,Functor,Reduction,ParentChildReduction,current_value,TreePath,0,StaticDegree<Node>::value>::result;
static const result_type result =
accumulate_node_helper<Node,Functor,ParentChildReduction,child_result,TreePath,Functor::template doVisit<Node,TreePath>::value>::result;
......@@ -416,7 +416,7 @@ namespace Dune {
current_type,
TreePath,
0,
staticDegree<Node>
StaticDegree<Node>::value
>::type children_result_type;
typedef typename accumulate_type_node_helper<
......
......@@ -220,7 +220,7 @@ 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,staticDegree<Node>>::apply(std::forward<N>(n),
apply_to_children<Visitor::treePathType,StaticDegree<Node>::value>::apply(std::forward<N>(n),
std::forward<V>(v),
tp);
v.post(std::forward<N>(n),tp);
......
......@@ -245,10 +245,10 @@ namespace Dune {
v.pre(std::forward<N1>(n1),std::forward<N2>(n2),tp.view());
// make sure both nodes have the same number of children - otherwise, it
// would be difficult to match the children to each other.
static_assert(staticDegree<N1> == staticDegree<N2>,
static_assert(StaticDegree<N1>::value == StaticDegree<N2>::value,
"non-leaf nodes with different numbers of children " \
"are not allowed during simultaneous grid traversal");
apply_to_children_pair<treePathType,staticDegree<N1>>::apply(std::forward<N1>(n1),
apply_to_children_pair<treePathType,StaticDegree<N1>::value>::apply(std::forward<N1>(n1),
std::forward<N2>(n2),
std::forward<V>(v),
tp);
......
......@@ -68,7 +68,7 @@ namespace Dune {
template<typename Node, std::size_t i, typename... J,
typename std::enable_if<
Dune::models<HasTemplateChildMethod, Node>() &&
(i < staticDegree<Node>), int>::type = 0>
(i < StaticDegree<Node>::value), int>::type = 0>
decltype(auto) child(Node&& node, index_constant<i>, J... j)
{
return child(std::forward<Node>(node).template child<i>(),j...);
......@@ -77,7 +77,7 @@ namespace Dune {
template<typename Node, std::size_t i, typename... J,
typename std::enable_if<
Dune::models<HasTemplateChildMethod, decltype(*std::declval<std::decay_t<Node>>())>() &&
(i < staticDegree<decltype(*std::declval<Node>())>), int>::type = 0>
(i < StaticDegree<decltype(*std::declval<Node>())>::value), int>::type = 0>
decltype(auto) childStorage(Node&& node, index_constant<i>, J... j)
{
return childStorage(std::forward<Node>(node)->template childStorage<i>(),j...);
......@@ -89,11 +89,11 @@ namespace Dune {
template<typename Node, std::size_t i, typename... J,
typename std::enable_if<
(!Dune::models<HasTemplateChildMethod, Node>()) ||
(i >= staticDegree<Node>), int>::type = 0>
(i >= StaticDegree<Node>::value), int>::type = 0>
void child(Node&& node, index_constant<i>, J... j)
{
static_assert(Dune::models<HasTemplateChildMethod, Node>(), "Node does not have a template method child()");
static_assert(i < staticDegree<Node>, "Child index out of range");
static_assert(i < StaticDegree<Node>::value, "Child index out of range");
}
// ********************************************************************************
......
......@@ -59,7 +59,7 @@ namespace Dune {
{
typedef typename TransformedNodeTemplate<TC>::type type;
typedef std::shared_ptr<type> storage_type;
static const std::size_t degree = staticDegree<type>;
static const std::size_t degree = StaticDegree<type>::value;
};
template<typename TC>
......
......@@ -121,7 +121,7 @@ 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(staticDegree<Node1> == staticDegree<Node2>,
static_assert(StaticDegree<Node1>::value == StaticDegree<Node2>::value,
"non-leaf nodes with different numbers of children " \
"are not allowed during simultaneous grid traversal");
const bool visit = std::remove_reference<V>::type
......
......@@ -22,7 +22,7 @@ namespace Dune {
template<typename TC>
struct result
{
typedef TransformedNode<SourceNode,TC,staticDegree<SourceNode>> type;
typedef TransformedNode<SourceNode,TC,StaticDegree<SourceNode>::value> type;
};
};
......
......@@ -278,11 +278,11 @@ namespace Dune {
static const bool isComposite = Node::isComposite;
//! The number of children.
static const std::size_t CHILDREN = staticDegree<Node>;
static const std::size_t CHILDREN = StaticDegree<Node>::value;
static constexpr std::size_t degree()
{
return staticDegree<Node>;
return StaticDegree<Node>::value;
}
......
......@@ -51,9 +51,9 @@ namespace Dune {
template<typename TC>
struct result
{
typedef TransformedNode<TC, staticDegree<SourceNode>> type;
typedef TransformedNode<TC, StaticDegree<SourceNode>::value> type;
typedef std::shared_ptr<type> storage_type;
static const std::size_t degree = staticDegree<type>;
static const std::size_t degree = StaticDegree<type>::value;
};
template<typename TC>
......
......@@ -277,7 +277,7 @@ namespace Dune {
// transform children
typedef TransformTree<typename S::ChildType,T,NodeTag<typename S::ChildType>,ChildNodeTransformation::recursive> ChildTreeTransformation;
typedef typename ChildTreeTransformation::transformed_type transformed_child;
const std::size_t child_count = staticDegree<S>;
const std::size_t child_count = StaticDegree<S>::value;
std::array<std::shared_ptr<transformed_child>,child_count> children;
for (std::size_t k = 0; k < child_count; ++k) {
children[k] = ChildTreeTransformation::transform_storage(s.childStorage(k),t);
......@@ -291,7 +291,7 @@ namespace Dune {
// transform children
typedef TransformTree<typename S::ChildType,T,NodeTag<typename S::ChildType>,ChildNodeTransformation::recursive> ChildTreeTransformation;
typedef typename ChildTreeTransformation::transformed_type transformed_child;
const std::size_t child_count = staticDegree<S>;
const std::size_t child_count = StaticDegree<S>::value;
std::array<std::shared_ptr<transformed_child>,child_count> children;
for (std::size_t k = 0; k < child_count; ++k) {
children[k] = ChildTreeTransformation::transform_storage(s.childStorage(k),t);
......@@ -306,7 +306,7 @@ namespace Dune {
// transform children
typedef TransformTree<typename S::ChildType,T,NodeTag<typename S::ChildType>,ChildNodeTransformation::recursive> ChildTreeTransformation;
typedef typename ChildTreeTransformation::transformed_type transformed_child;
const std::size_t child_count = staticDegree<S>;
const std::size_t child_count = StaticDegree<S>::value;
std::array<std::shared_ptr<transformed_child>,child_count> children;
for (std::size_t k = 0; k < child_count; ++k) {
children[k] = ChildTreeTransformation::transform_storage(sp->childStorage(k),t);
......@@ -320,7 +320,7 @@ namespace Dune {
// transform children
typedef TransformTree<typename S::ChildType,T,NodeTag<typename S::ChildType>,ChildNodeTransformation::recursive> ChildTreeTransformation;
typedef typename ChildTreeTransformation::transformed_type transformed_child;
const std::size_t child_count = staticDegree<S>;
const std::size_t child_count = StaticDegree<S>::value;
std::array<std::shared_ptr<transformed_child>,child_count> children;
for (std::size_t k = 0; k < child_count; ++k) {
children[k] = ChildTreeTransformation::transform_storage(sp->childStorage(k),t);
......@@ -334,7 +334,7 @@ namespace Dune {
// transform children
typedef TransformTree<typename S::ChildType,T,NodeTag<typename S::ChildType>,ChildNodeTransformation::recursive> ChildTreeTransformation;
typedef typename ChildTreeTransformation::transformed_storage_type transformed_child_storage;
const std::size_t child_count = staticDegree<S>;
const std::size_t child_count = StaticDegree<S>::value;
std::array<transformed_child_storage,child_count> children;
for (std::size_t k = 0; k < child_count; ++k) {
children[k] = ChildTreeTransformation::transform_storage(sp->childStorage(k),t);
......@@ -347,7 +347,7 @@ namespace Dune {
// transform children
typedef TransformTree<typename S::ChildType,T,NodeTag<typename S::ChildType>,ChildNodeTransformation::recursive> ChildTreeTransformation;
typedef typename ChildTreeTransformation::transformed_storage_type transformed_child_storage;
const std::size_t child_count = staticDegree<S>;
const std::size_t child_count = StaticDegree<S>::value;
std::array<transformed_child_storage,child_count> children;
for (std::size_t k = 0; k < child_count; ++k) {
children[k] = ChildTreeTransformation::transform_storage(sp->childStorage(k),t);
......
......@@ -113,9 +113,9 @@ namespace Dune {
static const std::size_t depth = 1 + ChildInfo::depth;
static const std::size_t nodeCount = 1 + staticDegree<Node> * ChildInfo::nodeCount;
static const std::size_t nodeCount = 1 + StaticDegree<Node>::value * ChildInfo::nodeCount;
static const std::size_t leafCount = staticDegree<Node> * ChildInfo::leafCount;
static const std::size_t leafCount = StaticDegree<Node>::value * ChildInfo::leafCount;
};
......@@ -163,7 +163,7 @@ namespace Dune {
struct GenericCompositeNodeInfo
{
typedef generic_compositenode_children_info<Node,0,staticDegree<Node>> Children;
typedef generic_compositenode_children_info<Node,0,StaticDegree<Node>::value> 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