7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTNODETORANGEMAP_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTNODETORANGEMAP_HH
10#warning The header dune/functions/common/defaultnodetorangemap.hh is deprecated and will be removed after release 2.10.
12#include <dune/common/concept.hh>
14#include <dune/functions/functionspacebases/concepts.hh>
16#include <dune/typetree/traversal.hh>
17#include <dune/typetree/visitor.hh>
46[[deprecated(
"DefaultNodeToRangeMap is deprecated and will be removed after release 2.10.")]]
56 :
public TypeTree::TreeVisitor
57 ,
public TypeTree::DynamicTraversal
59 Visitor(std::vector<std::size_t>& indices) :
64 template<
typename Node,
typename TreePath>
65 void leaf(Node& node, TreePath treePath)
67 if (indices_.size() < node.treeIndex()+1)
68 indices_.resize(node.treeIndex()+1);
69 indices_[node.treeIndex()] = counter_;
73 std::vector<std::size_t>& indices_;
89 TypeTree::applyToTree(tree, Visitor(indices_));
92 template<
class Node,
class TreePath,
class Range,
93 std::enable_if_t<models<Concept::HasIndexAccess, Range, decltype(std::declval<Node>().treeIndex())>() and not Tree::isLeaf,
int> = 0>
94 decltype(
auto)
operator()(
const Node& node,
const TreePath& treePath, Range&& y)
const
96 return y[indices_[node.treeIndex()]];
99 template<
class Node,
class TreePath,
class Range,
100 std::enable_if_t< not models<Concept::HasIndexAccess, Range, decltype(std::declval<Node>().treeIndex())>() or Tree::isLeaf,
int> = 0>
101 decltype(
auto)
operator()(
const Node& node,
const TreePath& treePath, Range&& y)
const
103 return std::forward<Range>(y);
106 std::vector<std::size_t> indices_;
112DefaultNodeToRangeMap<Tree> makeDefaultNodeToRangeMap(
const Tree& tree)
114 return DefaultNodeToRangeMap<Tree>(tree);
119template<
class Basis,
class TreePath>
120auto makeDefaultNodeToRangeMap(
const Basis& basis, TreePath&& treePath)
121 ->
decltype(makeDefaultNodeToRangeMap(TypeTree::child(basis.localView().tree(),treePath)))
123 auto&& localView = basis.localView();
124 localView.bind(*basis.gridView().template begin<0>());
125 auto&& tree = TypeTree::child(localView.tree(),treePath);
126 return makeDefaultNodeToRangeMap(tree);
Definition: polynomial.hh:17
A simple node to range map using lexicographic ordering.
Definition: defaultnodetorangemap.hh:48
DefaultNodeToRangeMap(const Tree &tree)
Construct DefaultNodeToRangeMap.
Definition: defaultnodetorangemap.hh:87