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;
18: PetscInitialize(&argc,&argv,(char*)0,help);
20: /*
21: Test IS of size 0
22: */
23: ISCreateStride(PETSC_COMM_SELF,0,0,2,&is);
24: ISGetSize(is,&n);
26: ISStrideGetInfo(is,&start,&stride);
29: PetscObjectTypeCompare((PetscObject)is,ISSTRIDE,&flg);
31: ISGetIndices(is,&ii);
32: ISRestoreIndices(is,&ii);
33: ISDestroy(&is);
35: /*
36: Test ISGetIndices()
37: */
38: ISCreateStride(PETSC_COMM_SELF,10000,-8,3,&is);
39: ISGetLocalSize(is,&n);
40: ISGetIndices(is,&ii);
41: for (i=0; i<10000; i++) {
43: }
44: ISRestoreIndices(is,&ii);
45: ISDestroy(&is);
47: PetscFinalize();
48: return 0;
49: }
51: /*TEST
53: test:
54: output_file: output/ex1_1.out
56: TEST*/