use std::for_each instead of raw loops

This commit is contained in:
Arne Morten Kvarving committed 2025-04-23 14:58:46 +02:00
1 parent 79919abcf0
commit c6227b2166
2 files changed
+10 -9

No files matched your search

@@ -154,9 +154,9 @@ namespace Opm
const auto rankReports =
CollectConvReports { packer, mpi_communicator }(local_report);
for (const auto& rankReport : rankReports) {
combinedReport += rankReport;
}
std::for_each(rankReports.begin(), rankReports.end(),
[&combinedReport](const auto& rankReport)
{ combinedReport += rankReport; });
return combinedReport;
}
+7 -6
View File
@@ -20,7 +20,6 @@
#include <opm/simulators/utils/compressPartition.hpp>
#include <algorithm>
#include <tuple>
#include <utility>
#include <vector>
@@ -51,11 +50,13 @@ namespace {
}
}
for (auto& domain : partition) {
if (domain >= 0) {
domain = compressed[domain - low];
}
}
std::for_each(partition.begin(), partition.end(),
[Low = low, &compressed](auto& domain)
{
if (domain >= 0) {
domain = compressed[domain - Low];
}
});
}
} // Anonymous namespace