Vertical Extent: Prune Unneeded 'cellcount' Parameter

The purpose of this function is to determine the vertical extent of
a set of cells.  Counting the number of cells in the region is not
its responsibility.
This commit is contained in:
Bård Skaflestad 2020-04-13 12:38:40 +02:00
parent 6292855bd5
commit f0ed53a6f1
2 changed files with 9 additions and 16 deletions

View File

@ -1396,7 +1396,6 @@ invertCapPress(const double pc,
template <typename Grid, typename CellRange>
void verticalExtent(const Grid& grid,
const CellRange& cells,
int& cellcount,
std::array<double,2>& span)
{
// This code is only supported in three space dimensions
@ -1404,7 +1403,6 @@ void verticalExtent(const Grid& grid,
span[0] = std::numeric_limits<double>::max();
span[1] = std::numeric_limits<double>::lowest();
cellcount = 0;
const int nd = Grid::dimensionworld;
@ -1426,7 +1424,7 @@ void verticalExtent(const Grid& grid,
for (typename CellRange::const_iterator
ci = cells.begin(), ce = cells.end();
ci != ce; ++ci, ++cellcount)
ci != ce; ++ci)
{
for (auto fi = cell2Faces[*ci].begin(),
fe = cell2Faces[*ci].end();
@ -1687,9 +1685,7 @@ private:
auto ptable = Details::PressureTable<FluidSystem, EquilReg>{ grav };
auto psat = PhaseSat { materialLawManager, this->swatInit_ };
auto vspan = std::array<double, 2>{};
auto ncell = 0;
auto vspan = std::array<double, 2>{};
for (const auto& r : reg.activeRegions()) {
const auto& cells = reg.cells(r);
@ -1699,7 +1695,7 @@ private:
continue;
}
Details::verticalExtent(grid, cells, ncell, vspan);
Details::verticalExtent(grid, cells, vspan);
const EqReg eqreg(rec[r], rsFunc_[r], rvFunc_[r], regionPvtIdx_[r]);

View File

@ -192,14 +192,13 @@ void test_PhasePressure()
0
};
auto numCells = 0;
auto vspan = std::array<double, 2>{};
{
auto cells = std::vector<int>(simulator->vanguard().grid().size(0));
std::iota(cells.begin(), cells.end(), 0);
Opm::EQUIL::Details::verticalExtent(simulator->vanguard().grid(),
cells, numCells, vspan);
cells, vspan);
}
const auto grav = 10.0;
@ -211,7 +210,7 @@ void test_PhasePressure()
const auto reltol = 1.0e-8;
const auto first = centerDepth(*simulator, 0);
const auto last = centerDepth(*simulator, numCells - 1);
const auto last = centerDepth(*simulator, simulator->vanguard().grid().size(0) - 1);
CHECK_CLOSE(ptable.water(first), 90e3 , reltol);
CHECK_CLOSE(ptable.water(last) , 180e3 , reltol);
@ -279,14 +278,13 @@ void test_CellSubset()
cells[ix].push_back(c);
}
auto numCells = 0;
auto vspan = std::array<double, 2>{};
{
auto vspancells = std::vector<int>(simulator->vanguard().grid().size(0));
std::iota(vspancells.begin(), vspancells.end(), 0);
Opm::EQUIL::Details::verticalExtent(simulator->vanguard().grid(),
vspancells, numCells, vspan);
vspancells, vspan);
}
const auto grav = 10.0;
@ -294,7 +292,7 @@ void test_CellSubset()
FluidSystem, Opm::EQUIL::EquilReg
>{ grav };
auto ppress = PPress(2, PVal(numCells, 0.0));
auto ppress = PPress(2, PVal(simulator->vanguard().grid().size(0), 0.0));
for (auto r = cells.begin(), e = cells.end(); r != e; ++r) {
const int rno = int(r - cells.begin());
@ -355,14 +353,13 @@ void test_RegMapping()
0)
};
auto numCells = 0;
auto vspan = std::array<double, 2>{};
{
auto cells = std::vector<int>(simulator->vanguard().grid().size(0));
std::iota(cells.begin(), cells.end(), 0);
Opm::EQUIL::Details::verticalExtent(simulator->vanguard().grid(),
cells, numCells, vspan);
cells, vspan);
}
const auto grav = 10.0;
@ -393,7 +390,7 @@ void test_RegMapping()
const Opm::RegionMapping<> eqlmap(eqlnum);
auto ppress = PPress(2, PVal(numCells, 0.0));
auto ppress = PPress(2, PVal(simulator->vanguard().grid().size(0), 0.0));
for (const auto& r : eqlmap.activeRegions()) {
ptable.equilibrate(region[r], vspan);