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