Actual source code: ex1.c

petsc-3.9.4 2018-09-11
Report Typos and Errors

  2: static char help[] = "Tests the creation of a PC context.\n\n";

  4: /*T
  5:    requires: x
  6: T*/

  8:  #include <petscpc.h>

 10: int main(int argc,char **args)
 11: {
 12:   PC             pc;
 14:   PetscInt       n = 5;
 15:   Mat            mat;

 17:   PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;
 18:   PCCreate(PETSC_COMM_WORLD,&pc);
 19:   PCSetType(pc,PCNONE);

 21:   /* Vector and matrix must be set before calling PCSetUp */
 22:   MatCreateSeqAIJ(PETSC_COMM_SELF,n,n,3,NULL,&mat);
 23:   MatAssemblyBegin(mat,MAT_FINAL_ASSEMBLY);
 24:   MatAssemblyEnd(mat,MAT_FINAL_ASSEMBLY);
 25:   PCSetOperators(pc,mat,mat);
 26:   PCSetUp(pc);
 27:   MatDestroy(&mat);
 28:   PCDestroy(&pc);
 29:   PetscFinalize();
 30:   return ierr;
 31: }





 37: /*TEST

 39:    test:

 41: TEST*/