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;

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

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

 25: /*TEST

 27:    test:

 29: TEST*/