Merge pull request #1339 from blattms/write-ranks-without-nonactive

Disregard non-active cells when writing MPI_RANK in writeInitial.
This commit is contained in:
Atgeirr Flø Rasmussen authored and GitHub committed 2017-11-27 07:22:34 +01:00
commit f62275cb06
2 files changed
+5 -9

No files matched your search

+2 -4
View File
@@ -813,11 +813,9 @@ namespace Opm
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>;
using Handle = CellOwnerDataHandle<ElementMapper>;
ElementMapper globalMapper(this->globalGrid().leafGridView());
const auto* dims = UgGridHelpers::cartDims(grid());
const auto globalSize = dims[0]*dims[1]*dims[2];
const auto globalSize = this->globalGrid().size(0);
std::vector<int> ranks(globalSize, -1);
Handle handle(globalMapper, ranks,
this->globalGrid().globalCell());
Handle handle(globalMapper, ranks);
this->grid().gatherData(handle);
integerVectors.emplace("MPI_RANK", ranks);
}
+3 -5
View File
@@ -126,9 +126,8 @@ class CellOwnerDataHandle
public:
using DataType = int;
CellOwnerDataHandle(const Mapper& globalMapper, std::vector<int>& globalData,
const std::vector<int>& globalCell)
: globalMapper_(globalMapper), globalData_(globalData), globalCell_(globalCell)
CellOwnerDataHandle(const Mapper& globalMapper, std::vector<int>& globalData)
: globalMapper_(globalMapper), globalData_(globalData)
{
int argc = 0;
char** argv = nullptr;
@@ -158,7 +157,7 @@ public:
template<class B, class T>
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]);
}
bool contains(int dim, int codim)
@@ -170,7 +169,6 @@ private:
int my_rank_;
const Mapper& globalMapper_;
std::vector<int>& globalData_;
const std::vector<int>& globalCell_;
};
#if HAVE_OPM_GRID && HAVE_MPI