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