Skip to content

Commit

Permalink
feature partitioning: add partition_for_coarsening option
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbrandt committed Feb 7, 2024
1 parent 388c6a6 commit 819f63d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/fclaw2d_to_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define fclaw2d_patch_transform_corner fclaw3d_patch_transform_corner
#define fclaw2d_patch_transform_corner2 fclaw3d_patch_transform_corner2
#define fclaw2d_domain_set_refinement fclaw3d_domain_set_refinement
#define fclaw2d_domain_set_partitioning fclaw3d_domain_set_partitioning
#define fclaw2d_patch_mark_refine fclaw3d_patch_mark_refine
#define fclaw2d_patch_mark_coarsen fclaw3d_patch_mark_coarsen
#define fclaw2d_domain_iterate_adapted fclaw3d_domain_iterate_adapted
Expand Down
9 changes: 9 additions & 0 deletions src/forestclaw2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,15 @@ fclaw2d_domain_set_refinement (fclaw2d_domain_t * domain,
p4est_wrap_set_coarsen_delay (wrap, coarsen_delay, 0);
}

void
fclaw2d_domain_set_partitioning (fclaw2d_domain_t * domain,
int partition_for_coarsening)
{
p4est_wrap_t *wrap = (p4est_wrap_t *) domain->pp;

p4est_wrap_set_partitioning (wrap, partition_for_coarsening);
}

void
fclaw2d_patch_mark_refine (fclaw2d_domain_t * domain, int blockno,
int patchno)
Expand Down
12 changes: 12 additions & 0 deletions src/forestclaw2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,18 @@ void fclaw2d_domain_set_refinement (fclaw2d_domain_t * domain,
int smooth_refine, int smooth_level,
int coarsen_delay);

/** Set parameters of partitioning strategy in a domain.
* This function only needs to be called once, and only for the first domain
* created in the program. The values of the parameters are automatically
* transferred on adaptation and partitioning.
* \param [in,out] domain This domain's partitioning strategy is set.
* \param [in] partition_for_coarsening Boolean: If true, all future partitions
* of the domain allow one level of coarsening.
* Suggested default: 1.
*/
void fclaw2d_domain_set_partitioning (fclaw2d_domain_t * domain,
int partition_for_coarsening);

/** Mark a patch for refinement.
* This must ONLY be called for local patches.
* It is safe to call this function from an iterator callback except
Expand Down
12 changes: 12 additions & 0 deletions src/forestclaw3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,18 @@ void fclaw3d_domain_set_refinement (fclaw3d_domain_t * domain,
int smooth_refine, int smooth_level,
int coarsen_delay);

/** Set parameters of partitioning strategy in a domain.
* This function only needs to be called once, and only for the first domain
* created in the program. The values of the parameters are automatically
* transferred on adaptation and partitioning.
* \param [in,out] domain This domain's partitioning strategy is set.
* \param [in] partition_for_coarsening Boolean: If true, all future partitions
* of the domain allow one level of coarsening.
* Suggested default: 1.
*/
void fclaw3d_domain_set_partitioning (fclaw3d_domain_t * domain,
int partition_for_coarsening);

/** Mark a patch for refinement.
* This must ONLY be called for local patches.
* It is safe to call this function from an iterator callback except
Expand Down

0 comments on commit 819f63d

Please sign in to comment.