Skip to content

Commit

Permalink
Merge pull request #293 from tim-griesbach/feature-local-max-patches
Browse files Browse the repository at this point in the history
Introduce `local_max_patches` in domain
  • Loading branch information
scottaiton authored Dec 18, 2023
2 parents 81ada44 + 93a2b9a commit 517010f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/fclaw2d_convenience.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ fclaw2d_domain_new (p4est_wrap_t * wrap, sc_keyvalue_t * attributes)
int nb, nm, mirror_quadrant_num;
int block_nm_pre;
int local_num_patches;
int current_local_num_patches;
int tree_minlevel, local_minlevel;
int tree_maxlevel, local_maxlevel;
int levels[2], global_levels[2];
Expand Down Expand Up @@ -276,6 +277,18 @@ fclaw2d_domain_new (p4est_wrap_t * wrap, sc_keyvalue_t * attributes)
domain->local_minlevel = local_minlevel;
domain->local_maxlevel = local_maxlevel;

/* determine maximum number of local patches */
domain->local_max_patches = 0;
for (i = 0; i < wrap->p4est->mpisize; ++i)
{
current_local_num_patches = (int)
(wrap->p4est->global_first_quadrant[i + 1] -
wrap->p4est->global_first_quadrant[i]);

domain->local_max_patches = SC_MAX (domain->local_max_patches,
current_local_num_patches);
}

/* allocate ghost patches */
domain->ghost_patches =
FCLAW_ALLOC_ZERO (fclaw2d_patch_t, domain->num_ghost_patches);
Expand Down
1 change: 1 addition & 0 deletions src/forestclaw2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ struct fclaw2d_domain
one domain to a derived one. */

int local_num_patches; /**< sum of patches over all blocks on this proc */
int local_max_patches; /**< maximum over all procs of local_num_patches */
/** @{ */
/** Local to proc. If this proc doesn't
store any patches at all, we set
Expand Down
1 change: 1 addition & 0 deletions src/forestclaw3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ struct fclaw3d_domain
one domain to a derived one. */

int local_num_patches; /**< sum of patches over all blocks on this proc */
int local_max_patches; /**< maximum over all procs of local_num_patches */
/** @{ */
/** Local to proc. If this proc doesn't
store any patches at all, we set
Expand Down

0 comments on commit 517010f

Please sign in to comment.