Skip to content
Snippets Groups Projects
Commit 5289423b authored by Max Kahnt's avatar Max Kahnt
Browse files

Use sparseRangeFor instead of rangeForEach for consistency.

It still is in dune-solvers and provides the very same functionality.
parent 8ffed908
Branches
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ namespace MatrixVector {
*/
template <class Range, class F,
typename = std::enable_if_t<Dune::IsTupleOrDerived<Range>::value>>
void rangeForEach(const Range& range, F&& f) {
void sparseRangeFor(const Range& range, F&& f) {
using namespace Dune::Hybrid;
forEach(integralRange(size(range)), [&](auto&& i) { f(range[i], i); });
}
......@@ -25,7 +25,7 @@ void rangeForEach(const Range& range, F&& f) {
* \brief Hybrid for loop over sparse range
*/
template<class Range, class F>
void rangeForEach(Range&& range, F&& f)
void sparseRangeFor(Range&& range, F&& f)
{
for (auto it = range.begin(); it != range.end(); ++it)
f(*it, it.index());
......
......@@ -115,9 +115,9 @@ namespace MatrixVector {
class ADummy = A,
std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0>
static void addProduct(A& a, const B& b, const C& c) {
rangeForEach(b, [&](auto&& bi, auto&& i) {
rangeForEach(bi, [&](auto&& bik, auto&& k) {
rangeForEach(c[k], [&](auto&& ckj, auto&& j) {
sparseRangeFor(b, [&](auto&& bi, auto&& i) {
sparseRangeFor(bi, [&](auto&& bik, auto&& k) {
sparseRangeFor(c[k], [&](auto&& ckj, auto&& j) {
Dune::MatrixVector::addProduct(a[i][j], bik, ckj);
});
});
......@@ -141,9 +141,9 @@ namespace MatrixVector {
class ADummy = A,
std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0>
static void addProduct(A& a, const Scalar& scalar, const B& b, const C& c) {
rangeForEach(b, [&](auto&& bi, auto&& i) {
rangeForEach(bi, [&](auto&& bik, auto&& k) {
rangeForEach(c[k], [&](auto&& ckj, auto&& j) {
sparseRangeFor(b, [&](auto&& bi, auto&& i) {
sparseRangeFor(bi, [&](auto&& bik, auto&& k) {
sparseRangeFor(c[k], [&](auto&& ckj, auto&& j) {
Dune::MatrixVector::addProduct(a[i][j], scalar, bik, ckj);
});
});
......@@ -328,8 +328,8 @@ namespace MatrixVector {
class ADummy = A,
std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0>
static void addProduct(A& a, const B& b, const C& c) {
rangeForEach(c, [&](auto&& ci, auto && i) {
rangeForEach(ci, [&](auto&& cij, auto && j) {
sparseRangeFor(c, [&](auto&& ci, auto && i) {
sparseRangeFor(ci, [&](auto&& cij, auto && j) {
Dune::MatrixVector::addProduct(a[i][j], b, cij);
});
});
......@@ -353,8 +353,8 @@ namespace MatrixVector {
class ADummy = A,
std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0>
static void addProduct(A& a, const Scalar& scalar, const B& b, const C& c) {
rangeForEach(c, [&](auto&& ci, auto&& i) {
rangeForEach(ci, [&](auto&& cij, auto&& j) {
sparseRangeFor(c, [&](auto&& ci, auto&& i) {
sparseRangeFor(ci, [&](auto&& cij, auto&& j) {
Dune::MatrixVector::addProduct(a[i][j], scalar, b, cij);
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment