1. Vijay Mahadevan
  2. petsc

Commits

Matt Knepley  committed 6917d02 Merge

Merge branch 'knepley/fix-plex-ex12'

* knepley/fix-plex-ex12:
DMPlex ex12: Give mesh a name - Fixed test output
DMPlex: Fix leaks

  • Participants
  • Parent commits 93cf248, 2f9c189
  • Branches master

Comments (0)

Files changed (6)

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

View file
   PetscFunctionBegin;
   if ((faces[0] < 1) || (faces[1] < 1) || (faces[2] < 1)) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP, "Must have at least 1 face per side");
   if ((faces[0] > 1) || (faces[1] > 1) || (faces[2] > 1)) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP, "Currently can't handle more than 1 face per side");
-  ierr = PetscMalloc(numVertices*2 * sizeof(PetscReal), &coords);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)dm), &rank);CHKERRQ(ierr);
   if (!rank) {
     PetscInt f;

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

View file
     ierr = DMPlexVecSetClosure(dm, section, localX, c, values, mode);CHKERRQ(ierr);
   }
   ierr = DMRestoreWorkArray(dm, numValues, PETSC_SCALAR, &values);CHKERRQ(ierr);
+  ierr = PetscFree2(v0,J);CHKERRQ(ierr);
   ierr = PetscFree(sp);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }

File src/snes/examples/tutorials/ex12.c

View file
     DMLabel label;
 
     ierr = DMPlexCreateBoxMesh(comm, dim, interpolate, dm);CHKERRQ(ierr);
+    ierr = PetscObjectSetName((PetscObject) *dm, "Mesh");CHKERRQ(ierr);
     ierr = DMPlexGetLabel(*dm, "marker", &label);CHKERRQ(ierr);
     if (label) {ierr = DMPlexLabelComplete(*dm, label);CHKERRQ(ierr);}
   } else {
     ierr = DMPlexSetRefinementLimit(*dm, refinementLimit);CHKERRQ(ierr);
     ierr = DMRefine(*dm, comm, &refinedMesh);CHKERRQ(ierr);
     if (refinedMesh) {
+      const char *name;
+
+      ierr = PetscObjectGetName((PetscObject) *dm,         &name);CHKERRQ(ierr);
+      ierr = PetscObjectSetName((PetscObject) refinedMesh,  name);CHKERRQ(ierr);
       ierr = DMDestroy(dm);CHKERRQ(ierr);
       *dm  = refinedMesh;
     }

File src/snes/examples/tutorials/output/ex12_3.out

View file
-Mesh 'DM_0x84000000_0':
+Mesh 'Mesh':
 Max sizes cone: 3 support: 6
 orientation is missing
 cap --> base:

File src/snes/examples/tutorials/output/ex12_7.out

View file
-Mesh 'DM_0x84000000_0':
+Mesh 'Mesh':
 Max sizes cone: 3 support: 6
 orientation is missing
 cap --> base:

File src/snes/examples/tutorials/output/ex12_8.out

View file
-Mesh 'DM_0x84000000_0':
+Mesh 'Mesh':
 Max sizes cone: 3 support: 8
 orientation is missing
 cap --> base: