1 2 static char help[]= "Tests ISSetBlockSize() on ISBlock().\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}; 10 const PetscInt *indices; 11 IS is; 12 PetscBool broken = PETSC_FALSE; 13 14 PetscFunctionBeginUser; 15 PetscCall(PetscInitialize(&argc,&argv,(char*)0,help)); 16 PetscCall(PetscOptionsGetBool(NULL,NULL,"-broken",&broken,NULL)); 17 PetscCall(ISCreateBlock(PETSC_COMM_SELF,bs,n,ix,PETSC_COPY_VALUES,&is)); 18 PetscCall(ISGetIndices(is,&indices)); 19 PetscCall(PetscIntView(bs*3,indices,NULL)); 20 PetscCall(ISRestoreIndices(is,&indices)); 21 if (broken) { 22 PetscCall(ISSetBlockSize(is,3)); 23 PetscCall(ISGetIndices(is,&indices)); 24 PetscCall(PetscIntView(bs*3,indices,NULL)); 25 PetscCall(ISRestoreIndices(is,&indices)); 26 } 27 PetscCall(ISDestroy(&is)); 28 29 PetscCall(PetscFinalize()); 30 return 0; 31 } 32 33 /*TEST 34 35 test: 36 37 test: 38 suffix: 2 39 args: -broken 40 filter: Error: grep -o "[0]PETSC ERROR: Object is in wrong state" 41 42 TEST*/ 43