Actual source code: ex1.c


  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:   PetscInt               bs = 2, n = 3, ix[3] = {1, 7, 9}, iy[2] = {0, 2}, mp[2];
 10:   IS                     isx;
 11:   ISLocalToGlobalMapping ltog;

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

 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 0;
 32: }

 34: /*TEST

 36:    test:

 38: TEST*/