Actual source code: ex2.c


  2: /*
  3:        Formatted test for ISStride routines.
  4: */

  6: static char help[] = "Tests IS stride routines.\n\n";

  8: #include <petscis.h>
  9: #include <petscviewer.h>

 11: int main(int argc, char **argv)
 12: {
 13:   PetscInt        i, n, start, stride;
 14:   const PetscInt *ii;
 15:   IS              is;
 16:   PetscBool       flg;

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

 21:   /*
 22:      Test IS of size 0
 23:   */
 24:   ISCreateStride(PETSC_COMM_SELF, 0, 0, 2, &is);
 25:   ISGetSize(is, &n);
 27:   ISStrideGetInfo(is, &start, &stride);
 30:   PetscObjectTypeCompare((PetscObject)is, ISSTRIDE, &flg);
 32:   ISGetIndices(is, &ii);
 33:   ISRestoreIndices(is, &ii);
 34:   ISDestroy(&is);

 36:   /*
 37:      Test ISGetIndices()
 38:   */
 39:   ISCreateStride(PETSC_COMM_SELF, 10000, -8, 3, &is);
 40:   ISGetLocalSize(is, &n);
 41:   ISGetIndices(is, &ii);
 43:   ISRestoreIndices(is, &ii);
 44:   ISDestroy(&is);

 46:   PetscFinalize();
 47:   return 0;
 48: }

 50: /*TEST

 52:    test:
 53:      output_file: output/ex1_1.out

 55: TEST*/