Skip to content

Commit

Permalink
Merge pull request ForestClaw#359 from hannesbrandt/feature-partition
Browse files Browse the repository at this point in the history
Partitioning strategies: skip refined
  • Loading branch information
scottaiton authored Aug 28, 2024
2 parents f9ba912 + fe4ba75 commit 10aee81
Show file tree
Hide file tree
Showing 8 changed files with 634 additions and 159 deletions.
300 changes: 262 additions & 38 deletions applications/demo/2d/partitioning/partitioning.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/fclaw2d_convenience.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ fclaw2d_domain_new (p4est_wrap_t * wrap, sc_keyvalue_t * attributes)
local_minlevel = domain->possible_maxlevel;
local_maxlevel = -1;
domain->p.skip_local = 1;
domain->p.skip_refined = 0;

/* prepare propagation of refinement/coarsening marks */
domain->p.smooth_refine = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/fclaw_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ void fclaw_initialize_domain_flags(fclaw_global_t *glob)
fclaw_opt->coarsen_delay);

/* set partitioning */
fclaw_domain_set_partitioning(glob->domain, fclaw_opt->partition_for_coarsening, 1);
fclaw_domain_set_partitioning (glob->domain,
fclaw_opt->partition_for_coarsening, 1, 0);
}

static void
Expand Down
6 changes: 3 additions & 3 deletions src/forestclaw.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,15 +698,15 @@ fclaw_domain_set_refinement (fclaw_domain_t * domain,
}

void
fclaw_domain_set_partitioning(fclaw_domain_t *domain, int partition_for_coarsening, int skip_local)
fclaw_domain_set_partitioning(fclaw_domain_t *domain, int partition_for_coarsening, int skip_local, int skip_refined)
{
if(domain->refine_dim == 2)
{
fclaw2d_domain_set_partitioning(domain->d2,partition_for_coarsening, skip_local);
fclaw2d_domain_set_partitioning(domain->d2,partition_for_coarsening, skip_local, skip_refined);
}
else if (domain->refine_dim == 3)
{
fclaw3d_domain_set_partitioning(domain->d3,partition_for_coarsening, skip_local);
fclaw3d_domain_set_partitioning(domain->d3,partition_for_coarsening, skip_local, skip_refined);
}
else
{
Expand Down
15 changes: 14 additions & 1 deletion src/forestclaw.h
Original file line number Diff line number Diff line change
Expand Up @@ -866,10 +866,23 @@ void fclaw_domain_set_refinement (fclaw_domain_t * domain,
* \param [in] skip_local Boolean: If true, the patch data of patches that
* stay local are not packed during partitioning.
* Suggested default: 1.
* \param [in] skip_refined Boolean: If true, the patch data of patches that
* were refined during the most recent call to
* \ref fclaw_domain_adapt is only packed for the
* patches with child id 0 in
* fclaw_domain_iterate_pack. The unpack
* callback in fclaw_domain_iterate_unpack
* will be invoked for all children of a recently
* refined patch. The provided data will be the
* data packed by the patch with child id 0.
* For this partitioning method to work as desired,
* skip_refined has to be set \b before the most
* recent call to \ref fclaw_domain_adapt .
* Suggested default: 0.
*/
void fclaw_domain_set_partitioning (fclaw_domain_t * domain,
int partition_for_coarsening,
int skip_local);
int skip_local, int skip_refined);

/** Mark a patch for refinement.
* This must ONLY be called for local patches.
Expand Down
Loading

0 comments on commit 10aee81

Please sign in to comment.