Actual source code: ex4.c

  1: static char help[] = "Test AO with on IS with 0 entries - contributed by Ethan Coon <ecoon@lanl.gov>, Apr 2011.\n\n";

  3: #include <petscsys.h>
  4: #include <petscao.h>

  6: int main(int argc, char **argv)
  7: {
  8:   AO          ao;
  9:   PetscInt   *localvert = NULL, nlocal;
 10:   PetscMPIInt rank;

 12:   PetscFunctionBeginUser;
 13:   PetscCall(PetscInitialize(&argc, &argv, (char *)0, help));
 14:   PetscCallMPI(MPI_Comm_rank(PETSC_COMM_WORLD, &rank));
 15:   PetscCall(PetscMalloc1(4, &localvert));

 17:   if (rank == 0) {
 18:     nlocal       = 4;
 19:     localvert[0] = 0;
 20:     localvert[1] = 1;
 21:     localvert[2] = 2;
 22:     localvert[3] = 3;
 23:   } else {
 24:     nlocal = 0;
 25:   }

 27:   /* Test AOCreateBasic() */
 28:   PetscCall(AOCreateBasic(PETSC_COMM_WORLD, nlocal, localvert, NULL, &ao));
 29:   PetscCall(AODestroy(&ao));

 31:   /* Test AOCreateMemoryScalable() */
 32:   PetscCall(AOCreateMemoryScalable(PETSC_COMM_WORLD, nlocal, localvert, NULL, &ao));
 33:   PetscCall(AODestroy(&ao));

 35:   PetscCall(PetscFree(localvert));
 36:   PetscCall(PetscFinalize());
 37:   return 0;
 38: }

 40: /*TEST

 42:    test:

 44:    test:
 45:       suffix: 2
 46:       nsize: 2
 47:       output_file: output/ex4_1.out

 49: TEST*/