-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
voloctree: split mapped octant list build loop to make it more readable
The split separates the loop in a first loop to find the first overlapping rank of the reference mesh and the first overlapping octant of the mapped mesh. A second loop fill the octant lists starting from data retrieved in the previous one. This version of the algorithm should be safe, avoiding evaluation of morton number of non-existing octants and giving empty lists if no overlap occurs.
- Loading branch information
1 parent
b59ef91
commit c279845
Showing
1 changed file
with
40 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1232,41 +1232,52 @@ bool VolOctreeMapper::_recoverPartition() | |
std::map<int, std::vector<Octant>> list_octant; | ||
std::map<int, std::vector<long>> list_id; | ||
std::map<int, std::vector<long>> list_globalId; | ||
uint32_t idx = 0; | ||
for (int reference_rank : toreference_rank[m_rank]) { | ||
|
||
// Initialize idx position in mapped tree to the first mapped | ||
// octant inside the overlapping region | ||
std::vector<int>::iterator overlap_ref_rank_end_it = toreference_rank[m_rank].end(); | ||
std::vector<int>::iterator first_overlap_rank_it = overlap_ref_rank_end_it; | ||
uint32_t first_overlap_map_idx = 0; | ||
for (std::vector<int>::iterator ref_rank_it = toreference_rank[m_rank].begin(); ref_rank_it != overlap_ref_rank_end_it; ++ref_rank_it) { | ||
first_overlap_map_idx = 0; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
marcocisternino
Author
Member
|
||
int reference_rank = *ref_rank_it; | ||
uint64_t reference_first_morton = partitionFDReference[reference_rank]; | ||
uint64_t reference_last_morton = partitionLDReference[reference_rank]; | ||
// Initialize idx position in mapped tree to the first mapped | ||
// octant inside the overlapping region | ||
uint64_t morton = mappedPatch->getTree().getLastDescMorton(idx); | ||
uint64_t morton = mappedPatch->getTree().getLastDescMorton(first_overlap_map_idx); | ||
while (morton < reference_first_morton) { | ||
idx++; | ||
if (idx == mappedPatch->getTree().getNumOctants()) { | ||
first_overlap_map_idx++; | ||
if (first_overlap_map_idx == mappedPatch->getTree().getNumOctants()) { | ||
break; | ||
} | ||
morton = mappedPatch->getTree().getLastDescMorton(idx); | ||
morton = mappedPatch->getTree().getLastDescMorton(first_overlap_map_idx); | ||
} | ||
if (idx == mappedPatch->getTree().getNumOctants()) { | ||
continue; | ||
} | ||
// Fill partitioning info structure with mapped octants in the | ||
// overlapping region | ||
morton = mappedPatch->getTree().getMorton(idx); | ||
while (morton < reference_last_morton) { | ||
Octant oct = *mappedPatch->getTree().getOctant(idx); | ||
list_octant[reference_rank].push_back(oct); | ||
VolOctree::OctantInfo octantIfo(idx, true); | ||
long id = mappedPatch->getOctantId(octantIfo); | ||
list_id[reference_rank].push_back(id); | ||
long globalId = mappedPatch->getTree().getGlobalIdx(idx); | ||
list_globalId[reference_rank].push_back(globalId); | ||
m_partitionIR.list_sent_octantIR.emplace_back(oct, id, globalId, reference_rank); | ||
idx++; | ||
if (idx == mappedPatch->getTree().getNumOctants()) { | ||
--idx; | ||
break; | ||
first_overlap_rank_it = ref_rank_it; | ||
} | ||
|
||
// Fill partitioning info structure with mapped octants in the | ||
// overlapping region | ||
if (first_overlap_map_idx < mappedPatch->getTree().getNumOctants() ) { | ||
uint32_t idx = first_overlap_map_idx; | ||
bool exitLoop = false; | ||
for (std::vector<int>::iterator ref_rank_it = first_overlap_rank_it; ref_rank_it != overlap_ref_rank_end_it && !exitLoop; ++ref_rank_it) { | ||
int reference_rank = *ref_rank_it; | ||
uint64_t reference_last_morton = partitionLDReference[reference_rank]; | ||
uint64_t morton = mappedPatch->getTree().getMorton(idx); | ||
while (morton < reference_last_morton) { | ||
Octant oct = *mappedPatch->getTree().getOctant(idx); | ||
list_octant[reference_rank].push_back(oct); | ||
VolOctree::OctantInfo octantIfo(idx, true); | ||
long id = mappedPatch->getOctantId(octantIfo); | ||
list_id[reference_rank].push_back(id); | ||
long globalId = mappedPatch->getTree().getGlobalIdx(idx); | ||
list_globalId[reference_rank].push_back(globalId); | ||
m_partitionIR.list_sent_octantIR.emplace_back(oct, id, globalId, reference_rank); | ||
idx++; | ||
if (idx == mappedPatch->getTree().getNumOctants()) { | ||
exitLoop = true; | ||
break; | ||
} | ||
morton = mappedPatch->getTree().getMorton(idx); | ||
} | ||
morton = mappedPatch->getTree().getMorton(idx); | ||
} | ||
} | ||
|
||
|
Was the previous algorithm resetting first_overlap_map_idx (idx) for every rank?