Skip to content

Commit

Permalink
voloctree: move vector declarations outside loop to reduce reallocations
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-iob committed Sep 26, 2020
1 parent 8c556fe commit 0349ac3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/voloctree/voloctree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,11 +995,14 @@ std::vector<adaption::Info> VolOctree::sync(bool trackChanges)
}

uint32_t treeId = 0;
std::vector<uint32_t> mapper_octantMap;
std::vector<bool> mapper_ghostFlag;
std::vector<int> mapper_octantRank;
while (treeId < (uint32_t) nOctants) {
// Octant mapping
std::vector<uint32_t> mapper_octantMap;
std::vector<bool> mapper_ghostFlag;
std::vector<int> mapper_octantRank;
mapper_octantMap.clear();
mapper_ghostFlag.clear();
mapper_octantRank.clear();
if (!importFromScratch) {
m_tree->getMapping(treeId, mapper_octantMap, mapper_ghostFlag, mapper_octantRank);
}
Expand Down

0 comments on commit 0349ac3

Please sign in to comment.