Actual source code: plexcoarsen.c

petsc-master 2019-08-18
Report Typos and Errors
  1:  #include <petsc/private/dmpleximpl.h>

  3: PetscErrorCode DMCoarsen_Plex(DM dm, MPI_Comm comm, DM *dmCoarsened)
  4: {

  8:   if (!dm->coarseMesh) {DMPlexCoarsen_Internal(dm, NULL, &dm->coarseMesh);}
  9:   PetscObjectReference((PetscObject) dm->coarseMesh);
 10:   *dmCoarsened = dm->coarseMesh;
 11:   return(0);
 12: }

 14: PetscErrorCode DMCoarsenHierarchy_Plex(DM dm, PetscInt nlevels, DM dmCoarsened[])
 15: {
 16:   DM             rdm = dm;
 17:   PetscInt       c;
 18:   PetscBool      localized;

 22:   DMGetCoordinatesLocalized(dm, &localized);
 23:   for (c = nlevels-1; c >= 0; --c) {
 24:     DMCoarsen(rdm, PetscObjectComm((PetscObject) dm), &dmCoarsened[c]);
 25:     DMCopyBoundary(rdm, dmCoarsened[c]);
 26:     if (localized) {DMLocalizeCoordinates(dmCoarsened[c]);}
 27:     DMSetCoarseDM(rdm, dmCoarsened[c]);
 28:     rdm  = dmCoarsened[c];
 29:   }
 30:   return(0);
 31: }