xref: /petsc/include/petscksp.h (revision 1b918aec0bbbd276c50ade8100eb5102542ec4e5)
1*1b918aecSLois Curfman McInnes /* $Id: ksp.h,v 1.24 1995/08/22 16:33:42 bsmith Exp curfman $ */
22eac72dbSBarry Smith 
32eac72dbSBarry Smith #ifndef __KSP_PACKAGE
42eac72dbSBarry Smith #define __KSP_PACKAGE
52eac72dbSBarry Smith #include "petsc.h"
62eac72dbSBarry Smith #include "vec.h"
7aabeff55SBarry Smith #include "mat.h"
8aabeff55SBarry Smith #include "pc.h"
92eac72dbSBarry Smith 
109e25ed09SBarry Smith #define KSP_COOKIE  PETSC_COOKIE+8
11f0479e8cSBarry Smith 
122eac72dbSBarry Smith typedef struct _KSP*     KSP;
132eac72dbSBarry Smith 
142eac72dbSBarry Smith /*  Possible Krylov Space Methods */
152eac72dbSBarry Smith typedef enum { KSPRICHARDSON, KSPCHEBYCHEV, KSPCG, KSPGMRES,
162eac72dbSBarry Smith                KSPTCQMR, KSPBCGS, KSPCGS, KSPTFQMR, KSPCR, KSPLSQR,
17065ac47aSLois Curfman McInnes                KSPPREONLY, KSPQCG } KSPMethod;
182eac72dbSBarry Smith 
196b5873e3SBarry Smith extern int KSPCreate(MPI_Comm,KSP *);
20f8936d11SLois Curfman McInnes extern int KSPSetMethod(KSP,KSPMethod);
218ed539a5SBarry Smith extern int KSPSetUp(KSP);
228ed539a5SBarry Smith extern int KSPSolve(KSP,int *);
238ed539a5SBarry Smith extern int KSPDestroy(KSP);
242eac72dbSBarry Smith 
258ed539a5SBarry Smith extern int KSPRegisterAll();
26d6dfbf8fSBarry Smith extern int KSPRegisterDestroy();
27f8936d11SLois Curfman McInnes extern int KSPRegister(KSPMethod,char *,int (*)(KSP));
282eac72dbSBarry Smith 
29f8936d11SLois Curfman McInnes extern int KSPGetMethodName(KSPMethod,char **);
308ed539a5SBarry Smith extern int KSPSetRightPreconditioner(KSP);
318ed539a5SBarry Smith extern int KSPGetPreconditionerSide(KSP,int *);
32f8936d11SLois Curfman McInnes extern int KSPGetMethodFromContext(KSP,KSPMethod *);
33ae622e99SLois Curfman McInnes extern int KSPGetTolerances(KSP,double*,double*,double*,int*);
34f9a5357eSLois Curfman McInnes extern int KSPSetTolerances(KSP,double,double,double,int);
35f8936d11SLois Curfman McInnes extern int KSPSetCalculateResidual(KSP,PetscTruth);
368ed539a5SBarry Smith extern int KSPSetUsePreconditionedResidual(KSP);
37c39b5c85SLois Curfman McInnes extern int KSPSetInitialGuessNonzero(KSP);
388ed539a5SBarry Smith extern int KSPSetCalculateEigenvalues(KSP);
398ed539a5SBarry Smith extern int KSPSetRhs(KSP,Vec);
408ed539a5SBarry Smith extern int KSPGetRhs(KSP,Vec *);
418ed539a5SBarry Smith extern int KSPSetSolution(KSP,Vec);
428ed539a5SBarry Smith extern int KSPGetSolution(KSP,Vec *);
432eac72dbSBarry Smith 
44aabeff55SBarry Smith extern int KSPSetBinv(KSP,PC);
45aabeff55SBarry Smith extern int KSPGetBinv(KSP,PC*);
46aabeff55SBarry Smith 
478ed539a5SBarry Smith extern int KSPSetMonitor(KSP,int (*)(KSP,int,double, void*), void *);
488ed539a5SBarry Smith extern int KSPGetMonitorContext(KSP,void **);
498ed539a5SBarry Smith extern int KSPSetResidualHistory(KSP, double *,int);
508ed539a5SBarry Smith extern int KSPSetConvergenceTest(KSP,int (*)(KSP,int,double, void*), void *);
518ed539a5SBarry Smith extern int KSPGetConvergenceContext(KSP,void **);
522eac72dbSBarry Smith 
538ed539a5SBarry Smith extern int KSPBuildSolution(KSP, Vec,Vec *);
548ed539a5SBarry Smith extern int KSPBuildResidual(KSP, Vec, Vec,Vec *);
552eac72dbSBarry Smith 
568ed539a5SBarry Smith extern int KSPRichardsonSetScale(KSP , double);
578ed539a5SBarry Smith extern int KSPChebychevSetEigenvalues(KSP , double, double);
5883f0b094SBarry Smith extern int KSPCGGetEigenvalues(KSP, int n,Scalar*,Scalar*);
598ed539a5SBarry Smith extern int KSPGMRESSetRestart(KSP, int);
603e9c68e4SLois Curfman McInnes extern int KSPGMRESSetUseUnmodifiedGramSchmidt(KSP);
61*1b918aecSLois Curfman McInnes extern int KSPGMRESSetOrthogRoutine(KSP,int (*)(KSP,int));
628ed539a5SBarry Smith extern int KSPSetFromOptions(KSP);
632eac72dbSBarry Smith 
64c01c455dSBarry Smith extern int KSPCGDefaultMonitor(KSP,int,double, void * );
65c01c455dSBarry Smith extern int KSPCGDefaultConverged(KSP,int,double, void *);
668ed539a5SBarry Smith extern int KSPDefaultMonitor(KSP,int,double, void *);
678c48e012SBarry Smith extern int KSPDefaultSMonitor(KSP,int,double, void *);
688ed539a5SBarry Smith extern int KSPDefaultConverged(KSP,int,double, void *);
692eac72dbSBarry Smith 
70c01c455dSBarry Smith extern int KSPResidual(KSP,Vec,Vec,Vec,Vec,Vec,Vec);
71c01c455dSBarry Smith extern int KSPUnwindPre(KSP,Vec,Vec);
72c01c455dSBarry Smith extern int KSPDefaultBuildSolution(KSP,Vec,Vec*);
73c01c455dSBarry Smith extern int KSPDefaultBuildResidual(KSP,Vec,Vec,Vec *);
74c01c455dSBarry Smith 
758ed539a5SBarry Smith extern int KSPPrintHelp(KSP);
768ed539a5SBarry Smith 
771eb62cbbSBarry Smith extern int KSPSetOptionsPrefix(KSP,char*);
781eb62cbbSBarry Smith 
798ed539a5SBarry Smith extern int KSPView(KSP,Viewer);
801eb62cbbSBarry Smith 
811eb62cbbSBarry Smith #if defined(__DRAW_PACKAGE)
821eb62cbbSBarry Smith extern int KSPLGMonitorCreate(char*,char*,int,int,int,int,DrawLGCtx*);
831eb62cbbSBarry Smith extern int KSPLGMonitor(KSP,int,double,void*);
841eb62cbbSBarry Smith extern int KSPLGMonitorDestroy(DrawLGCtx);
851eb62cbbSBarry Smith #endif
861eb62cbbSBarry Smith 
872eac72dbSBarry Smith #endif
882eac72dbSBarry Smith 
892eac72dbSBarry Smith 
90