Actual source code: ex4.c
petsc-3.4.2 2013-07-02

      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=NULL, nlocal;
     14:   PetscMPIInt    rank;

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

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

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

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

     38:   PetscFree(localvert);
     39:   PetscFinalize();
     40:   return(0);
     41: }