Actual source code: ex57.c
2: static char help[] = "Tests PetscCommGetComm().\n";
4: #include <petscsys.h>
6: int main(int argc, char **argv)
7: {
8: MPI_Comm comms[10], comm;
9: PetscInt i;
10: PetscRandom rand;
13: PetscInitialize(&argc, &argv, (char *)0, help);
14: PetscRandomCreate(PETSC_COMM_WORLD, &rand);
15: PetscObjectGetComm((PetscObject)rand, &comm);
16: for (i = 0; i < 10; i++) PetscCommGetComm(comm, &comms[i]);
17: for (i = 0; i < 5; i++) PetscCommRestoreComm(comm, &comms[i]);
18: for (i = 0; i < 5; i++) PetscCommGetComm(comm, &comms[i]);
19: for (i = 0; i < 10; i++) PetscCommRestoreComm(comm, &comms[i]);
20: PetscRandomDestroy(&rand);
21: PetscFinalize();
22: return 0;
23: }
25: /*TEST
27: test:
28: requires: defined(PETSC_USE_LOG)
29: args: -info
30: filter: grep Reusing | wc -l
32: TEST*/