Actual source code: ex200.c


  2: #include <petscmat.h>

  4: int main(int argc, char **argv)
  5: {
  6:   Mat         A, B;
  7:   const char *pfx;

  9:   PetscFunctionBeginUser;
 10:   PetscCall(PetscInitialize(&argc, &argv, NULL, NULL));
 11:   PetscCall(MatCreate(PETSC_COMM_WORLD, &A));
 12:   PetscCall(MatSetSizes(A, 1, 1, PETSC_DECIDE, PETSC_DECIDE));
 13:   PetscCall(MatSetUp(A));
 14:   PetscCall(MatSetOptionsPrefix(A, "foo_"));
 15:   PetscCall(MatGetDiagonalBlock(A, &B));
 16:   /* Test set options prefix with the string obtained from get options prefix */
 17:   PetscCall(PetscObjectGetOptionsPrefix((PetscObject)A, &pfx));
 18:   PetscCall(MatSetOptionsPrefix(B, pfx));
 19:   PetscCall(MatDestroy(&A));

 21:   PetscCall(PetscFinalize());
 22:   return 0;
 23: }

 25: /*TEST

 27:    test:

 29: TEST*/