Actual source code: ex200.c

petsc-3.7.4 2016-10-02
Report Typos and Errors
  2: #include <petscmat.h>

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

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

 23:   PetscFinalize();
 24:   return ierr;
 25: }