Actual source code: ex5.c
petsc-3.4.2 2013-07-02

      2: static char help[] = "Tests ISLocalToGlobalMappingGetInfo.()\n\n";

      4: #include <petscis.h>

      8: int main(int argc,char **argv)
      9: {
     10:   PetscErrorCode         ierr;
     11:   PetscMPIInt            size,rank;
     12:   PetscInt               nlocal,local[5],nneigh,*neigh,**ineigh,*numneigh;
     13:   ISLocalToGlobalMapping mapping;

     16:   PetscInitialize(&argc,&argv,(char*)0,help);
     17:   MPI_Comm_size(PETSC_COMM_WORLD,&size);
     18:   if (size != 3) SETERRQ(PETSC_COMM_SELF,1,"Must run with three processors");
     19:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
     20:   if (!rank) {
     21:     nlocal = 4; local[0] = 0; local[1] = 3; local[2] = 2; local[3] = 1;
     22:   } else if (rank == 1) {
     23:     nlocal = 4; local[0] = 3; local[1] = 5; local[2] = 4; local[3] = 2;
     24:   } else {
     25:     nlocal = 4; local[0] = 7; local[1] = 6; local[2] = 5; local[3] = 3;
     26:   }
     27:   ISLocalToGlobalMappingCreate(PETSC_COMM_WORLD,nlocal,local,PETSC_COPY_VALUES,&mapping);
     28:   ISLocalToGlobalMappingGetInfo(mapping,&nneigh,&neigh,&numneigh,&ineigh);
     29:   ISLocalToGlobalMappingRestoreInfo(mapping,&nneigh,&neigh,&numneigh,&ineigh);
     30:   ISLocalToGlobalMappingDestroy(&mapping);
     31:   PetscFinalize();
     32:   return 0;
     33: }