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: PetscFunctionBeginUser;
15: PetscCall(PetscInitialize(&argc, &argv, (char *)0, help));
16: PetscCall(PetscOptionsGetBool(NULL, NULL, "-broken", &broken, NULL));
17: PetscCall(ISCreateBlock(PETSC_COMM_SELF, bs, n, ix, PETSC_COPY_VALUES, &is));
18: PetscCall(ISGetIndices(is, &indices));
19: PetscCall(PetscIntView(bs * 3, indices, NULL));
20: PetscCall(ISRestoreIndices(is, &indices));
21: if (broken) {
22: PetscCall(ISSetBlockSize(is, 3));
23: PetscCall(ISGetIndices(is, &indices));
24: PetscCall(PetscIntView(bs * 3, indices, NULL));
25: PetscCall(ISRestoreIndices(is, &indices));
26: }
27: PetscCall(ISDestroy(&is));
29: PetscCall(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*/