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"

     11: class TaoLinearSolverPetsc : public TaoLinearSolver {

     13:  protected:
     14:
     15:     KSP ksp;
     16:     PetscViewer pkspviewer;
     17:     PetscMap rrmap, rcmap;
     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*);
     28:
     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 MinQuadraticTrustRegion(TaoVec*,TaoVec*,double, TaoTruth*);

     41:     /* These ones are nice to have, but not necessary */
     42:     int GetNumberIterations(int *);
     43:     int View();
     44:     int SetOptions();
     45:     int SetTolerances(double, double, double, int);

     47:     /* These ones are extra, not virtual in base class */
     48:     int Duplicate(TaoLinearSolver**);
     49:     int SetTrustRadius(double);

     51: };

     53: #endif