mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-13 17:32:03 -05:00
Use CpGrid::loadBalance to distribute the field properties.
The created data handle for the communication could in theory be used with other DUNE grids, too. In reality we will need to merge with the handle that ALUGrid already uses to communicate the cartesian indices. This PR gets rid of using the get_global_(double|int) method in ParallelEclipseState and reduces the amount of boilerplate code there.
This commit is contained in:
1 parent
123a9d4579
commit
77478a59eb
5 files changed
+213
-137
No files matched your search
@@ -34,6 +34,7 @@
|
||||
#include <opm/grid/CpGrid.hpp>
|
||||
#include <opm/grid/cpgrid/GridHelpers.hpp>
|
||||
#include <opm/simulators/utils/ParallelEclipseState.hpp>
|
||||
#include <opm/simulators/utils/FieldPropsDataHandle.hpp>
|
||||
|
||||
#include <dune/grid/common/mcmgmapper.hh>
|
||||
|
||||
@@ -188,7 +189,9 @@ public:
|
||||
//distribute the grid and switch to the distributed view.
|
||||
{
|
||||
const auto wells = this->schedule().getWellsatEnd();
|
||||
defunctWellNames_ = std::get<1>(grid_->loadBalance(edgeWeightsMethod, &wells, faceTrans.data()));
|
||||
auto& eclState = static_cast<ParallelEclipseState&>(this->eclState());
|
||||
FieldPropsDataHandle<Dune::CpGrid> handle(*grid_, eclState);
|
||||
defunctWellNames_ = std::get<1>(grid_->loadBalance(handle, edgeWeightsMethod, &wells, faceTrans.data()));
|
||||
}
|
||||
grid_->switchToDistributedView();
|
||||
|
||||
@@ -210,14 +213,6 @@ public:
|
||||
this->updateGridView_();
|
||||
#if HAVE_MPI
|
||||
if (mpiSize > 1) {
|
||||
std::vector<int> cartIndices;
|
||||
cartIndices.reserve(grid_->numCells());
|
||||
auto locElemIt = this->gridView().template begin</*codim=*/0>();
|
||||
const auto& locElemEndIt = this->gridView().template end</*codim=*/0>();
|
||||
for (; locElemIt != locElemEndIt; ++locElemIt) {
|
||||
cartIndices.push_back(cartesianIndexMapper_->cartesianIndex(locElemIt->index()));
|
||||
}
|
||||
static_cast<ParallelEclipseState&>(this->eclState()).setupLocalProps(cartIndices);
|
||||
static_cast<ParallelEclipseState&>(this->eclState()).switchToDistributedProps();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user