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

Prepare for typetree update

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