Actual source code: ex7.c
petsc-3.6.1 2015-08-06
2: static char help[] = "Demonstrates constructing an application ordering.\n\n";
4: #include <petscao.h>
5: #include <petscviewer.h>
9: int main(int argc,char **argv)
10: {
11: PetscInt n = 5;
13: PetscMPIInt rank,size;
14: IS ispetsc,isapp;
15: AO ao;
17: PetscInitialize(&argc,&argv,(char*)0,help);
18: PetscOptionsGetInt(NULL,"-n",&n,NULL);
19: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
20: MPI_Comm_size(PETSC_COMM_WORLD,&size);
22: /* create the index sets */
23: ISCreateStride(PETSC_COMM_WORLD,n,rank,size,&ispetsc);
24: ISCreateStride(PETSC_COMM_WORLD,n,n*rank,1,&isapp);
26: /* create the application ordering */
27: AOCreateBasicIS(isapp,ispetsc,&ao);
30: AOView(ao,PETSC_VIEWER_STDOUT_WORLD);
32: ISView(ispetsc,PETSC_VIEWER_STDOUT_WORLD);
33: ISView(isapp,PETSC_VIEWER_STDOUT_WORLD);
34: AOPetscToApplicationIS(ao,ispetsc);
35: ISView(isapp,PETSC_VIEWER_STDOUT_WORLD);
36: ISView(ispetsc,PETSC_VIEWER_STDOUT_WORLD);
39: ISDestroy(&ispetsc);
40: ISDestroy(&isapp);
42: AODestroy(&ao);
43: PetscFinalize();
44: return 0;
45: }