|
33 | 33 | #include <opm/common/utility/ActiveGridCells.hpp> |
34 | 34 |
|
35 | 35 | #include <opm/grid/cpgrid/GridHelpers.hpp> |
| 36 | +#include <opm/grid/cpgrid/LevelCartesianIndexMapper.hpp> |
36 | 37 |
|
37 | 38 | #include <opm/input/eclipse/Schedule/Schedule.hpp> |
38 | 39 | #include <opm/input/eclipse/Schedule/Well/Well.hpp> |
@@ -306,7 +307,13 @@ distributeFieldProps_(EclipseState& eclState1) |
306 | 307 | { |
307 | 308 | // Reset Cartesian index mapper for automatic creation of field |
308 | 309 | // properties |
309 | | - parallelEclState->resetCartesianMapper(this->cartesianIndexMapper_.get()); |
| 310 | + // Note: the previous cartesianIndexMapper_ has been replaces by levelCartesianIndexMapper_ |
| 311 | + // to support also the case of a distributed level zero grid in a CpGrid with LGRs. |
| 312 | + // This change allows access to the Cartesian indices of the distributed level zero grid, |
| 313 | + // where the field properties are given - for now. |
| 314 | + // In case of supporting LGR field properties, this need to be adapted, to access instead |
| 315 | + // each local/level Cartesian index set. |
| 316 | + parallelEclState->resetCartesianMapper(this->levelCartesianIndexMapper_.get()); |
310 | 317 | parallelEclState->switchToDistributedProps(); |
311 | 318 | } |
312 | 319 | else { |
@@ -500,6 +507,7 @@ void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Eclips |
500 | 507 | } |
501 | 508 |
|
502 | 509 | cartesianIndexMapper_ = std::make_unique<CartesianIndexMapper>(*grid_); |
| 510 | + levelCartesianIndexMapper_ = std::make_unique<LevelCartesianIndexMapper>(*grid_); |
503 | 511 |
|
504 | 512 | #if HAVE_MPI |
505 | 513 | if (this->grid_->comm().size() > 1) { |
@@ -640,7 +648,7 @@ template<class ElementMapper, class GridView, class Scalar> |
640 | 648 | const LevelCartesianIndexMapper<Dune::CpGrid> |
641 | 649 | GenericCpGridVanguard<ElementMapper,GridView,Scalar>::levelCartesianIndexMapper() const |
642 | 650 | { |
643 | | - return LevelCartesianIndexMapper(*grid_); |
| 651 | + return *levelCartesianIndexMapper_; |
644 | 652 | } |
645 | 653 |
|
646 | 654 | template<class ElementMapper, class GridView, class Scalar> |
|
0 commit comments