replace std::fill with std::ranges::fill 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:23:45 +01:00
1 parent 4b2a574727
commit f00ab30268
21 files changed
+56 -61

No files matched your search

+1 -1
View File
@@ -283,7 +283,7 @@ void testQuadrature()
std::array<int, dim> cellRes;
std::fill(cellRes.begin(), cellRes.end(), 10);
std::ranges::fill(cellRes, 10);
GlobalPosition upperRight(1.0);
+8 -8
View File
@@ -268,8 +268,8 @@ private:
auto well_idx = ws.index("WELL-A");
BOOST_REQUIRE(well_idx.has_value());
auto& well = ws.well(well_idx.value());
std::fill(well.surface_rates.begin(), well.surface_rates.end(), 0.0);
std::fill(well.well_potentials.begin(), well.well_potentials.end(), 0.0);
std::ranges::fill(well.surface_rates, 0.0);
std::ranges::fill(well.well_potentials, 0.0);
well.surface_rates[oil_phase_pos_] = wellARateSI();
well.well_potentials[oil_phase_pos_] = -wellARateSI(); // positive
well.production_cmode = well_a_control_;
@@ -280,8 +280,8 @@ private:
auto well_idx = ws.index("WELL-A2");
BOOST_REQUIRE(well_idx.has_value());
auto& well = ws.well(well_idx.value());
std::fill(well.surface_rates.begin(), well.surface_rates.end(), 0.0);
std::fill(well.well_potentials.begin(), well.well_potentials.end(), 0.0);
std::ranges::fill(well.surface_rates, 0.0);
std::ranges::fill(well.well_potentials, 0.0);
well.surface_rates[oil_phase_pos_] = wellA2RateSI();
well.well_potentials[oil_phase_pos_] = -wellA2RateSI(); // positive
well.production_cmode = well_a2_control_;
@@ -292,8 +292,8 @@ private:
auto well_idx = ws.index("WELL-B");
BOOST_REQUIRE(well_idx.has_value());
auto& well = ws.well(well_idx.value());
std::fill(well.surface_rates.begin(), well.surface_rates.end(), 0.0);
std::fill(well.well_potentials.begin(), well.well_potentials.end(), 0.0);
std::ranges::fill(well.surface_rates, 0.0);
std::ranges::fill(well.well_potentials, 0.0);
well.surface_rates[oil_phase_pos_] = wellBRateSI();
well.well_potentials[oil_phase_pos_] = -wellBRateSI(); // positive
well.production_cmode = Opm::Well::ProducerCMode::GRUP;
@@ -304,8 +304,8 @@ private:
auto well_idx = ws.index("WELL-C");
BOOST_REQUIRE(well_idx.has_value());
auto& well = ws.well(well_idx.value());
std::fill(well.surface_rates.begin(), well.surface_rates.end(), 0.0);
std::fill(well.well_potentials.begin(), well.well_potentials.end(), 0.0);
std::ranges::fill(well.surface_rates, 0.0);
std::ranges::fill(well.well_potentials, 0.0);
well.surface_rates[oil_phase_pos_] = wellCRateSI();
well.well_potentials[oil_phase_pos_] = -wellCRateSI(); // positive
well.production_cmode = Opm::Well::ProducerCMode::GRUP;