Actual source code: ex7.c

  2: static char help[] = "Demonstrates constructing an application ordering.\n\n";

 4:  #include petscao.h

  8: int main(int argc,char **argv)
  9: {
 10:   PetscInt       n = 5;
 12:   PetscMPIInt    rank,size;
 13:   IS             ispetsc,isapp;
 14:   AO             ao;

 16:   PetscInitialize(&argc,&argv,(char*)0,help);
 17:   PetscOptionsGetInt(PETSC_NULL,"-n",&n,PETSC_NULL);
 18:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
 19:   MPI_Comm_size(PETSC_COMM_WORLD,&size);

 21:   /* create the index sets */
 22:   ISCreateStride(PETSC_COMM_WORLD,n,rank,size,&ispetsc);
 23:   ISCreateStride(PETSC_COMM_WORLD,n,n*rank,1,&isapp);

 25:   /* create the application ordering */
 26:   AOCreateBasicIS(isapp,ispetsc,&ao);


 29:   AOView(ao,PETSC_VIEWER_STDOUT_WORLD);

 31:   ISView(ispetsc,PETSC_VIEWER_STDOUT_WORLD);
 32:   ISView(isapp,PETSC_VIEWER_STDOUT_WORLD);
 33:   AOPetscToApplicationIS(ao,ispetsc);
 34:   ISView(isapp,PETSC_VIEWER_STDOUT_WORLD);
 35:   ISView(ispetsc,PETSC_VIEWER_STDOUT_WORLD);


 38:   ISDestroy(ispetsc);
 39:   ISDestroy(isapp);

 41:   AODestroy(ao);
 42:   PetscFinalize();
 43:   return 0;
 44: }
 45: