Actual source code: ex1.c


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

  4: #include <petscpc.h>

  6: int main(int argc,char **args)
  7: {
  8:   PC             pc;
  9:   PetscInt       n = 5;
 10:   Mat            mat;

 12:   PetscInitialize(&argc,&args,(char*)0,help);
 13:   PCCreate(PETSC_COMM_WORLD,&pc);
 14:   PCSetType(pc,PCNONE);

 16:   /* Vector and matrix must be set before calling PCSetUp */
 17:   MatCreateSeqAIJ(PETSC_COMM_SELF,n,n,3,NULL,&mat);
 18:   MatAssemblyBegin(mat,MAT_FINAL_ASSEMBLY);
 19:   MatAssemblyEnd(mat,MAT_FINAL_ASSEMBLY);
 20:   PCSetOperators(pc,mat,mat);
 21:   PCSetUp(pc);
 22:   MatDestroy(&mat);
 23:   PCDestroy(&pc);
 24:   PetscFinalize();
 25:   return 0;
 26: }

 28: /*TEST

 30:    test:

 32: TEST*/