Commit d2dcaa71 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Add range over node indices

parent 7e46647e
#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
......@@ -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
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