1 2 static char help[] = "Tests ISLocalToGlobalMappingCreateIS() for bs > 1.\n\n"; 3 4 #include <petscis.h> 5 #include <petscviewer.h> 6 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; 12 13 PetscFunctionBeginUser; 14 PetscCall(PetscInitialize(&argc, &argv, (char *)0, help)); 15 16 PetscCall(ISCreateBlock(PETSC_COMM_SELF, bs, n, ix, PETSC_COPY_VALUES, &isx)); 17 PetscCall(ISLocalToGlobalMappingCreateIS(isx, <og)); 18 19 PetscCall(PetscIntView(2, iy, PETSC_VIEWER_STDOUT_WORLD)); 20 PetscCall(ISLocalToGlobalMappingApply(ltog, 2, iy, mp)); 21 PetscCall(PetscIntView(2, mp, PETSC_VIEWER_STDOUT_WORLD)); 22 23 PetscCall(PetscIntView(2, iy, PETSC_VIEWER_STDOUT_WORLD)); 24 PetscCall(ISLocalToGlobalMappingApplyBlock(ltog, 2, iy, mp)); 25 PetscCall(PetscIntView(2, mp, PETSC_VIEWER_STDOUT_WORLD)); 26 27 PetscCall(ISLocalToGlobalMappingDestroy(<og)); 28 PetscCall(ISDestroy(&isx)); 29 30 PetscCall(PetscFinalize()); 31 return 0; 32 } 33 34 /*TEST 35 36 test: 37 38 TEST*/ 39