Actual source code: taolinearsolver_petsc.h
1: #ifndef TAOPETSCSOLVER_H
2: #define TAOPETSCSOLVER_H
4: #define TAO_USE_PETSC
6: #include "taolinearsolver.h"
8: #include "petscksp.h"
9: #include "petscpc.h"
12: class TaoLinearSolverPetsc : public TaoLinearSolver {
14: protected:
15:
16: KSP ksp;
17: PetscViewer pkspviewer;
18: int linear_its;
20: public:
22: TaoLinearSolverPetsc(KSP);
23: ~TaoLinearSolverPetsc();
24:
25: inline KSP GetKSP() {return ksp;}
26: int SetKSP(KSP);
27: int GetKSP(KSP*);
29: /*
30: The following methods are implementations of
31: the virtual methods in the base class
32: */
34: /* These ones are necessary */
35: int PreSolve(TaoMat*);
36: int Solve(TaoVec*,TaoVec*, TaoTruth*);
38: /* Some methods need this */
39: int SolveTrustRegion(TaoVec*,TaoVec*,double, TaoTruth*);
40: int SetTolerances(double rtol, double atol, double dtol, int maxits);
42: /* These ones are nice to have, but not necessary */
43: int GetNumberIterations(int *);
44: int View();
45: int SetOptions();
47: /* These ones are extra, not virtual in base class */
48: int SetTrustRadius(double);
49: int GetNormDirection(double *);
50: int GetObjFcn(double *);
51: int GetMinEig(double *);
52: int GetLambda(double *);
53: };
55: #endif