Actual source code: ex1.c
petsc-3.14.6 2021-03-30
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;
10: PetscInt n = 5;
11: Mat mat;
13: PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;
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 ierr;
27: }
33: /*TEST
35: test:
37: TEST*/