Actual source code: ex7.c
2: static char help[] = "Demonstrates constructing an application ordering.\n\n";
4: #include <petscao.h>
5: #include <petscviewer.h>
7: int main(int argc, char **argv)
8: {
9: PetscInt n = 5;
10: PetscMPIInt rank, size;
11: IS ispetsc, isapp;
12: AO ao;
15: PetscInitialize(&argc, &argv, (char *)0, help);
16: PetscOptionsGetInt(NULL, NULL, "-n", &n, NULL);
17: MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
18: MPI_Comm_size(PETSC_COMM_WORLD, &size);
20: /* create the index sets */
21: ISCreateStride(PETSC_COMM_WORLD, n, rank, size, &ispetsc);
22: ISCreateStride(PETSC_COMM_WORLD, n, n * rank, 1, &isapp);
24: /* create the application ordering */
25: AOCreateBasicIS(isapp, ispetsc, &ao);
27: AOView(ao, PETSC_VIEWER_STDOUT_WORLD);
29: ISView(ispetsc, PETSC_VIEWER_STDOUT_WORLD);
30: ISView(isapp, PETSC_VIEWER_STDOUT_WORLD);
31: AOPetscToApplicationIS(ao, ispetsc);
32: ISView(isapp, PETSC_VIEWER_STDOUT_WORLD);
33: ISView(ispetsc, PETSC_VIEWER_STDOUT_WORLD);
35: ISDestroy(&ispetsc);
36: ISDestroy(&isapp);
38: AODestroy(&ao);
39: PetscFinalize();
40: return 0;
41: }
43: /*TEST
45: test:
46: nsize: 2
48: TEST*/