Commit 76b9c870 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Prepare for typetree update

parent 68c8f240
...@@ -216,7 +216,7 @@ namespace AMDiS ...@@ -216,7 +216,7 @@ namespace AMDiS
static auto create (Node const& basisNode) static auto create (Node const& basisNode)
{ {
Self cache{basisNode}; Self cache{basisNode};
for (std::size_t i = 0; i < Super::degree(); ++i) for (std::size_t i = 0; i < std::size_t(basisNode.degree()); ++i)
cache.setChild(i, Super::ChildType::create(basisNode.child(i))); cache.setChild(i, Super::ChildType::create(basisNode.child(i)));
return cache; return cache;
} }
...@@ -242,7 +242,7 @@ namespace AMDiS ...@@ -242,7 +242,7 @@ namespace AMDiS
{ {
using TT = typename Super::ChildTypes; using TT = typename Super::ChildTypes;
Self cache{basisNode}; Self cache{basisNode};
Dune::Hybrid::forEach(std::make_index_sequence<Super::degree()>{}, [&](auto ii) { Dune::Hybrid::forEach(std::make_index_sequence<std::size_t(Node::degree())>{}, [&](auto ii) {
cache.setChild(std::tuple_element_t<ii,TT>::create(basisNode.child(ii)), ii); cache.setChild(std::tuple_element_t<ii,TT>::create(basisNode.child(ii)), ii);
}); });
return cache; return cache;
...@@ -262,7 +262,7 @@ namespace AMDiS ...@@ -262,7 +262,7 @@ namespace AMDiS
struct NodeCacheFactory<Node, Dune::TypeTree::PowerNodeTag> struct NodeCacheFactory<Node, Dune::TypeTree::PowerNodeTag>
{ {
using Child = typename NodeCacheFactory<typename Node::ChildType>::type; using Child = typename NodeCacheFactory<typename Node::ChildType>::type;
using Base = Dune::TypeTree::PowerNode<Child, Node::degree()>; using Base = Dune::TypeTree::PowerNode<Child, std::size_t(Node::degree())>;
using type = PowerNodeCache<Node>; using type = PowerNodeCache<Node>;
}; };
...@@ -277,7 +277,7 @@ namespace AMDiS ...@@ -277,7 +277,7 @@ namespace AMDiS
>; >;
}; };
using Base = typename Childs<std::make_index_sequence<Node::degree()>>::type; using Base = typename Childs<std::make_index_sequence<std::size_t(Node::degree())>>::type;
using type = CompositeNodeCache<Node>; using type = CompositeNodeCache<Node>;
}; };
......
...@@ -16,7 +16,7 @@ namespace AMDiS ...@@ -16,7 +16,7 @@ namespace AMDiS
else if constexpr (N::isPower) else if constexpr (N::isPower)
return order(node.child(0u)); return order(node.child(0u));
else if constexpr (N::isComposite) else if constexpr (N::isComposite)
return Ranges::applyIndices<N::degree()>([&](auto... ii) { return Ranges::applyIndices<std::size_t(N::degree())>([&](auto... ii) {
return Math::max(order(node.child(ii))...); return Math::max(order(node.child(ii))...);
}); });
else { else {
......
...@@ -153,9 +153,9 @@ namespace AMDiS ...@@ -153,9 +153,9 @@ namespace AMDiS
} }
/// Return the \ref AnalyticLocalFunction of the AnalyticGridFunction. /// Return the \ref AnalyticLocalFunction of the AnalyticGridFunction.
LocalFunction makeLocalFunction() const friend LocalFunction localFunction(AnalyticGridFunction const& gf)
{ {
return {fct_}; return {gf.fct_};
} }
/// Returns \ref entitySet_ /// Returns \ref entitySet_
......
...@@ -111,7 +111,7 @@ public: ...@@ -111,7 +111,7 @@ public:
return evaluatePartialDerivative(local); return evaluatePartialDerivative(local);
else if constexpr (std::is_same_v<Type, tag::divergence>) { else if constexpr (std::is_same_v<Type, tag::divergence>) {
static constexpr bool isVectorNode static constexpr bool isVectorNode
= SubTree::isPower && SubTree::degree() == GridView::dimensionworld; = SubTree::isPower && int(SubTree::degree()) == GridView::dimensionworld;
static_assert(isVectorNode); static_assert(isVectorNode);
if (isVectorNode) if (isVectorNode)
return evaluateDivergence(local); return evaluateDivergence(local);
......
...@@ -40,13 +40,13 @@ namespace AMDiS ...@@ -40,13 +40,13 @@ namespace AMDiS
Parameters::get(name + "->precision", p); Parameters::get(name + "->precision", p);
Dune::Vtk::FormatTypes mode = Dune::Vtk::FormatTypes mode =
m == 0 ? Dune::Vtk::ASCII : m == 0 ? Dune::Vtk::FormatTypes::ASCII :
m == 1 ? Dune::Vtk::BINARY : m == 1 ? Dune::Vtk::FormatTypes::BINARY :
Dune::Vtk::COMPRESSED; Dune::Vtk::FormatTypes::COMPRESSED;
Dune::Vtk::DataTypes precision = Dune::Vtk::DataTypes precision =
p == 0 ? Dune::Vtk::FLOAT32 : p == 0 ? Dune::Vtk::DataTypes::FLOAT32 :
Dune::Vtk::FLOAT64; Dune::Vtk::DataTypes::FLOAT64;
if (animation_) { if (animation_) {
vtkSeqWriter_ = std::make_shared<SeqWriter>(gridView, mode, precision); vtkSeqWriter_ = std::make_shared<SeqWriter>(gridView, mode, precision);
......
...@@ -34,8 +34,8 @@ struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<I0,II...>, Dune::Typ ...@@ -34,8 +34,8 @@ struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<I0,II...>, Dune::Typ
// composite node with integral-constant index // composite node with integral-constant index
template <class Tree, class Int, Int i, class... II> template <class Tree, class Int, Int i, class... II>
struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<std::integral_constant<Int,i>,II...>, Dune::TypeTree::CompositeNodeTag> struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<std::integral_constant<Int,i>,II...>, Dune::TypeTree::CompositeNodeTag>
: std::conditional_t<(i >= 0 && i < Tree::degree()), : std::conditional_t<(i >= 0 && i < Int(Tree::degree())),
IsValidTreePath<typename Tree::template Child<(i >= 0 && i < Tree::degree()) ? i : 0>::Type, Dune::TypeTree::HybridTreePath<II...>>, IsValidTreePath<typename Tree::template Child<(i >= 0 && i < Int(Tree::degree())) ? i : 0>::Type, Dune::TypeTree::HybridTreePath<II...>>,
std::false_type> {}; std::false_type> {};
} // end namespace Traits } // end namespace Traits
......
#pragma once #pragma once
#include <dune/common/version.hh>
#include <dune/common/rangeutilities.hh> #include <dune/common/rangeutilities.hh>
#include <dune/common/std/type_traits.hh> #include <dune/common/std/type_traits.hh>
...@@ -14,6 +15,14 @@ ...@@ -14,6 +15,14 @@
namespace AMDiS { namespace AMDiS {
namespace Traversal { namespace Traversal {
#if DUNE_VERSION_GTE(DUNE_TYPETREE,2,8)
using Dune::TypeTree::applyToTree;
using Dune::TypeTree::forEachNode;
using Dune::TypeTree::forEachLeafNode;
#else
template <class Tree> template <class Tree>
using HasDynamicChildAccess = decltype(std::declval<Tree>().child(0u)); using HasDynamicChildAccess = decltype(std::declval<Tree>().child(0u));
...@@ -39,7 +48,7 @@ void forEachNode(Tree&& tree, TreePath treePath, Pre&& preFunc, Leaf&& leafFunc, ...@@ -39,7 +48,7 @@ void forEachNode(Tree&& tree, TreePath treePath, Pre&& preFunc, Leaf&& leafFunc,
} }
} else { } else {
// Specialization for static traversal // Specialization for static traversal
const auto indices = std::make_index_sequence<TreeType::degree()>{}; const auto indices = std::make_index_sequence<std::size_t(TreeType::degree())>{};
Ranges::forIndices(indices, [&](auto i) { Ranges::forIndices(indices, [&](auto i) {
auto childTreePath = Dune::TypeTree::push_back(treePath, i); auto childTreePath = Dune::TypeTree::push_back(treePath, i);
forEachNode(tree.child(i), childTreePath, preFunc, leafFunc, postFunc); forEachNode(tree.child(i), childTreePath, preFunc, leafFunc, postFunc);
...@@ -113,4 +122,6 @@ void forEachLeafNode(Tree&& tree, Leaf&& leafFunc) ...@@ -113,4 +122,6 @@ void forEachLeafNode(Tree&& tree, Leaf&& leafFunc)
forEachNode(tree, root, NoOp{}, leafFunc, NoOp{}); forEachNode(tree, root, NoOp{}, leafFunc, NoOp{});
} }
#endif
}} // end namespace AMDiS::Traversal }} // end namespace AMDiS::Traversal
...@@ -126,12 +126,12 @@ public: ...@@ -126,12 +126,12 @@ public:
if constexpr (Node::isPower) { if constexpr (Node::isPower) {
using TransformedChild = decltype((*this)(node.child(0))); using TransformedChild = decltype((*this)(node.child(0)));
return makeInnerNodeStorage(node, return makeInnerNodeStorage(node,
std::array<TransformedChild, Node::degree()>()); std::array<TransformedChild, std::size_t(Node::degree())>());
} }
else else
if constexpr (Node::isComposite) { if constexpr (Node::isComposite) {
return makeInnerNodeStorage(node, return makeInnerNodeStorage(node,
Ranges::applyIndices<Node::degree()>( Ranges::applyIndices<std::size_t(Node::degree())>(
[&](auto... ii) { return Dune::makeTupleVector((*this)(node.child(ii))...); })); [&](auto... ii) { return Dune::makeTupleVector((*this)(node.child(ii))...); }));
} }
else { else {
......
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