Merge pull request #2772 from blattms/prevent-copy-in-rateconverter

Prevent another copy of cell to region mapping in RateConverter.
This commit is contained in:
Bård Skaflestad
2020-09-07 17:13:22 +02:00
committed by GitHub

View File

@@ -435,13 +435,7 @@ namespace Opm {
// create map from cell to region
// and set all attributes to zero
const auto& grid = simulator.vanguard().grid();
const unsigned numCells = grid.size(/*codim=*/0);
std::vector<int> cell2region(numCells, -1);
for (const auto& reg : rmap_.activeRegions()) {
for (const auto& cell : rmap_.cells(reg)) {
cell2region[cell] = reg;
}
auto& ra = attr_.attributes(reg);
ra.pressure = 0.0;
ra.temperature = 0.0;
@@ -483,7 +477,7 @@ namespace Opm {
hydrocarbon -= fs.saturation(FluidSystem::waterPhaseIdx).value();
}
int reg = cell2region[cellIdx];
int reg = rmap_.region(cellIdx);
assert(reg >= 0);
auto& ra = attr_.attributes(reg);
auto& p = ra.pressure;