Actual source code: ex3.c
1: static char help[] = "Tests ISSetBlockSize() on ISBlock().\n\n";
3: #include <petscis.h>
5: int main(int argc, char **argv)
6: {
7: PetscInt bs = 2, n = 3, ix[3] = {1, 7, 9};
8: const PetscInt *indices;
9: IS is;
10: PetscBool broken = PETSC_FALSE;
12: PetscFunctionBeginUser;
13: PetscCall(PetscInitialize(&argc, &argv, NULL, help));
14: PetscCall(PetscOptionsGetBool(NULL, NULL, "-broken", &broken, NULL));
15: PetscCall(ISCreateBlock(PETSC_COMM_SELF, bs, n, ix, PETSC_COPY_VALUES, &is));
16: PetscCall(ISGetIndices(is, &indices));
17: PetscCall(PetscIntView(bs * 3, indices, NULL));
18: PetscCall(ISRestoreIndices(is, &indices));
19: if (broken) {
20: PetscCall(ISSetBlockSize(is, 3));
21: PetscCall(ISGetIndices(is, &indices));
22: PetscCall(PetscIntView(bs * 3, indices, NULL));
23: PetscCall(ISRestoreIndices(is, &indices));
24: }
25: PetscCall(ISDestroy(&is));
27: PetscCall(PetscFinalize());
28: return 0;
29: }
31: /*TEST
33: test:
35: test:
36: suffix: 2
37: args: -broken
38: filter: Error: grep -o "[0]PETSC ERROR: Object is in wrong state"
39: output_file: output/empty.out
41: TEST*/