mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Refactor copying of region to global data.
This commit is contained in:
parent
a7c45d4e9f
commit
a1192c09dc
@ -331,41 +331,27 @@ namespace Opm
|
|||||||
const PVec sat = phaseSaturations(eqreg, cells, props, press);
|
const PVec sat = phaseSaturations(eqreg, cells, props, press);
|
||||||
const Vec rs(cells.size());// = gasOilRatio();
|
const Vec rs(cells.size());// = gasOilRatio();
|
||||||
|
|
||||||
for (int p = 0, np = props.numPhases(); p < np; ++p) {
|
const int np = props.numPhases();
|
||||||
Vec& d = pp_[p];
|
for (int p = 0; p < np; ++p) {
|
||||||
Vec::const_iterator s = press[p].begin();
|
copyFromRegion(press[p], cells, pp_[p]);
|
||||||
for (typename RMap::CellRange::const_iterator
|
copyFromRegion(sat[p], cells, sat_[p]);
|
||||||
c = cells.begin(),
|
|
||||||
e = cells.end();
|
|
||||||
c != e; ++c, ++s)
|
|
||||||
{
|
|
||||||
d[*c] = *s;
|
|
||||||
}
|
}
|
||||||
}
|
copyFromRegion(rs, cells, rs_);
|
||||||
for (int p = 0, np = props.numPhases(); p < np; ++p) {
|
|
||||||
Vec& d = sat_[p];
|
|
||||||
Vec::const_iterator s = sat[p].begin();
|
|
||||||
for (typename RMap::CellRange::const_iterator
|
|
||||||
c = cells.begin(),
|
|
||||||
e = cells.end();
|
|
||||||
c != e; ++c, ++s)
|
|
||||||
{
|
|
||||||
d[*c] = *s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vec::const_iterator s = rs.begin();
|
|
||||||
Vec& d = rs_;
|
|
||||||
for (typename RMap::CellRange::const_iterator
|
|
||||||
c = cells.begin(),
|
|
||||||
e = cells.end();
|
|
||||||
c != e; ++c, ++s)
|
|
||||||
{
|
|
||||||
d[*c] = *s;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class CellRangeType>
|
||||||
|
void copyFromRegion(const Vec& source,
|
||||||
|
const CellRangeType& cells,
|
||||||
|
Vec& destination)
|
||||||
|
{
|
||||||
|
auto s = source.begin();
|
||||||
|
auto c = cells.begin();
|
||||||
|
const auto e = cells.end();
|
||||||
|
for (; c != e; ++c, ++s) {
|
||||||
|
destination[*c] = *s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace DeckDependent
|
} // namespace DeckDependent
|
||||||
|
Loading…
Reference in New Issue
Block a user