Commit 64df9b69 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Cleanup the dyamic powerbasis integration

parent f6f63449
Pipeline #6053 failed with stage
in 13 minutes and 10 seconds
......@@ -136,7 +136,11 @@ namespace AMDiS
};
// specialization for flat power bases
#if DUNE_VERSION_GTE(DUNE_FUNCTIONS,2,8)
template <class MI, class IMS, class SPB, int C, class MultiIndex>
#else
template <class MI, class IMS, class SPB, std::size_t C, class MultiIndex>
#endif
struct FlatPreBasis<Dune::Functions::PowerPreBasis<MI, IMS, SPB, C>, MultiIndex>
{
using type = Dune::Functions::PowerPreBasis<MultiIndex, IMS, SPB, C>;
......@@ -148,6 +152,7 @@ namespace AMDiS
}
};
#if DUNE_VERSION_GTE(DUNE_FUNCTIONS,2,8)
// specialization for flat power bases
template <class MI, class IMS, class SPB, class MultiIndex>
struct FlatPreBasis<Dune::Functions::PowerPreBasis<MI, IMS, SPB, -1>, MultiIndex>
......@@ -160,9 +165,14 @@ namespace AMDiS
return type{preBasis.children(), FlatPreBasis<SPB, MultiIndex>::create(Impl::subPreBasis(preBasis))};
}
};
#endif
// specialization for blocked power bases
#if DUNE_VERSION_GTE(DUNE_FUNCTIONS,2,8)
template <class MI, class SPB, int C, class MultiIndex>
#else
template <class MI, class SPB, std::size_t C, class MultiIndex>
#endif
struct FlatPreBasis<Dune::Functions::PowerPreBasis
<MI, Dune::Functions::BasisFactory::BlockedInterleaved, SPB, C>, MultiIndex>
{
......@@ -177,6 +187,7 @@ namespace AMDiS
}
};
#if DUNE_VERSION_GTE(DUNE_FUNCTIONS,2,8)
// specialization for blocked power bases
template <class MI, class SPB, class MultiIndex>
struct FlatPreBasis<Dune::Functions::PowerPreBasis
......@@ -192,9 +203,14 @@ namespace AMDiS
return type{preBasis.children(), FlatPreBasis<SPB, MultiIndex>::create(Impl::subPreBasis(preBasis))};
}
};
#endif
// specialization for blocked power bases
#if DUNE_VERSION_GTE(DUNE_FUNCTIONS,2,8)
template <class MI, class SPB, int C, class MultiIndex>
#else
template <class MI, class SPB, std::size_t C, class MultiIndex>
#endif
struct FlatPreBasis<Dune::Functions::PowerPreBasis
<MI, Dune::Functions::BasisFactory::BlockedLexicographic, SPB, C>, MultiIndex>
{
......@@ -209,6 +225,7 @@ namespace AMDiS
}
};
#if DUNE_VERSION_GTE(DUNE_FUNCTIONS,2,8)
// specialization for blocked power bases
template <class MI, class SPB, class MultiIndex>
struct FlatPreBasis<Dune::Functions::PowerPreBasis
......@@ -224,5 +241,6 @@ namespace AMDiS
return type{preBasis.children(), FlatPreBasis<SPB, MultiIndex>::create(Impl::subPreBasis(preBasis))};
}
};
#endif
} // end namespace AMDiS
......@@ -285,7 +285,11 @@ namespace AMDiS
// Specialization for PowerBasis
template <class PreBasis, class TP>
#if DUNE_VERSION_GTE(DUNE_TYPETREE,2,8)
class NodeIdSet<PreBasis, TP, Dune::TypeTree::DynamicPowerNodeTag>
#else
class NodeIdSet<PreBasis, TP, Dune::TypeTree::PowerNodeTag>
#endif
{
public:
using Node = Node_t<PreBasis,TP>;
......@@ -344,6 +348,7 @@ namespace AMDiS
};
#if DUNE_VERSION_GTE(DUNE_TYPETREE,2,8)
// Specialization for PowerBasis
template <class PreBasis, class TP>
class NodeIdSet<PreBasis, TP, Dune::TypeTree::PowerNodeTag>
......@@ -357,6 +362,7 @@ namespace AMDiS
: Super(gridView)
{}
};
#endif
// Specialization for CompositePreBasis
......
......@@ -7,6 +7,7 @@
#include <dune/common/ftraits.hh>
#include <dune/common/hash.hh>
#include <dune/common/indices.hh>
#include <dune/common/version.hh>
#include <dune/geometry/type.hh>
......@@ -14,6 +15,10 @@
#include <dune/typetree/powernode.hh>
#include <dune/typetree/compositenode.hh>
#if __has_include(<dune/typetree/dynamicpowernode.hh>)
#include <dune/typetree/dynamicpowernode.hh>
#endif
#include <amdis/common/ConcurrentCache.hpp>
namespace AMDiS
......@@ -223,6 +228,7 @@ namespace AMDiS
};
#if DUNE_VERSION_GTE(DUNE_TYPETREE,2,8)
template <class Node>
class DynamicPowerNodeCache
: public Impl::NodeCacheFactory<Node>::Base
......@@ -247,6 +253,7 @@ namespace AMDiS
return cache;
}
};
#endif
template <class Node>
......@@ -292,6 +299,7 @@ namespace AMDiS
using type = PowerNodeCache<Node>;
};
#if DUNE_VERSION_GTE(DUNE_TYPETREE,2,8)
template <class Node>
struct NodeCacheFactory<Node, Dune::TypeTree::DynamicPowerNodeTag>
{
......@@ -299,6 +307,7 @@ namespace AMDiS
using Base = Dune::TypeTree::DynamicPowerNode<Child>;
using type = DynamicPowerNodeCache<Node>;
};
#endif
template <class Node>
struct NodeCacheFactory<Node, Dune::TypeTree::CompositeNodeTag>
......
......@@ -2,6 +2,7 @@
#include <type_traits>
#include <dune/common/version.hh>
#include <dune/typetree/treepath.hh>
#include <amdis/typetree/TreePath.hpp>
......@@ -26,10 +27,12 @@ template <class Tree, class I0, class... II>
struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<I0,II...>, Dune::TypeTree::PowerNodeTag>
: IsValidTreePath<typename Tree::ChildType, Dune::TypeTree::HybridTreePath<II...>> {};
#if DUNE_VERSION_GTE(DUNE_TYPETREE,2,8)
// dynamic power nodes
template <class Tree, class I0, class... II>
struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<I0,II...>, Dune::TypeTree::DynamicPowerNodeTag>
: IsValidTreePath<typename Tree::ChildType, Dune::TypeTree::HybridTreePath<II...>> {};
#endif
// composite node with integer index
template <class Tree, class I0, class... II>
......
#pragma once
#include <dune/common/version.hh>
#include <dune/typetree/nodetags.hh>
#include <amdis/common/Tags.hpp>
......@@ -39,6 +40,7 @@ namespace AMDiS
using type = FiniteElementType_t<ChildNode>;
};
#if DUNE_VERSION_GTE(DUNE_TYPETREE,2,8)
// dynamic power node
template <class Node>
struct FiniteElementTypeImpl<Node, Dune::TypeTree::DynamicPowerNodeTag>
......@@ -46,6 +48,7 @@ namespace AMDiS
using ChildNode = typename Node::ChildType;
using type = FiniteElementType_t<ChildNode>;
};
#endif
// Composite node
template <class Node>
......
......@@ -3,9 +3,11 @@
#include <type_traits>
#include <utility>
#include <dune/common/dynvector.hh>
#include <dune/common/fvector.hh>
#include <dune/common/tuplevector.hh>
#include <dune/common/typetraits.hh>
#include <dune/common/version.hh>
#include <amdis/common/Index.hpp>
#include <amdis/common/TypeTraits.hpp>
......@@ -77,6 +79,7 @@ namespace AMDiS
using type = typename FlatType<ChildNode::isLeaf, RangeType_t<ChildNode,R>>::type;
};
#if DUNE_VERSION_GTE(DUNE_TYPETREE,2,8)
// Dynamic power node
template <class Node, class R>
struct RangeTypeImpl<Node, R, Dune::TypeTree::DynamicPowerNodeTag>
......@@ -95,6 +98,7 @@ namespace AMDiS
using type = typename FlatType<ChildNode::isLeaf, RangeType_t<ChildNode,R>>::type;
};
#endif
// Composite node
template <class Node, class R>
......
......@@ -159,7 +159,7 @@ void test(Op& op, Basis const& basis, Path path)
test_operator(op, localView, vec, node);
});
VectorOperators<Basis,ElementVector> opList;
VectorOperators<Basis,ElementVector> opList = makeVectorOperators<ElementVector>(basis);
opList[path].push(tag::element_operator<Element>{}, a_op);
test_operator_list(opList, localView, vec, node);
test_operator_list_vec(opList, localView, vec);
......@@ -208,7 +208,7 @@ void test(Op& op, Basis const& basis, Row row, Col col)
test_operator(op, localView, mat, rowNode, colNode);
});
MatrixOperators<Basis,Basis,ElementMatrix> opList;
MatrixOperators<Basis,Basis,ElementMatrix> opList = makeMatrixOperators<ElementMatrix>(basis,basis);
opList[row][col].push(tag::element_operator<Element>{}, a_op);
test_operator_list(opList, localView, mat, rowNode, colNode);
test_operator_list_mat(opList, localView, mat);
......
......@@ -23,8 +23,10 @@ void test()
using namespace Dune::Functions::BasisFactory;
#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7)
GlobalBasis basis{grid.leafGridView(), power<1>(lagrange<1>(), flatLexicographic())};
#else
#elif DUNE_VERSION_LT(DUNE_FUNCTIONS,2,8)
GlobalBasis basis{grid.leafGridView(), power<1>(lagrange<1,T>(), flatLexicographic())};
#else
GlobalBasis basis{grid.leafGridView(), power(lagrange<1,T>(), 1, flatLexicographic())};
#endif
using Basis = decltype(basis);
......
......@@ -32,8 +32,8 @@ int main (int argc, char** argv)
auto const& tree = localView.tree();
auto c1 = TypeTree::treeContainer<double>(tree);
auto c2 = TypeTree::treeContainer<decltype(c1)>(tree);
auto c3 = TypeTree::treeContainer(tree, [&](auto const&) { return TypeTree::treeContainer<double>(tree); });
auto c2 = TypeTree::treeContainer<double>(tree,tree);
auto c3 = TypeTree::makeTreeContainer(tree, [&](auto const&) { return TypeTree::treeContainer<double>(tree); });
// fill 1d treeContainer with data
Traversal::forEachLeafNode(tree, [&](auto const& node, auto tp) {
......
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