Skip to content
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

Small Bugfix: Remove shared_ptr cycle in Tree #1112

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- [[PR 1004]](https://github.com/parthenon-hpc-lab/parthenon/pull/1004) Allow parameter modification from an input file for restarts

### Fixed (not changing behavior/API/variables/...)
- [[PR 1112]](https://github.com/parthenon-hpc-lab/parthenon/pull/1112) Remove shared_ptr cycle in forest::Tree
- [[PR 1104]](https://github.com/parthenon-hpc-lab/parthenon/pull/1104) Fix reading restarts due to hidden ghost var
- [[PR 1098]](https://github.com/parthenon-hpc-lab/parthenon/pull/1098) Move to symmetrized logical coordinates and fix SMR bug
- [[PR 1095]](https://github.com/parthenon-hpc-lab/parthenon/pull/1095) Add missing include guards in hdf5 restart
Expand Down
2 changes: 1 addition & 1 deletion src/mesh/forest/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ Tree::GetBlockBCs(const LogicalLocation &loc) const {
void Tree::AddNeighborTree(CellCentOffsets offset, std::shared_ptr<Tree> neighbor_tree,
RelativeOrientation orient, const bool periodic) {
int location_idx = offset.GetIdx();
neighbors[location_idx].insert({neighbor_tree, orient});
neighbors[location_idx].insert({neighbor_tree.get(), orient});
BoundaryFace fidx = offset.Face();

if (fidx >= 0)
Expand Down
5 changes: 2 additions & 3 deletions src/mesh/forest/tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Tree : public std::enable_shared_from_this<Tree> {
RelativeOrientation orient;
orient.use_offset = true;
orient.offset = {0, 0, 0};
ptree->neighbors[13].insert({ptree, orient});
ptree->neighbors[13].insert({ptree.get(), orient});
return ptree;
}

Expand Down Expand Up @@ -117,8 +117,7 @@ class Tree : public std::enable_shared_from_this<Tree> {
// multiple neighbors generally, we keep a map at each neighbor location from
// the tree sptr to the relative logical coordinate orientation of the neighbor
// block.
std::array<std::unordered_map<std::shared_ptr<Tree>, RelativeOrientation>, 27>
neighbors;
std::array<std::unordered_map<Tree *, RelativeOrientation>, 27> neighbors;

std::array<BoundaryFlag, BOUNDARY_NFACES> boundary_conditions;

Expand Down
Loading