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, point_numbering_parallel;
 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(ISOnComm(point_numbering, PETSC_COMM_WORLD, PETSC_USE_POINTER, &point_numbering_parallel));
 21:   PetscCall(ISViewFromOptions(point_numbering_parallel, NULL, "-point_numbering_view"));
 22:   PetscCall(ISDestroy(&point_numbering_parallel));
 23:   PetscCall(ISDestroy(&point_numbering));

 25:   PetscCall(DMGetPointSF(dm, &point_sf));
 26:   PetscCall(PetscSFViewFromOptions(point_sf, NULL, "-point_sf_view"));

 28:   PetscCall(DMDestroy(&dm));
 29:   PetscCall(PetscFinalize());
 30:   return 0;
 31: }

 33: /*TEST

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