diff --git a/src/amdis/functions/NodeIndices.hpp b/src/amdis/functions/NodeIndices.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2e4710f76a62d994fd5050008feddf6d11cb7d8b --- /dev/null +++ b/src/amdis/functions/NodeIndices.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include <dune/common/rangeutilities.hh> + +#include <amdis/typetree/MultiIndex.hpp> +#include <amdis/utility/MappedRangeView.hpp> + +namespace AMDiS +{ + /// Returns a range over the DOF indices on a node, given by the localView + template <class LocalView, class Node> + auto nodeIndices(LocalView const& localView, Node const& node) + { + return mappedRangeView(Dune::range(node.size()), [&](std::size_t j) { + return flatMultiIndex(localView.index(node.localIndex(j))); + }); + } + + /// Returns a range over the DOF indices on the basis tree, given by the localView + template <class LocalView> + auto nodeIndices(LocalView const& localView) + { + return mappedRangeView(Dune::range(localView.size()), [&](std::size_t i) { + return flatMultiIndex(localView.index(i)); + }); + } + +} // end namespace AMDiS diff --git a/src/amdis/functions/Nodes.hpp b/src/amdis/functions/Nodes.hpp index 5a247083d66b41fe028d9d0a2c3756c8c3e2ada1..79cea5e77ac0e17c3af9b6ea537e30f877f634e2 100644 --- a/src/amdis/functions/Nodes.hpp +++ b/src/amdis/functions/Nodes.hpp @@ -34,4 +34,16 @@ namespace AMDiS #endif } + // dune version independent creation of node from preBasis + template <class PB, class TP> + auto makeNodeIndexSet(PB const& preBasis, TP const& treePath) + { +#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) + return preBasis.indexSet(treePath); +#else + DUNE_UNUSED_PARAMETER(treePath); + return preBasis.makeIndexSet(); +#endif + } + } // end namespace AMDiS