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:   PetscInitialize(&argc,&argv,(char*)0,help);
 14:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
 15:   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:   AOCreateBasic(PETSC_COMM_WORLD, nlocal, localvert, NULL, &ao);
 29:   AODestroy(&ao);

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

 35:   PetscFree(localvert);
 36:   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*/