Skip to content

Commit 3e5f28f

Browse files
committed
Fix empty pointMapping_ when synchrCellIds in adapt() calls
1 parent f71b3f5 commit 3e5f28f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

opm/grid/cpgrid/CpGrid.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,15 +2700,17 @@ void CpGrid::syncDistributedGlobalCellIds()
27002700

27012701
const int maxLevel = this->maxLevel();
27022702

2703-
// Preallocate syncCellIds
2703+
// Preallocate syncCellIds (and vertexIds, which will NOT be synchrinized)
27042704
std::vector<std::vector<int>> syncCellIds(maxLevel);
2705+
std::vector<std::vector<int>> vertexIds(maxLevel);
27052706
for (int level = 1; level <= maxLevel; ++level) {
27062707
syncCellIds[level-1].resize(currentData()[level]->size(0));
2708+
vertexIds[level-1].resize(currentData()[level]->size(3));
27072709
}
27082710

27092711
const auto& globalIdSet = this->globalIdSet();
27102712

2711-
// Populate for interior cells
2713+
// Populate syncCellIds and vertexIds
27122714
for (int level = 1; level <= maxLevel; ++level) {
27132715
const auto& elements = Dune::elements(levelGridView(level));
27142716
for (const auto& element : elements) {
@@ -2719,16 +2721,19 @@ void CpGrid::syncDistributedGlobalCellIds()
27192721

27202722
syncCellIds[element.level()-1][element.index()] = new_elem_globalId;
27212723
}
2724+
2725+
for (const auto& vertex : Dune::vertices(levelGridView(level))){
2726+
vertexIds[level-1][vertex.index()] = globalIdSet.id(vertex);
2727+
}
27222728
}
27232729

27242730
// Re-assign new cell global ids for all refined level grids
27252731
std::vector<int> faceIds; // empty for all
27262732
for (int level = 1; level <= maxLevel; ++level) {
27272733
if(currentData()[level]->size(0)) { // Check if LGR is active in currect process.
2728-
auto vertexIds = currentData()[level]->global_id_set_-> getMapping<3>();
27292734
currentData()[level]->global_id_set_->swap(syncCellIds[level-1],
27302735
faceIds,
2731-
vertexIds);
2736+
vertexIds[level-1]);
27322737

27332738
populateCellIndexSetRefinedGrid(level);
27342739
// Insert the new id sets into the grid global_id_set_ptr_

0 commit comments

Comments
 (0)