From f6e4d897f30ed373b4790e7bd40acde2530833fc Mon Sep 17 00:00:00 2001 From: Hannes Brandt Date: Thu, 25 Jan 2024 18:59:29 +0100 Subject: [PATCH] feature-pfc: add partition_for_coarsening to wrap_params --- src/p4est_wrap.c | 6 ++++-- src/p4est_wrap.h | 4 ++++ src/p8est_wrap.h | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/p4est_wrap.c b/src/p4est_wrap.c index 77cca2a33..170fd0de4 100644 --- a/src/p4est_wrap.c +++ b/src/p4est_wrap.c @@ -181,6 +181,7 @@ p4est_wrap_params_init (p4est_wrap_params_t *params) params->replace_fn = NULL; params->coarsen_delay = 0; params->coarsen_affect = 0; + params->partition_for_coarsening = 1; params->user_pointer = NULL; } @@ -299,6 +300,8 @@ p4est_wrap_new_copy (p4est_wrap_t * source, size_t data_size, pp = P4EST_ALLOC_ZERO (p4est_wrap_t, 1); + /* copy the sources wrap paramters; however the copy will is hollow */ + pp->params = source->params; pp->params.hollow = 1; sc_refcount_init_invalid (&pp->conn_rc); @@ -310,7 +313,6 @@ p4est_wrap_new_copy (p4est_wrap_t * source, size_t data_size, pp->p4est_half = P4EST_HALF; pp->p4est_faces = P4EST_FACES; pp->p4est_children = P4EST_CHILDREN; - pp->params.mesh_params.btype = source->params.mesh_params.btype; pp->params.replace_fn = replace_fn; pp->p4est = p4est_copy (source->p4est, 0); if (data_size > 0) { @@ -811,7 +813,7 @@ p4est_wrap_partition (p4est_wrap_t * pp, int weight_exponent, P4EST_ASSERT (weight_exponent == 0 || weight_exponent == 1); pp->weight_exponent = weight_exponent; changed = - p4est_partition_ext (pp->p4est, 1, + p4est_partition_ext (pp->p4est, pp->params.partition_for_coarsening, weight_exponent ? partition_weight : NULL) > 0; if (changed) { diff --git a/src/p4est_wrap.h b/src/p4est_wrap.h index 970bbef55..07a80b2d9 100644 --- a/src/p4est_wrap.h +++ b/src/p4est_wrap.h @@ -71,6 +71,10 @@ typedef struct coarsening not only after refinement, but also between subsequent coarsenings of the same quadrant. */ + int partition_for_coarsening; /**< If true, the partition is + modified to allow one level + of coarsening when calling + \ref p4est_wrap_partition. */ void *user_pointer; /**< Set the user pointer in \ref p4est_wrap_t. Subsequently, we will never access it. */ diff --git a/src/p8est_wrap.h b/src/p8est_wrap.h index 93f021820..0e9a01e4b 100644 --- a/src/p8est_wrap.h +++ b/src/p8est_wrap.h @@ -71,6 +71,10 @@ typedef struct coarsening not only after refinement, but also between subsequent coarsenings of the same quadrant. */ + int partition_for_coarsening; /**< If true, the partition is + modified to allow one level + of coarsening when calling + \ref p8est_wrap_partition. */ void *user_pointer; /**< Set the user pointer in \ref p8est_wrap_t. Subsequently, we will never access it. */