]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMinResSolve.h
technical changes:
[u/mrichter/AliRoot.git] / STEER / AliMinResSolve.h
1 #ifndef ALIMINRESSOLVE_H
2 #define ALIMINRESSOLVE_H
3
4 #include <TObject.h>
5 #include <TVectorD.h>
6 #include <TMath.h>
7 #include "AliMatrixSq.h"
8 #include "AliMatrixSparse.h"
9 class AliLog;
10 class TStopwatch;
11
12 class AliMinResSolve : public TObject {
13   //
14  public:
15   enum {kPreconDiag=1,kPreconDILU=2,kPreconILU0=100,kPreconILU10=kPreconILU0+10,kPreconsTot};
16   enum {kSolMinRes,kSolFGMRes,kNSolvers};
17  public:
18   AliMinResSolve();
19   AliMinResSolve(const AliMatrixSq *mat, const TVectorD* rhs);
20   AliMinResSolve(const AliMatrixSq *mat, const double  * rhs);
21   AliMinResSolve(const AliMinResSolve& src);
22   ~AliMinResSolve();
23   AliMinResSolve& operator=(const AliMinResSolve& rhs);
24   //
25   // ---------  MINRES method (for symmetric matrices)
26   Bool_t SolveMinRes(Double_t* VecSol,Int_t precon=0,int itnlim=2000,double rtol=1e-12);
27   Bool_t SolveMinRes(TVectorD &VecSol,Int_t precon=0,int itnlim=2000,double rtol=1e-12);
28   //
29   // ---------  FGMRES method (for general symmetric matrices)
30   Bool_t SolveFGMRES(Double_t* VecSol,Int_t precon=0,int itnlim=2000,double rtol=1e-12, int nkrylov=60);
31   Bool_t SolveFGMRES(TVectorD &VecSol,Int_t precon=0,int itnlim=2000,double rtol=1e-12, int nkrylov=60);  
32   //
33   Bool_t InitAuxMinRes();
34   Bool_t InitAuxFGMRES(int nkrylov);
35   void   ApplyPrecon(const TVectorD& vecRHS, TVectorD& vecOut)     const;
36   void   ApplyPrecon(const double*   vecRHS, double*   vecOut)     const;
37   //
38   Int_t  BuildPrecon(Int_t val=0);
39   Int_t  GetPrecon()                                               const    {return fPrecon;} 
40   void   ClearAux();
41   //
42   Int_t  BuildPreconILUK(Int_t lofM);
43   Int_t  BuildPreconILUKDense(Int_t lofM);
44   Int_t  PreconILUKsymb(Int_t lofM);
45   Int_t  PreconILUKsymbDense(Int_t lofM);
46   //
47  protected:
48   //
49   Int_t               fSize;                             // dimension of the input matrix
50   Int_t               fPrecon;                           // preconditioner type
51   const AliMatrixSq*  fMatrix;                           // matrix defining the equations
52   const Double_t*     fRHS;                              // right hand side
53   //
54   Double_t            *fPVecY,*fPVecR1,*fPVecR2,*fPVecV,*fPVecW,*fPVecW1,*fPVecW2;// aux MinRes
55   Double_t            **fPvv,**fPvz,**fPhh;
56   Double_t            *fPrecDiag,*fPrecAux; // aux space
57   AliMatrixSparse     *fMatL,*fMatU;
58   //
59   ClassDef(AliMinResSolve,0)
60 };
61
62 #endif