mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
ecltransmissibility: use elements and intersections range generators
This commit is contained in:
parent
da2c68ee08
commit
998cd137a0
@ -173,11 +173,7 @@ update(bool global, const std::function<unsigned int(unsigned int)>& map)
|
|||||||
for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx)
|
for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx)
|
||||||
axisCentroids[dimIdx].resize(numElements);
|
axisCentroids[dimIdx].resize(numElements);
|
||||||
|
|
||||||
auto elemIt = gridView_.template begin</*codim=*/ 0>();
|
for (const auto& elem : elements(gridView_)) {
|
||||||
const auto& elemEndIt = gridView_.template end</*codim=*/ 0>();
|
|
||||||
size_t centroidIdx = 0;
|
|
||||||
for (; elemIt != elemEndIt; ++elemIt, ++centroidIdx) {
|
|
||||||
const auto& elem = *elemIt;
|
|
||||||
unsigned elemIdx = elemMapper.index(elem);
|
unsigned elemIdx = elemMapper.index(elem);
|
||||||
|
|
||||||
// compute the axis specific "centroids" used for the transmissibilities. for
|
// compute the axis specific "centroids" used for the transmissibilities. for
|
||||||
@ -227,9 +223,7 @@ update(bool global, const std::function<unsigned int(unsigned int)>& map)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute the transmissibilities for all intersections
|
// compute the transmissibilities for all intersections
|
||||||
elemIt = gridView_.template begin</*codim=*/ 0>();
|
for (const auto& elem : elements(gridView_)) {
|
||||||
for (; elemIt != elemEndIt; ++elemIt) {
|
|
||||||
const auto& elem = *elemIt;
|
|
||||||
unsigned elemIdx = elemMapper.index(elem);
|
unsigned elemIdx = elemMapper.index(elem);
|
||||||
|
|
||||||
auto isIt = gridView_.ibegin(elem);
|
auto isIt = gridView_.ibegin(elem);
|
||||||
@ -476,10 +470,8 @@ update(bool global, const std::function<unsigned int(unsigned int)>& map)
|
|||||||
std::unordered_map<std::size_t,int> globalToLocal;
|
std::unordered_map<std::size_t,int> globalToLocal;
|
||||||
|
|
||||||
// loop over all elements (global grid) and store Cartesian index
|
// loop over all elements (global grid) and store Cartesian index
|
||||||
elemIt = grid_.leafGridView().template begin<0>();
|
for (const auto& elem : elements(grid_.leafGridView())) {
|
||||||
|
int elemIdx = elemMapper.index(elem);
|
||||||
for (; elemIt != elemEndIt; ++elemIt) {
|
|
||||||
int elemIdx = elemMapper.index(*elemIt);
|
|
||||||
int cartElemIdx = cartMapper_.cartesianIndex(elemIdx);
|
int cartElemIdx = cartMapper_.cartesianIndex(elemIdx);
|
||||||
globalToLocal[cartElemIdx] = elemIdx;
|
globalToLocal[cartElemIdx] = elemIdx;
|
||||||
}
|
}
|
||||||
@ -700,16 +692,9 @@ createTransmissibilityArrays_(const std::array<bool,3>& is_tran)
|
|||||||
std::vector<double>(is_tran[2] ? numElem : 0, 0)};
|
std::vector<double>(is_tran[2] ? numElem : 0, 0)};
|
||||||
|
|
||||||
// compute the transmissibilities for all intersections
|
// compute the transmissibilities for all intersections
|
||||||
auto elemIt = gridView_.template begin</*codim=*/ 0>();
|
for (const auto& elem : elements(gridView_)) {
|
||||||
const auto& elemEndIt = gridView_.template end</*codim=*/ 0>();
|
for (const auto& intersection : intersections(gridView_, elem)) {
|
||||||
|
|
||||||
for (; elemIt != elemEndIt; ++elemIt) {
|
|
||||||
const auto& elem = *elemIt;
|
|
||||||
auto isIt = gridView_.ibegin(elem);
|
|
||||||
const auto& isEndIt = gridView_.iend(elem);
|
|
||||||
for (; isIt != isEndIt; ++ isIt) {
|
|
||||||
// store intersection, this might be costly
|
// store intersection, this might be costly
|
||||||
const auto& intersection = *isIt;
|
|
||||||
if (!intersection.neighbor())
|
if (!intersection.neighbor())
|
||||||
continue; // intersection is on the domain boundary
|
continue; // intersection is on the domain boundary
|
||||||
|
|
||||||
@ -761,16 +746,8 @@ resetTransmissibilityFromArrays_(const std::array<bool,3>& is_tran,
|
|||||||
ElementMapper elemMapper(gridView_, Dune::mcmgElementLayout());
|
ElementMapper elemMapper(gridView_, Dune::mcmgElementLayout());
|
||||||
|
|
||||||
// compute the transmissibilities for all intersections
|
// compute the transmissibilities for all intersections
|
||||||
auto elemIt = gridView_.template begin</*codim=*/ 0>();
|
for (const auto& elem : elements(gridView_)) {
|
||||||
const auto& elemEndIt = gridView_.template end</*codim=*/ 0>();
|
for (const auto& intersection : intersections(gridView_, elem)) {
|
||||||
|
|
||||||
for (; elemIt != elemEndIt; ++elemIt) {
|
|
||||||
const auto& elem = *elemIt;
|
|
||||||
auto isIt = gridView_.ibegin(elem);
|
|
||||||
const auto& isEndIt = gridView_.iend(elem);
|
|
||||||
for (; isIt != isEndIt; ++ isIt) {
|
|
||||||
// store intersection, this might be costly
|
|
||||||
const auto& intersection = *isIt;
|
|
||||||
if (!intersection.neighbor())
|
if (!intersection.neighbor())
|
||||||
continue; // intersection is on the domain boundary
|
continue; // intersection is on the domain boundary
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user