1 static char help[] = "Test AO with on IS with 0 entries - contributed by Ethan Coon <ecoon@lanl.gov>, Apr 2011.\n\n"; 2 3 #include <petscsys.h> 4 #include <petscao.h> 5 6 int main(int argc, char **argv) 7 { 8 AO ao; 9 PetscInt *localvert = NULL, nlocal; 10 PetscMPIInt rank; 11 12 PetscFunctionBeginUser; 13 PetscCall(PetscInitialize(&argc, &argv, (char *)0, help)); 14 PetscCallMPI(MPI_Comm_rank(PETSC_COMM_WORLD, &rank)); 15 PetscCall(PetscMalloc1(4, &localvert)); 16 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 } 26 27 /* Test AOCreateBasic() */ 28 PetscCall(AOCreateBasic(PETSC_COMM_WORLD, nlocal, localvert, NULL, &ao)); 29 PetscCall(AODestroy(&ao)); 30 31 /* Test AOCreateMemoryScalable() */ 32 PetscCall(AOCreateMemoryScalable(PETSC_COMM_WORLD, nlocal, localvert, NULL, &ao)); 33 PetscCall(AODestroy(&ao)); 34 35 PetscCall(PetscFree(localvert)); 36 PetscCall(PetscFinalize()); 37 return 0; 38 } 39 40 /*TEST 41 42 test: 43 44 test: 45 suffix: 2 46 nsize: 2 47 output_file: output/ex4_1.out 48 49 TEST*/ 50