Actual source code: ex1.c
petsc-3.12.4 2020-02-04
Report Typos and Errors

      2: static char help[]= "Tests ISLocalToGlobalMappingCreateIS() for bs > 1.\n\n";

      4:  #include <petscis.h>
      5:  #include <petscviewer.h>

      7: int main(int argc,char **argv)
      8: {
      9:   PetscErrorCode         ierr;
     10:   PetscInt               bs = 2,n = 3,ix[3] = {1,7,9},iy[2] = {0,2},mp[2];
     11:   IS                     isx;
     12:   ISLocalToGlobalMapping ltog;

     14:   PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;

     16:   ISCreateBlock(PETSC_COMM_SELF,bs,n,ix,PETSC_COPY_VALUES,&isx);
     17:   ISLocalToGlobalMappingCreateIS(isx,&ltog);

     19:   PetscIntView(2,iy,PETSC_VIEWER_STDOUT_WORLD);
     20:   ISLocalToGlobalMappingApply(ltog,2,iy,mp);
     21:   PetscIntView(2,mp,PETSC_VIEWER_STDOUT_WORLD);

     23:   PetscIntView(2,iy,PETSC_VIEWER_STDOUT_WORLD);
     24:   ISLocalToGlobalMappingApplyBlock(ltog,2,iy,mp);
     25:   PetscIntView(2,mp,PETSC_VIEWER_STDOUT_WORLD);

     27:   ISLocalToGlobalMappingDestroy(&ltog);
     28:   ISDestroy(&isx);

     30:   PetscFinalize();
     31:   return ierr;
     32: }

     36: /*TEST

     38:    test:

     40: TEST*/