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