Actual source code: ex4.c

petsc-3.11.4 2019-09-28
Report Typos and Errors

  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: {
 10:   AO             ao;
 11:   PetscInt       *localvert=NULL, nlocal;
 12:   PetscMPIInt    rank;

 14:   PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
 15:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
 16:   PetscMalloc1(4,&localvert);

 18:   if (!rank) {
 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:   AOCreateBasic(PETSC_COMM_WORLD, nlocal, localvert, NULL, &ao);
 30:   AODestroy(&ao);

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

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


 42: /*TEST

 44:    test:

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

 51: TEST*/