1 #include <petscmat.h>
2
main(int argc,char ** argv)3 int main(int argc, char **argv)
4 {
5 Mat A, B;
6 const char *pfx;
7
8 PetscFunctionBeginUser;
9 PetscCall(PetscInitialize(&argc, &argv, NULL, NULL));
10 PetscCall(MatCreate(PETSC_COMM_WORLD, &A));
11 PetscCall(MatSetSizes(A, 1, 1, PETSC_DECIDE, PETSC_DECIDE));
12 PetscCall(MatSetUp(A));
13 PetscCall(MatSetOptionsPrefix(A, "foo_"));
14 PetscCall(MatGetDiagonalBlock(A, &B));
15 /* Test set options prefix with the string obtained from get options prefix */
16 PetscCall(PetscObjectGetOptionsPrefix((PetscObject)A, &pfx));
17 PetscCall(MatSetOptionsPrefix(B, pfx));
18 PetscCall(MatDestroy(&A));
19
20 PetscCall(PetscFinalize());
21 return 0;
22 }
23
24 /*TEST
25
26 test:
27 output_file: output/empty.out
28
29 TEST*/
30