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

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

 24: /*TEST

 26:    test:

 28: TEST*/