xref: /petsc/include/petscksp.h (revision af6b99e9b189e8e8dab39012dffe0bbbf03b23b9)
1*af6b99e9SBarry Smith /* $Id: ksp.h,v 1.38 1996/03/20 02:00:50 curfman Exp bsmith $ */
2f26ada1bSBarry Smith /*
3f26ada1bSBarry Smith    Defines the interface functions for the Krylov subspace accelerators.
4f26ada1bSBarry Smith */
52eac72dbSBarry Smith #ifndef __KSP_PACKAGE
62eac72dbSBarry Smith #define __KSP_PACKAGE
72eac72dbSBarry Smith #include "petsc.h"
82eac72dbSBarry Smith #include "vec.h"
9aabeff55SBarry Smith #include "mat.h"
10aabeff55SBarry Smith #include "pc.h"
112eac72dbSBarry Smith 
129e25ed09SBarry Smith #define KSP_COOKIE  PETSC_COOKIE+8
13f0479e8cSBarry Smith 
142eac72dbSBarry Smith typedef struct _KSP*     KSP;
152eac72dbSBarry Smith 
162eac72dbSBarry Smith /*  Possible Krylov Space Methods */
17f26ada1bSBarry Smith typedef enum { KSPRICHARDSON, KSPCHEBYCHEV, KSPCG, KSPGMRES, KSPTCQMR, KSPBCGS,
184b0e389bSBarry Smith                KSPCGS, KSPTFQMR, KSPCR, KSPLSQR, KSPPREONLY, KSPQCG} KSPType;
192eac72dbSBarry Smith 
206b5873e3SBarry Smith extern int KSPCreate(MPI_Comm,KSP *);
214b0e389bSBarry Smith extern int KSPSetType(KSP,KSPType);
228ed539a5SBarry Smith extern int KSPSetUp(KSP);
238ed539a5SBarry Smith extern int KSPSolve(KSP,int *);
248ed539a5SBarry Smith extern int KSPDestroy(KSP);
252eac72dbSBarry Smith 
268ed539a5SBarry Smith extern int KSPRegisterAll();
27d6dfbf8fSBarry Smith extern int KSPRegisterDestroy();
284b0e389bSBarry Smith extern int KSPRegister(KSPType,char *,int (*)(KSP));
292eac72dbSBarry Smith 
304b0e389bSBarry Smith extern int KSPGetType(KSP, KSPType *,char **);
31aad2872bSLois Curfman McInnes extern int KSPSetPreconditionerSide(KSP,PCSide);
32aad2872bSLois Curfman McInnes extern int KSPGetPreconditionerSide(KSP,PCSide*);
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);
38*af6b99e9SBarry Smith extern int KSPSetCalculateSingularvalues(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 
4477c4ece6SBarry Smith extern int KSPSetPC(KSP,PC);
4577c4ece6SBarry Smith extern int KSPGetPC(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);
504b0e389bSBarry Smith 
518ed539a5SBarry Smith extern int KSPSetConvergenceTest(KSP,int (*)(KSP,int,double, void*), void *);
528ed539a5SBarry Smith extern int KSPGetConvergenceContext(KSP,void **);
532eac72dbSBarry Smith 
548ed539a5SBarry Smith extern int KSPBuildSolution(KSP, Vec,Vec *);
558ed539a5SBarry Smith extern int KSPBuildResidual(KSP, Vec, Vec,Vec *);
562eac72dbSBarry Smith 
578ed539a5SBarry Smith extern int KSPRichardsonSetScale(KSP , double);
588ed539a5SBarry Smith extern int KSPChebychevSetEigenvalues(KSP , double, double);
59*af6b99e9SBarry Smith extern int KSPComputeExtremeSingularvalues(KSP, Scalar*,Scalar*);
604b0e389bSBarry Smith 
618ed539a5SBarry Smith extern int KSPGMRESSetRestart(KSP, int);
62b4fd4287SBarry Smith extern int KSPGMRESSetPreAllocateVectors(KSP);
6377c4ece6SBarry Smith extern int KSPGMRESSetOrthogonalization(KSP,int (*)(KSP,int));
64bcd2baecSBarry Smith extern int KSPGMRESUnmodifiedGramSchmidtOrthogonalization(KSP,int);
65bcd2baecSBarry Smith extern int KSPGMRESModifiedGramSchmidtOrthogonalization(KSP,int);
66bcd2baecSBarry Smith extern int KSPGMRESIROrthogonalization(KSP,int);
6708480c60SBarry Smith 
688ed539a5SBarry Smith extern int KSPSetFromOptions(KSP);
692eac72dbSBarry Smith 
70*af6b99e9SBarry Smith extern int KSPSingularvalueMonitor(KSP,int,double, void * );
71c01c455dSBarry Smith extern int KSPCGDefaultConverged(KSP,int,double, void *);
728ed539a5SBarry Smith extern int KSPDefaultMonitor(KSP,int,double, void *);
73*af6b99e9SBarry Smith extern int KSPTrueMonitor(KSP,int,double, void *);
748c48e012SBarry Smith extern int KSPDefaultSMonitor(KSP,int,double, void *);
758ed539a5SBarry Smith extern int KSPDefaultConverged(KSP,int,double, void *);
762eac72dbSBarry Smith 
77c01c455dSBarry Smith extern int KSPResidual(KSP,Vec,Vec,Vec,Vec,Vec,Vec);
7877c4ece6SBarry Smith extern int KSPUnwindPreconditioner(KSP,Vec,Vec);
79c01c455dSBarry Smith extern int KSPDefaultBuildSolution(KSP,Vec,Vec*);
80c01c455dSBarry Smith extern int KSPDefaultBuildResidual(KSP,Vec,Vec,Vec *);
81c01c455dSBarry Smith 
828ed539a5SBarry Smith extern int KSPPrintHelp(KSP);
838ed539a5SBarry Smith 
841eb62cbbSBarry Smith extern int KSPSetOptionsPrefix(KSP,char*);
850985bb82SSatish Balay extern int KSPAppendOptionsPrefix(KSP,char*);
860985bb82SSatish Balay extern int KSPGetOptionsPrefix(KSP,char**);
871eb62cbbSBarry Smith 
888ed539a5SBarry Smith extern int KSPView(KSP,Viewer);
891eb62cbbSBarry Smith 
90e559a7feSLois Curfman McInnes typedef enum {CG_SYMMETRIC=1, CG_HERMITIAN=2} CGType;
91e559a7feSLois Curfman McInnes extern int KSPCGSetType(KSP,CGType);
92e559a7feSLois Curfman McInnes 
931eb62cbbSBarry Smith #if defined(__DRAW_PACKAGE)
94d7e8b826SBarry Smith extern int KSPLGMonitorCreate(char*,char*,int,int,int,int,DrawLG*);
951eb62cbbSBarry Smith extern int KSPLGMonitor(KSP,int,double,void*);
96d7e8b826SBarry Smith extern int KSPLGMonitorDestroy(DrawLG);
97*af6b99e9SBarry Smith extern int KSPLGTrueMonitorCreate(char*,char*,int,int,int,int,DrawLG*);
98*af6b99e9SBarry Smith extern int KSPLGTrueMonitor(KSP,int,double,void*);
99*af6b99e9SBarry Smith extern int KSPLGTrueMonitorDestroy(DrawLG);
1001eb62cbbSBarry Smith #endif
1011eb62cbbSBarry Smith 
1022eac72dbSBarry Smith #endif
1032eac72dbSBarry Smith 
1042eac72dbSBarry Smith 
105