Actual source code: ex4.c


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

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

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

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

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

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

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

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

 41: /*TEST

 43:    test:

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

 50: TEST*/