Actual source code: ex4.c

petsc-3.3-p6 2013-02-11
  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>

  9: int main(int argc,char **argv)
 10: {
 12:   AO             ao;
 13:   PetscInt       *localvert=PETSC_NULL, nlocal, rank;

 15:   PetscInitialize(&argc,&argv,(char *)0,help);
 16:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
 17:   PetscMalloc(4*sizeof(PetscInt),&localvert);

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

 29:   /* Test AOCreateBasic() */
 30:   AOCreateBasic(PETSC_COMM_WORLD, nlocal, localvert, PETSC_NULL, &ao);
 31:   AODestroy(&ao);

 33:   /* Test AOCreateMemoryScalable() */
 34:   AOCreateMemoryScalable(PETSC_COMM_WORLD, nlocal, localvert, PETSC_NULL, &ao);
 35:   AODestroy(&ao);

 37:   PetscFree(localvert);
 38:   ierr=PetscFinalize();
 39:   return(0);
 40: }