Skip to content

Instantly share code, notes, and snippets.

@wence-
Created October 11, 2014 12:22
Show Gist options
  • Select an option

  • Save wence-/9d6b7aca9be8598a8550 to your computer and use it in GitHub Desktop.

Select an option

Save wence-/9d6b7aca9be8598a8550 to your computer and use it in GitHub Desktop.
diff --git a/src/dm/impls/plex/plexrefine.c b/src/dm/impls/plex/plexrefine.c
index c6acb18..5667f07 100644
--- a/src/dm/impls/plex/plexrefine.c
+++ b/src/dm/impls/plex/plexrefine.c
@@ -6139,6 +6139,12 @@ static PetscErrorCode CellRefinerCreateLabels(CellRefiner
ierr = DMLabelGetStratumIS(label, values[val], &pointIS);CHKERRQ(ierr);
ierr = ISGetLocalSize(pointIS, &numPoints);CHKERRQ(ierr);
ierr = ISGetIndices(pointIS, &points);CHKERRQ(ierr);
+ /* Ensure refined label is created with same number of strata as
+ * original (even if no entries here). */
+ if (!numPoints) {
+ ierr = DMLabelSetValue(labelNew, 0, values[val]);CHKERRQ(ierr);
+ ierr = DMLabelClearValue(labelNew, 0, values[val]);CHKERRQ(ierr);
+ }
for (n = 0; n < numPoints; ++n) {
const PetscInt p = points[n];
switch (refiner) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment