replace std::count_if with std::ranges::count_if where appropriate

the c++-20 constrained algorithm is safer and code is more readable
This commit is contained in:
Arne Morten Kvarving committed 2026-02-23 10:56:37 +01:00
1 parent 4b2a574727
commit 7f848ed396
2 files changed
+6 -5

No files matched your search

+3 -2
View File
@@ -232,8 +232,9 @@ void printDomainDistributionSummary(
const int owned_cells = partition_vector.size();
// Count overlap cells using grid view iteration
int overlap_cells = std::count_if(elements(gridView).begin(), elements(gridView).end(),
[](const auto& cell) { return cell.partitionType() == Dune::OverlapEntity; });
int overlap_cells = std::ranges::count_if(elements(gridView),
[](const auto& cell)
{ return cell.partitionType() == Dune::OverlapEntity; });
// Store data for summary output
local_reports_accumulated.success.num_wells = num_wells;
@@ -1795,9 +1795,9 @@ int BlackoilWellModelGeneric<Scalar, IndexTraits>::numLocalWellsEnd() const
{
const auto& wnames = schedule().back().well_order().names();
return std::count_if(wnames.begin(), wnames.end(),
[this](const std::string& wname)
{ return ! this->not_on_process_(wname); });
return std::ranges::count_if(wnames,
[this](const std::string& wname)
{ return ! this->not_on_process_(wname); });
}
template<typename Scalar, typename IndexTraits>