Skip to content

Fix voloctree mapper #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions src/voloctree/voloctree_mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,8 +1444,8 @@ void VolOctreeMapper::_communicateInverseMapperBack()
toRanks.insert(mappingEntry.first);

const std::unordered_map<long, mapping::Info> &inverseMappingInfo = m_partitionIR.map_rank_inverseMapping[mappingEntry.first];
for (const auto &mappingEntry : inverseMappingInfo) {
toRankId[mappingEntry.first].push_back(mappingEntry.first);
for (const auto &submappingEntry : inverseMappingInfo) {
toRankId[mappingEntry.first].push_back(submappingEntry.first);
}
}

Expand Down Expand Up @@ -1507,6 +1507,27 @@ void VolOctreeMapper::_communicateInverseMapperBack()
mapping::Info &info = m_inverseMapping[id];
info.type = mapping::Type(type);
info.entity = mapping::Entity(entity);

// Keep only local mapping
//
// If partition is changed the mapping is always recomputed and not
// updated.
//
// Remove old ids and ranks that don't belong to this partition.
auto idsIter = info.ids.begin();
auto ranksIter = info.ranks.begin();
while (idsIter != info.ids.end()) {
int rank = *ranksIter;
if (rank != m_mappedPatch->getRank()) {
idsIter = info.ids.erase(idsIter);
ranksIter = info.ranks.erase(ranksIter);
} else {
idsIter++;
ranksIter++;
}
}

// Add received ids and ranks
int nmap;
recvBuffer >> nmap;
for (int j=0; j<nmap; j++) {
Expand Down