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 <petscao.h>

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

 11:   PetscFunctionBeginUser;
 12:   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
 13:   PetscCallMPI(MPI_Comm_rank(PETSC_COMM_WORLD, &rank));
 14:   PetscCall(PetscMalloc1(4, &localvert));

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

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

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

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

 39: /*TEST

 41:    test:
 42:       output_file: output/empty.out

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

 49: TEST*/