Skip to content

Fix balance#368

Open
hannesbrandt wants to merge 23 commits into
cburstedde:developfrom
hannesbrandt:fix-balance
Open

Fix balance#368
hannesbrandt wants to merge 23 commits into
cburstedde:developfrom
hannesbrandt:fix-balance

Conversation

@hannesbrandt

Copy link
Copy Markdown
Collaborator

Following up on issue #238 and #319 . As discussed in #238, balance (and ghost) use face-only tree connections when creating the borders array at some places independent of the btype. This leads to unbalanced results of p4est_balance, e.g. for trees that are connected only by edge/corner.
In this PR p4est_comm_neighborhood_owned is changed such that all quadrants touching the tree boundary are added to the borders array even if there is no neighboring tree and the function is renamed to p4est_comm_is_boundary.

The face-only tree connections are also used to identify isolated trees. Therefore, in a connectivity of two trees connected by a single edge or corner both would erroneously be identified as isolated and skipped. To address this skipping of isolated trees was removed. Also, this PR adds a new connectivity edge_corner, which is used to test balance in the mentioned corner cases. It contains three trees with one edge and one corner connection between them.

The described fixes come with a performance regression ranging from 0%-20% according to our tests. This is most likely due to the borders array, which increases in size by the less strict version of p4est_comm_neighborhood_owned . The second fix (no longer skipping isolated trees) should only have an impact on rare connectivites with a high percentage of isolated trees.

Proposed changes:

  • Fix corner cases in balance and ghost.
  • Rename p4est_comm_neighborhood_owned to p4est_comm_is_boundary .
  • Accept all tree boundary quadrants in p4est_comm_is_boundary and switch return values to better fit the new name.
  • Add a new 3d connectivity edge_corner of trees connected only across edges and corners.
  • Add unit tests for balancing purely edge- or corner-connected trees.

@tisaac

cburstedde and others added 23 commits September 7, 2023 15:36
In balance neighborhood_owned skips tree boundary quadrants that
are critical for balancing because they intersect the insulation layer
of quadrants in edge-neighboring trees. Therefore,
neighborhood_boundary_owned is introduced as a function that
determines always the full tree boundary if the tree is fully owned.
This means that in tree_compute_overlap more quadrants than necessary
are considered but this ensures correct results (cf. simple3 example drop).
@hannesbrandt

Copy link
Copy Markdown
Collaborator Author

The described fixes come with a performance regression ranging from 0%-20% according to our tests. This is most likely due to the borders array, which increases in size by the less strict version of p4est_comm_neighborhood_owned . The second fix (no longer skipping isolated trees) should only have an impact on rare connectivites with a high percentage of isolated trees.

Of course, we could avoid this regression by checking for face, edge and corner tree connections depending on the btype at the relevant places (cf. #101).

@cburstedde

cburstedde commented Jul 6, 2026 via email

Copy link
Copy Markdown
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants