Actual source code: ex1.c
petsc-3.6.1 2015-08-06
2: static char help[]= "Tests ISLocalToGlobalMappingCreateIS() for bs > 1.\n\n";
4: #include <petscis.h>
5: #include <petscviewer.h>
9: int main(int argc,char **argv)
10: {
11: PetscErrorCode ierr;
12: PetscInt bs = 2,n = 3,ix[3] = {1,7,9},iy[2] = {0,2},mp[2];
13: IS isx;
14: ISLocalToGlobalMapping ltog;
16: PetscInitialize(&argc,&argv,(char*)0,help);
18: ISCreateBlock(PETSC_COMM_SELF,bs,n,ix,PETSC_COPY_VALUES,&isx);
19: ISLocalToGlobalMappingCreateIS(isx,<og);
21: PetscIntView(2,iy,PETSC_VIEWER_STDOUT_WORLD);
22: ISLocalToGlobalMappingApply(ltog,2,iy,mp);
23: PetscIntView(2,mp,PETSC_VIEWER_STDOUT_WORLD);
25: PetscIntView(2,iy,PETSC_VIEWER_STDOUT_WORLD);
26: ISLocalToGlobalMappingApplyBlock(ltog,2,iy,mp);
27: PetscIntView(2,mp,PETSC_VIEWER_STDOUT_WORLD);
29: ISLocalToGlobalMappingDestroy(<og);
30: ISDestroy(&isx);
32: PetscFinalize();
33: return 0;
34: }