xref: /petsc/src/mat/tests/ex200.c (revision a69119a591a03a9d906b29c0a4e9802e4d7c9795)
1 
2 #include <petscmat.h>
3 
4 int main(int argc, char **argv) {
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 
28 TEST*/
29