Commit 1b3e9f6d authored by Carsten Gräser's avatar Carsten Gräser

[backport to 2.6] Transform TypeTree::TreePath<...> to a container.

In 2.6 dune-typetree either provides static or dynamic
tree paths during traversal. Here we require statically sized
tree paths, which may be on the type Dune::TypeTree::TreePath<...>.
Unfortunately this does not behave like a container. As a
workaround we copy this to a Dune::TupleVector which provides
the same static information by a container-like interface.
parent 48c5e5b9
......@@ -8,6 +8,7 @@
#include <type_traits>
#include <dune/common/concept.hh>
#include <dune/common/tuplevector.hh>
#include <dune/functions/functionspacebases/concepts.hh>
#include <dune/functions/common/indexaccess.hh>
......@@ -28,11 +29,23 @@ namespace Functions {
*/
struct HierarchicNodeToRangeMap
{
template<std::size_t... i>
static constexpr auto makeHybrid(TypeTree::TreePath<i...>)
{
return Dune::TupleVector<Dune::index_constant<i>...>();
}
template<class... I>
static constexpr auto makeHybrid(const TypeTree::HybridTreePath<I...>& treePath)
{
return treePath;
}
template<class Node, class TreePath, class Range,
std::enable_if_t< models<Concept::HasIndexAccess, Range, Dune::index_constant<0>>(), int> = 0>
decltype(auto) operator()(const Node& node, const TreePath& treePath, Range&& y) const
{
return resolveStaticMultiIndex(y, treePath);
return resolveStaticMultiIndex(y, makeHybrid(treePath));
}
template<class Node, class TreePath, class Range,
......
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