Actual source code: ex200.c

petsc-3.14.6 2021-03-30
Report Typos and Errors

  2: #include <petscmat.h>

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

 10:    PetscInitialize(&argc, &argv, NULL, NULL);if (ierr) return ierr;
 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 ierr;
 23: }

 25: /*TEST

 27:    test:

 29: TEST*/