xref: /petsc/src/vec/is/ao/tests/ex4.c (revision 609caa7c8c030312b00807b4f015fd827bb80932)
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 
main(int argc,char ** argv)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, NULL, 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       output_file: output/empty.out
44 
45    test:
46       suffix: 2
47       nsize: 2
48       output_file: output/empty.out
49 
50 TEST*/
51