Actual source code: ex3.c


  2: static char help[]= "Tests ISSetBlockSize() on ISBlock().\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};
 10:   const PetscInt         *indices;
 11:   IS                     is;
 12:   PetscBool              broken = PETSC_FALSE;

 14:   PetscInitialize(&argc,&argv,(char*)0,help);
 15:   PetscOptionsGetBool(NULL,NULL,"-broken",&broken,NULL);
 16:   ISCreateBlock(PETSC_COMM_SELF,bs,n,ix,PETSC_COPY_VALUES,&is);
 17:   ISGetIndices(is,&indices);
 18:   PetscIntView(bs*3,indices,NULL);
 19:   ISRestoreIndices(is,&indices);
 20:   if (broken) {
 21:     ISSetBlockSize(is,3);
 22:     ISGetIndices(is,&indices);
 23:     PetscIntView(bs*3,indices,NULL);
 24:     ISRestoreIndices(is,&indices);
 25:   }
 26:   ISDestroy(&is);

 28:   PetscFinalize();
 29:   return 0;
 30: }

 32: /*TEST

 34:    test:

 36:    test:
 37:      suffix: 2
 38:      args:  -broken
 39:      filter: Error: grep -o  "[0]PETSC ERROR: Object is in wrong state"

 41: TEST*/