Skip to content

Commit

Permalink
feature-wrap-partition: assert p4est is balanced
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbrandt committed Jul 1, 2024
1 parent aed0225 commit 0613bf0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/p4est_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ p4est_wrap_adapt (p4est_wrap_t * pp)

quad_levels = sc_array_new (sizeof (int8_t));
if (pp->params.store_adapted) {
P4EST_ASSERT (p4est_is_balanced (pp->p4est, pp->params.mesh_params.btype));

/* store p4est levels to compare with future adapted version */
sc_array_resize (quad_levels, p4est->local_num_quadrants);

Expand Down
15 changes: 8 additions & 7 deletions src/p4est_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ typedef struct p4est_wrap
int p4est_children;
p4est_t *p4est; /**< p4est->user_pointer is used internally */

/* These arrays are initialized during wrap creation, if \a params.store_adapted
* evaluates to true and contain the indices of the quadrants refined during
* the last call to \ref p4est_wrap_adapt.
* At every time they index into the local quadrants of the p4est as it was
* directly after completion of \ref p4est_wrap_adapt. So, they are not
/* If \a params.store_adapted is true, these arrays store the indices of the
* quadrants refined and coarsened during the last call to
* \ref p4est_wrap_adapt. The wrap's \a p4est has to be balanced when entering
* the adaptation, to avoid multi-level refinement.
* At every time the arrays index into the local quadrants of the p4est as it
* was directly after completion of \ref p4est_wrap_adapt. So, they are not
* updated in \ref p4est_wrap_partition. Newly_refined only stores newly
* refined quadrants with child id 0. */
sc_array_t *newly_refined, *newly_coarsened;
Expand Down Expand Up @@ -317,8 +318,8 @@ void p4est_wrap_set_partitioning (p4est_wrap_t *pp,

/** Set a parameter that stores indices of newly adapted quadrants.
* If positive, the local quadrant indices of all quadrants refined or coarsened
* during the last call to \ref p4est_wrap_adapt are stored in \a newly_refined
* and \a newly_coarsened.
* during the last call to \ref p4est_wrap_adapt (on entry the wrap's p8est has
* to be balanced) are stored in \a newly_refined and \a newly_coarsened.
* \param [in,out] pp A valid p4est_wrap structure.
* \param [in] store_adapted Boolean: If true, the indices of newly adapted
* quadrants are stored in future adaptations.
Expand Down
17 changes: 9 additions & 8 deletions src/p8est_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,13 @@ typedef struct p8est_wrap
int p4est_children;
p8est_t *p4est; /**< p4est->user_pointer is used internally */

/* These arrays are initialized during wrap creation, if \a params.store_adapted
* evaluates to true and contain the indices of the quadrants refined during
* the last call to \ref p4est_wrap_adapt.
* At every time they index into the local quadrants of the p4est as it was
* directly after completion of \ref p4est_wrap_adapt. So, they are not
* updated in \ref p4est_wrap_partition. Newly_refined only stores newly
/* If \a params.store_adapted is true, these arrays store the indices of the
* quadrants refined and coarsened during the last call to
* \ref p8est_wrap_adapt. The wrap's \a p4est has to be balanced when entering
* the adaptation, to avoid multi-level refinement.
* At every time the arrays index into the local quadrants of the p8est as it
* was directly after completion of \ref p8est_wrap_adapt. So, they are not
* updated in \ref p8est_wrap_partition. Newly_refined only stores newly
* refined quadrants with child id 0. */
sc_array_t *newly_refined, *newly_coarsened;

Expand Down Expand Up @@ -302,8 +303,8 @@ void p8est_wrap_set_partitioning (p8est_wrap_t *pp,

/** Set a parameter that stores indices of newly adapted quadrants.
* If positive, the local quadrant indices of all quadrants refined or coarsened
* during the last call to \ref p8est_wrap_adapt are stored in \a newly_refined
* and \a newly_coarsened.
* during the last call to \ref p8est_wrap_adapt (on entry the wrap's p8est has
* to be balanced) are stored in \a newly_refined and \a newly_coarsened.
* \param [in,out] pp A valid p4est_wrap structure.
* \param [in] store_adapted Boolean: If true, the indices of newly adapted
* quadrants are stored in future adaptations.
Expand Down

0 comments on commit 0613bf0

Please sign in to comment.