diff --git a/opm/simulators/flow/BlackoilModel_impl.hpp b/opm/simulators/flow/BlackoilModel_impl.hpp index c90c2f7751..8c9653e5a7 100644 --- a/opm/simulators/flow/BlackoilModel_impl.hpp +++ b/opm/simulators/flow/BlackoilModel_impl.hpp @@ -477,7 +477,7 @@ solveJacobianSystem(BVector& x) } } - int fastest_solver = std::min_element(times.begin(), times.end()) - times.begin(); + int fastest_solver = std::ranges::min_element(times) - times.begin(); // Use timing on rank 0 to determine fastest, must be consistent across ranks. grid_.comm().broadcast(&fastest_solver, 1, 0); linear_solve_setup_time_ = setupTimes[fastest_solver]; diff --git a/opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp b/opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp index 4fe45e5ab3..faaf9a52e3 100644 --- a/opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp +++ b/opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp @@ -157,8 +157,8 @@ namespace Opm /// \brief return min step length used so far double AdaptiveSimulatorTimer::minStepLength () const { - if( steps_.empty() ) return 0.0; - return *(std::min_element( steps_.begin(), steps_.end() )); + if (steps_.empty()) return 0.0; + return *std::ranges::min_element(steps_); } /// \brief report start and end time as well as used steps so far diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 93b5040e38..b19a4cf9ce 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -619,8 +619,9 @@ getGroupFipnumAndPvtreg() const auto regIndexPair = std::make_pair(pvtreg, firstWellIndex); std::vector pairs(comm_.size()); comm_.allgather(®IndexPair, 1, pairs.data()); - pvtreg = std::min_element(pairs.begin(), pairs.end(), - [](const auto& p1, const auto& p2){ return p1.second < p2.second;}) + pvtreg = std::ranges::min_element(pairs, + [](const auto& p1, const auto& p2) + { return p1.second < p2.second; }) ->first; } return std::make_pair(fipnum, pvtreg);