mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Disregard non-active cells when writing MPI_RANK in writeInitial.
This saves space and it is allowed and recommended (spacewise) to use integer arrays with only values for active cells in writeInitial.
This commit is contained in:
@@ -818,11 +818,9 @@ namespace Opm
|
|||||||
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>;
|
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>;
|
||||||
using Handle = CellOwnerDataHandle<ElementMapper>;
|
using Handle = CellOwnerDataHandle<ElementMapper>;
|
||||||
ElementMapper globalMapper(this->globalGrid().leafGridView());
|
ElementMapper globalMapper(this->globalGrid().leafGridView());
|
||||||
const auto* dims = UgGridHelpers::cartDims(grid());
|
const auto globalSize = this->globalGrid().size(0);
|
||||||
const auto globalSize = dims[0]*dims[1]*dims[2];
|
|
||||||
std::vector<int> ranks(globalSize, -1);
|
std::vector<int> ranks(globalSize, -1);
|
||||||
Handle handle(globalMapper, ranks,
|
Handle handle(globalMapper, ranks);
|
||||||
this->globalGrid().globalCell());
|
|
||||||
this->grid().gatherData(handle);
|
this->grid().gatherData(handle);
|
||||||
integerVectors.emplace("MPI_RANK", ranks);
|
integerVectors.emplace("MPI_RANK", ranks);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,9 +126,8 @@ class CellOwnerDataHandle
|
|||||||
public:
|
public:
|
||||||
using DataType = int;
|
using DataType = int;
|
||||||
|
|
||||||
CellOwnerDataHandle(const Mapper& globalMapper, std::vector<int>& globalData,
|
CellOwnerDataHandle(const Mapper& globalMapper, std::vector<int>& globalData)
|
||||||
const std::vector<int>& globalCell)
|
: globalMapper_(globalMapper), globalData_(globalData)
|
||||||
: globalMapper_(globalMapper), globalData_(globalData), globalCell_(globalCell)
|
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
char** argv = nullptr;
|
char** argv = nullptr;
|
||||||
@@ -158,7 +157,7 @@ public:
|
|||||||
template<class B, class T>
|
template<class B, class T>
|
||||||
void scatter(B& buffer, const T& e, std::size_t /* size */)
|
void scatter(B& buffer, const T& e, std::size_t /* size */)
|
||||||
{
|
{
|
||||||
const auto& index = globalCell_[globalMapper_.index(e)];
|
const auto& index = globalMapper_.index(e);
|
||||||
buffer.read(globalData_[index]);
|
buffer.read(globalData_[index]);
|
||||||
}
|
}
|
||||||
bool contains(int dim, int codim)
|
bool contains(int dim, int codim)
|
||||||
@@ -170,7 +169,6 @@ private:
|
|||||||
int my_rank_;
|
int my_rank_;
|
||||||
const Mapper& globalMapper_;
|
const Mapper& globalMapper_;
|
||||||
std::vector<int>& globalData_;
|
std::vector<int>& globalData_;
|
||||||
const std::vector<int>& globalCell_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if HAVE_OPM_GRID && HAVE_MPI
|
#if HAVE_OPM_GRID && HAVE_MPI
|
||||||
|
|||||||
Reference in New Issue
Block a user