xref: /petsc/include/petscksp.h (revision e0bf44d23b7c951d22da05a3c1196bda2158edde)
12eac72dbSBarry Smith 
22eac72dbSBarry Smith #ifndef __KSP_PACKAGE
32eac72dbSBarry Smith #define __KSP_PACKAGE
42eac72dbSBarry Smith #include "petsc.h"
52eac72dbSBarry Smith #include "vec.h"
6aabeff55SBarry Smith #include "mat.h"
7aabeff55SBarry Smith #include "pc.h"
82eac72dbSBarry Smith 
99e25ed09SBarry Smith #define KSP_COOKIE  PETSC_COOKIE+8
10f0479e8cSBarry Smith 
112eac72dbSBarry Smith typedef struct _KSP*     KSP;
122eac72dbSBarry Smith 
132eac72dbSBarry Smith /*  Possible Krylov Space Methods */
142eac72dbSBarry Smith typedef enum { KSPRICHARDSON, KSPCHEBYCHEV, KSPCG, KSPGMRES,
152eac72dbSBarry Smith                KSPTCQMR, KSPBCGS, KSPCGS, KSPTFQMR, KSPCR, KSPLSQR,
16f8936d11SLois Curfman McInnes                KSPPREONLY } KSPMethod;
172eac72dbSBarry Smith 
186b5873e3SBarry Smith extern int KSPCreate(MPI_Comm,KSP *);
19f8936d11SLois Curfman McInnes extern int KSPSetMethod(KSP,KSPMethod);
208ed539a5SBarry Smith extern int KSPSetUp(KSP);
218ed539a5SBarry Smith extern int KSPSolve(KSP,int *);
228ed539a5SBarry Smith extern int KSPDestroy(KSP);
232eac72dbSBarry Smith 
248ed539a5SBarry Smith extern int KSPRegisterAll();
25d6dfbf8fSBarry Smith extern int KSPRegisterDestroy();
26f8936d11SLois Curfman McInnes extern int KSPRegister(KSPMethod,char *,int (*)(KSP));
272eac72dbSBarry Smith 
28f8936d11SLois Curfman McInnes extern int KSPGetMethodName(KSPMethod,char **);
290de89847SLois Curfman McInnes extern int KSPSetMaxIterations(KSP,int);
308ed539a5SBarry Smith extern int KSPSetRightPreconditioner(KSP);
318ed539a5SBarry Smith extern int KSPGetPreconditionerSide(KSP,int *);
32f8936d11SLois Curfman McInnes extern int KSPGetMethodFromContext(KSP,KSPMethod *);
338ed539a5SBarry Smith extern int KSPSetRelativeTolerance(KSP,double);
348ed539a5SBarry Smith extern int KSPSetAbsoluteTolerance(KSP,double);
358ed539a5SBarry Smith extern int KSPSetDivergenceTolerance(KSP,double);
36*e0bf44d2SBarry Smith extern int KSPGetTolerances(KSP,double*,double*,double*);
37f8936d11SLois Curfman McInnes extern int KSPSetCalculateResidual(KSP,PetscTruth);
388ed539a5SBarry Smith extern int KSPSetUsePreconditionedResidual(KSP);
39c39b5c85SLois Curfman McInnes extern int KSPSetInitialGuessNonzero(KSP);
408ed539a5SBarry Smith extern int KSPSetCalculateEigenvalues(KSP);
418ed539a5SBarry Smith extern int KSPSetRhs(KSP,Vec);
428ed539a5SBarry Smith extern int KSPGetRhs(KSP,Vec *);
438ed539a5SBarry Smith extern int KSPSetSolution(KSP,Vec);
448ed539a5SBarry Smith extern int KSPGetSolution(KSP,Vec *);
452eac72dbSBarry Smith 
46aabeff55SBarry Smith extern int KSPSetBinv(KSP,PC);
47aabeff55SBarry Smith extern int KSPGetBinv(KSP,PC*);
48aabeff55SBarry Smith 
498ed539a5SBarry Smith extern int KSPSetMonitor(KSP,int (*)(KSP,int,double, void*), void *);
508ed539a5SBarry Smith extern int KSPGetMonitorContext(KSP,void **);
518ed539a5SBarry Smith extern int KSPSetResidualHistory(KSP, double *,int);
528ed539a5SBarry Smith extern int KSPSetConvergenceTest(KSP,int (*)(KSP,int,double, void*), void *);
538ed539a5SBarry Smith extern int KSPGetConvergenceContext(KSP,void **);
542eac72dbSBarry Smith 
558ed539a5SBarry Smith extern int KSPBuildSolution(KSP, Vec,Vec *);
568ed539a5SBarry Smith extern int KSPBuildResidual(KSP, Vec, Vec,Vec *);
572eac72dbSBarry Smith 
588ed539a5SBarry Smith extern int KSPRichardsonSetScale(KSP , double);
598ed539a5SBarry Smith extern int KSPChebychevSetEigenvalues(KSP , double, double);
608ed539a5SBarry Smith extern int KSPCGGetEigenvalues(KSP, int n,double*,double*);
618ed539a5SBarry Smith extern int KSPGMRESSetRestart(KSP, int);
62441f95eaSBarry Smith extern int KSPGMRESSetUseUnmodifiedGrammSchmidt(KSP);
638ed539a5SBarry Smith extern int KSPSetFromOptions(KSP);
642eac72dbSBarry Smith 
658ed539a5SBarry Smith extern int KSPDefaultCGMonitor(KSP,int,double, void * );
668ed539a5SBarry Smith extern int KSPDefaultCGConverged(KSP,int,double, void *);
678ed539a5SBarry Smith extern int KSPDefaultMonitor(KSP,int,double, void *);
688ed539a5SBarry Smith extern int KSPDefaultConverged(KSP,int,double, void *);
692eac72dbSBarry Smith 
708ed539a5SBarry Smith extern int KSPPrintHelp(KSP);
718ed539a5SBarry Smith 
721eb62cbbSBarry Smith extern int KSPSetOptionsPrefix(KSP,char*);
731eb62cbbSBarry Smith 
748ed539a5SBarry Smith extern int KSPView(KSP,Viewer);
751eb62cbbSBarry Smith 
761eb62cbbSBarry Smith #if defined(__DRAW_PACKAGE)
771eb62cbbSBarry Smith extern int KSPLGMonitorCreate(char*,char*,int,int,int,int,DrawLGCtx*);
781eb62cbbSBarry Smith extern int KSPLGMonitor(KSP,int,double,void*);
791eb62cbbSBarry Smith extern int KSPLGMonitorDestroy(DrawLGCtx);
801eb62cbbSBarry Smith #endif
811eb62cbbSBarry Smith 
822eac72dbSBarry Smith #endif
832eac72dbSBarry Smith 
842eac72dbSBarry Smith 
85