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
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -16,7 +16,7 @@ namespace MatrixVector { ...@@ -16,7 +16,7 @@ namespace MatrixVector {
*/ */
template <class Range, class F, template <class Range, class F,
typename = std::enable_if_t<Dune::IsTupleOrDerived<Range>::value>> 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; using namespace Dune::Hybrid;
forEach(integralRange(size(range)), [&](auto&& i) { f(range[i], i); }); forEach(integralRange(size(range)), [&](auto&& i) { f(range[i], i); });
} }
...@@ -25,7 +25,7 @@ void rangeForEach(const Range& range, F&& f) { ...@@ -25,7 +25,7 @@ void rangeForEach(const Range& range, F&& f) {
* \brief Hybrid for loop over sparse range * \brief Hybrid for loop over sparse range
*/ */
template<class Range, class F> 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) for (auto it = range.begin(); it != range.end(); ++it)
f(*it, it.index()); f(*it, it.index());
......
...@@ -115,9 +115,9 @@ namespace MatrixVector { ...@@ -115,9 +115,9 @@ namespace MatrixVector {
class ADummy = A, class ADummy = A,
std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0> std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0>
static void addProduct(A& a, const B& b, const C& c) { static void addProduct(A& a, const B& b, const C& c) {
rangeForEach(b, [&](auto&& bi, auto&& i) { sparseRangeFor(b, [&](auto&& bi, auto&& i) {
rangeForEach(bi, [&](auto&& bik, auto&& k) { sparseRangeFor(bi, [&](auto&& bik, auto&& k) {
rangeForEach(c[k], [&](auto&& ckj, auto&& j) { sparseRangeFor(c[k], [&](auto&& ckj, auto&& j) {
Dune::MatrixVector::addProduct(a[i][j], bik, ckj); Dune::MatrixVector::addProduct(a[i][j], bik, ckj);
}); });
}); });
...@@ -141,9 +141,9 @@ namespace MatrixVector { ...@@ -141,9 +141,9 @@ namespace MatrixVector {
class ADummy = A, class ADummy = A,
std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0> 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) { static void addProduct(A& a, const Scalar& scalar, const B& b, const C& c) {
rangeForEach(b, [&](auto&& bi, auto&& i) { sparseRangeFor(b, [&](auto&& bi, auto&& i) {
rangeForEach(bi, [&](auto&& bik, auto&& k) { sparseRangeFor(bi, [&](auto&& bik, auto&& k) {
rangeForEach(c[k], [&](auto&& ckj, auto&& j) { sparseRangeFor(c[k], [&](auto&& ckj, auto&& j) {
Dune::MatrixVector::addProduct(a[i][j], scalar, bik, ckj); Dune::MatrixVector::addProduct(a[i][j], scalar, bik, ckj);
}); });
}); });
...@@ -328,8 +328,8 @@ namespace MatrixVector { ...@@ -328,8 +328,8 @@ namespace MatrixVector {
class ADummy = A, class ADummy = A,
std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0> std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0>
static void addProduct(A& a, const B& b, const C& c) { static void addProduct(A& a, const B& b, const C& c) {
rangeForEach(c, [&](auto&& ci, auto && i) { sparseRangeFor(c, [&](auto&& ci, auto && i) {
rangeForEach(ci, [&](auto&& cij, auto && j) { sparseRangeFor(ci, [&](auto&& cij, auto && j) {
Dune::MatrixVector::addProduct(a[i][j], b, cij); Dune::MatrixVector::addProduct(a[i][j], b, cij);
}); });
}); });
...@@ -353,8 +353,8 @@ namespace MatrixVector { ...@@ -353,8 +353,8 @@ namespace MatrixVector {
class ADummy = A, class ADummy = A,
std::enable_if_t<MatrixTraits<ADummy>::isMatrix, int> SFINAE_Dummy = 0> 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) { static void addProduct(A& a, const Scalar& scalar, const B& b, const C& c) {
rangeForEach(c, [&](auto&& ci, auto&& i) { sparseRangeFor(c, [&](auto&& ci, auto&& i) {
rangeForEach(ci, [&](auto&& cij, auto&& j) { sparseRangeFor(ci, [&](auto&& cij, auto&& j) {
Dune::MatrixVector::addProduct(a[i][j], scalar, b, cij); 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