Actual source code: petsc-pcimpl.h
petsc-3.5.4 2015-05-23
2: #ifndef _PCIMPL_H
3: #define _PCIMPL_H
5: #include <petscksp.h>
6: #include <petscpc.h>
7: #include <petsc-private/petscimpl.h>
9: typedef struct _PCOps *PCOps;
10: struct _PCOps {
11: PetscErrorCode (*setup)(PC);
12: PetscErrorCode (*apply)(PC,Vec,Vec);
13: PetscErrorCode (*applyrichardson)(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool ,PetscInt*,PCRichardsonConvergedReason*);
14: PetscErrorCode (*applyBA)(PC,PCSide,Vec,Vec,Vec);
15: PetscErrorCode (*applytranspose)(PC,Vec,Vec);
16: PetscErrorCode (*applyBAtranspose)(PC,PetscInt,Vec,Vec,Vec);
17: PetscErrorCode (*setfromoptions)(PC);
18: PetscErrorCode (*presolve)(PC,KSP,Vec,Vec);
19: PetscErrorCode (*postsolve)(PC,KSP,Vec,Vec);
20: PetscErrorCode (*getfactoredmatrix)(PC,Mat*);
21: PetscErrorCode (*applysymmetricleft)(PC,Vec,Vec);
22: PetscErrorCode (*applysymmetricright)(PC,Vec,Vec);
23: PetscErrorCode (*setuponblocks)(PC);
24: PetscErrorCode (*destroy)(PC);
25: PetscErrorCode (*view)(PC,PetscViewer);
26: PetscErrorCode (*reset)(PC);
27: PetscErrorCode (*load)(PC,PetscViewer);
28: };
30: /*
31: Preconditioner context
32: */
33: struct _p_PC {
34: PETSCHEADER(struct _PCOps);
35: DM dm;
36: PetscInt setupcalled;
37: PetscObjectState matstate,matnonzerostate; /* last known nonzero state of the pmat associated with this PC */
38: PetscBool reusepreconditioner;
39: MatStructure flag; /* reset each PCSetUp() to indicate to PC implementations if nonzero structure has changed */
41: PetscInt setfromoptionscalled;
43: Mat mat,pmat;
44: Vec diagonalscaleright,diagonalscaleleft; /* used for time integration scaling */
45: PetscBool diagonalscale;
46: PetscBool nonzero_guess; /* used by PCKSP, PCREDUNDANT */
47: PetscBool useAmat; /* used by several PC that including applying the operator inside the preconditioner */
48: PetscErrorCode (*modifysubmatrices)(PC,PetscInt,const IS[],const IS[],Mat[],void*); /* user provided routine */
49: void *modifysubmatricesP; /* context for user routine */
50: void *data;
51: PetscInt presolvedone; /* has PCPreSolve() already been run */
52: void *user; /* optional user-defined context */
53: };
55: PETSC_EXTERN PetscLogEvent PC_SetUp, PC_SetUpOnBlocks, PC_Apply, PC_ApplyCoarse, PC_ApplyMultiple, PC_ApplySymmetricLeft;
56: PETSC_EXTERN PetscLogEvent PC_ApplySymmetricRight, PC_ModifySubMatrices, PC_ApplyOnBlocks, PC_ApplyTransposeOnBlocks, PC_ApplyOnMproc;
58: #endif