Closed hannesbrandt closed 2 months ago
Cool; would we want to delete the arrays once they no longer match the p4est (e. g. due to partition)?
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.
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.
I have changed the allocation of the arrays.
newly_refined
andnewly_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 removep4est_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.
Looks good; thanks!
This PR adds two arrays
newly_refined
andnewly_coarsened
to thep4est_wrap_t
. The arrays store the local quadrant indices of quadrants that were refined or coarsened during the most recent call top4est_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 likep4est_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.