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;

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

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

 29: /*TEST

 31:    test:

 33: TEST*/