Actual source code: ex50.c

  1: static char help[] = "Test global numbering\n\n";

  3: #include <petscdmplex.h>
  4: #include <petscsf.h>

  6: int main(int argc, char **argv)
  7: {
  8:   DM      dm;
  9:   IS      point_numbering;
 10:   PetscSF point_sf;

 12:   PetscFunctionBeginUser;
 13:   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
 14:   PetscCall(DMCreate(PETSC_COMM_WORLD, &dm));
 15:   PetscCall(DMSetType(dm, DMPLEX));
 16:   PetscCall(DMSetFromOptions(dm));
 17:   PetscCall(DMViewFromOptions(dm, NULL, "-dm_view"));

 19:   PetscCall(DMPlexCreatePointNumbering(dm, &point_numbering));
 20:   PetscCall(ISViewFromOptions(point_numbering, NULL, "-point_numbering_view"));
 21:   PetscCall(ISDestroy(&point_numbering));

 23:   PetscCall(DMGetPointSF(dm, &point_sf));
 24:   PetscCall(PetscSFViewFromOptions(point_sf, NULL, "-point_sf_view"));

 26:   PetscCall(DMDestroy(&dm));
 27:   PetscCall(PetscFinalize());
 28:   return 0;
 29: }

 31: /*TEST

 33:   test:
 34:     nsize: 2
 35:     args: -dm_plex_simplex 0 -dm_plex_box_faces 2,2 -dm_view -point_numbering_view -petscpartitioner_type simple
 36: TEST*/