Skip to content

Commit

Permalink
feature wrap-partition: store old gfq in wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbrandt committed May 14, 2024
1 parent 7896878 commit 6baf638
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/p4est_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,9 +822,11 @@ p4est_wrap_partition (p4est_wrap_t * pp, int weight_exponent,
p4est_ghost_destroy (pp->ghost);
pp->match_aux = 0;

/* Remember the window onto global quadrant sequence before partition */
pre_me = pp->p4est->global_first_quadrant[pp->p4est->mpirank];
pre_next = pp->p4est->global_first_quadrant[pp->p4est->mpirank + 1];
/* Remember the global first quadrants before partition */
pp->old_global_first_quadrant =
P4EST_ALLOC (p4est_gloidx_t, pp->p4est->mpisize + 1);
memcpy (pp->old_global_first_quadrant, pp->p4est->global_first_quadrant,
sizeof (p4est_gloidx_t) * (pp->p4est->mpisize + 1));

/* Initialize output for the case that the partition does not change */
if (unchanged_first != NULL) {
Expand Down Expand Up @@ -858,6 +860,8 @@ p4est_wrap_partition (p4est_wrap_t * pp, int weight_exponent,
unchanged_old_first != NULL) {

/* compute new windof of local quadrants */
pre_me = pp->old_global_first_quadrant[pp->p4est->mpirank];
pre_next = pp->old_global_first_quadrant[pp->p4est->mpirank + 1];
post_me = pp->p4est->global_first_quadrant[pp->p4est->mpirank];
post_next = pp->p4est->global_first_quadrant[pp->p4est->mpirank + 1];

Expand All @@ -874,6 +878,8 @@ p4est_wrap_partition (p4est_wrap_t * pp, int weight_exponent,
pp->mesh = pp->mesh_aux;
pp->ghost_aux = NULL;
pp->mesh_aux = NULL;
P4EST_FREE (pp->old_global_first_quadrant);
pp->old_global_first_quadrant = NULL;
}

return changed;
Expand All @@ -889,11 +895,14 @@ p4est_wrap_complete (p4est_wrap_t * pp)
P4EST_ASSERT (pp->ghost_aux != NULL);
P4EST_ASSERT (pp->mesh_aux != NULL);
P4EST_ASSERT (pp->match_aux == 0);
P4EST_ASSERT (pp->old_global_first_quadrant != NULL);

p4est_mesh_destroy (pp->mesh_aux);
p4est_ghost_destroy (pp->ghost_aux);
pp->ghost_aux = NULL;
pp->mesh_aux = NULL;
P4EST_FREE (pp->old_global_first_quadrant);
pp->old_global_first_quadrant = NULL;
}

static p4est_wrap_leaf_t *
Expand Down
1 change: 1 addition & 0 deletions src/p4est_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ typedef struct p4est_wrap
int weight_exponent;
uint8_t *flags, *temp_flags;
p4est_locidx_t num_refine_flags, inside_counter, num_replaced;
p4est_gloidx_t *old_global_first_quadrant;

/* for ghost and mesh use p4est_wrap_get_ghost, _mesh declared below */
p4est_ghost_t *ghost;
Expand Down
1 change: 1 addition & 0 deletions src/p8est_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ typedef struct p8est_wrap
int weight_exponent;
uint8_t *flags, *temp_flags;
p4est_locidx_t num_refine_flags, inside_counter, num_replaced;
p4est_gloidx_t *old_global_first_quadrant;

/* for ghost and mesh use p8est_wrap_get_ghost, _mesh declared below */
p8est_ghost_t *ghost;
Expand Down

0 comments on commit 6baf638

Please sign in to comment.