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

Newly adapted quadrants in wrap #310

Merged
merged 13 commits into from
Jul 11, 2024

Conversation

hannesbrandt
Copy link
Collaborator

This PR adds two arrays newly_refined and newly_coarsened to the p4est_wrap_t. The arrays store the local quadrant indices of quadrants that were refined or coarsened during the most recent call to p4est_wrap_adapt. For refinement, only the index of the quadrant with child id 0 is stored. The arrays are not updated during other function calls like p4est_wrap_partition. So, they always index into the local quadrants of the p4est as it was right after adaptation.

The arrays are only initalized and set, if the new wrap parameter store_adapted is set to true. Furthermore, we assert that the wrap's p4est is balanced before the adaptation, which ensures a single level of refinement.

@cburstedde
Copy link
Owner

Cool; would we want to delete the arrays once they no longer match the p4est (e. g. due to partition)?

@hannesbrandt
Copy link
Collaborator Author

The arrays may still be of value even after partitioning, e.g. when organizing communication of quadrant-related user data after a call of partition. This is for example planned for our upcoming partitioning strategies in forestclaw.

@hannesbrandt
Copy link
Collaborator Author

I have changed the allocation of the arrays. newly_refined and newly_coarsened are now allocated in wrap_adapt, instead of in wrap_new. As a consequence, p4est_wrap_set_store_adapted would now merely change the value of the corresponding wrap parameter, so I removed it. We could remove p4est_wrap_set_partitioning as well, since it just changes the partition_for_coarsening parameter.

@cburstedde
Copy link
Owner

I have changed the allocation of the arrays. newly_refined and newly_coarsened are now allocated in wrap_adapt, instead of in wrap_new. As a consequence, p4est_wrap_set_store_adapted would now merely change the value of the corresponding wrap parameter, so I removed it. We could remove p4est_wrap_set_partitioning as well, since it just changes the partition_for_coarsening parameter.

Sounds good! Please make sure to delete their translations from p4est_to_p8est.h.

src/p4est_wrap.h Outdated Show resolved Hide resolved
src/p4est_wrap.c Outdated Show resolved Hide resolved
@cburstedde
Copy link
Owner

Looks good; thanks!

@cburstedde cburstedde merged commit 9e2f619 into cburstedde:develop Jul 11, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants