Commits

Matt Knepley committed 1c161d0

DMPlex: DMPlexClone() now copies over coordinates

  • Participants
  • Parent commits 7213989

Comments (0)

Files changed (1)

File src/dm/impls/plex/plexcreate.c

 PetscErrorCode DMPlexClone(DM dm, DM *newdm)
 {
   DM_Plex        *mesh;
+  Vec             coords;
   void           *ctx;
   PetscErrorCode ierr;
 
   ierr           = DMInitialize_Plex(*newdm);CHKERRQ(ierr);
   ierr           = DMGetApplicationContext(dm, &ctx);CHKERRQ(ierr);
   ierr           = DMSetApplicationContext(*newdm, ctx);CHKERRQ(ierr);
+  ierr           = DMGetCoordinatesLocal(dm, &coords);CHKERRQ(ierr);
+  if (coords) {
+    ierr         = DMSetCoordinatesLocal(*newdm, coords);CHKERRQ(ierr);
+  } else {
+    ierr         = DMGetCoordinates(dm, &coords);CHKERRQ(ierr);
+    ierr         = DMSetCoordinates(*newdm, coords);CHKERRQ(ierr);
+  }
   PetscFunctionReturn(0);
 }