]>
Commit | Line | Data |
---|---|---|
8a9ab0eb | 1 | #ifndef ALIMINRESSOLVE_H |
2 | #define ALIMINRESSOLVE_H | |
3 | ||
7c3070ec | 4 | /**********************************************************************************************/ |
5 | /* General class for solving large system of linear equations */ | |
6 | /* Includes MINRES, FGMRES methods as well as a few precondiotiong methods */ | |
7 | /* */ | |
8 | /* Author: ruben.shahoyan@cern.ch */ | |
9 | /* */ | |
10 | /**********************************************************************************************/ | |
11 | ||
8a9ab0eb | 12 | #include <TObject.h> |
13 | #include <TVectorD.h> | |
7c3070ec | 14 | class AliMatrixSq; |
15 | class AliMatrixSparse; | |
16 | class AliSymBDMatrix; | |
17 | ||
8a9ab0eb | 18 | |
19 | class AliMinResSolve : public TObject { | |
20 | // | |
21 | public: | |
7c3070ec | 22 | enum {kPreconBD=1,kPreconILU0=100,kPreconILU10=kPreconILU0+10,kPreconsTot}; |
8a9ab0eb | 23 | enum {kSolMinRes,kSolFGMRes,kNSolvers}; |
24 | public: | |
25 | AliMinResSolve(); | |
26 | AliMinResSolve(const AliMatrixSq *mat, const TVectorD* rhs); | |
27 | AliMinResSolve(const AliMatrixSq *mat, const double * rhs); | |
28 | AliMinResSolve(const AliMinResSolve& src); | |
29 | ~AliMinResSolve(); | |
30 | AliMinResSolve& operator=(const AliMinResSolve& rhs); | |
31 | // | |
32 | // --------- MINRES method (for symmetric matrices) | |
33 | Bool_t SolveMinRes(Double_t* VecSol,Int_t precon=0,int itnlim=2000,double rtol=1e-12); | |
34 | Bool_t SolveMinRes(TVectorD &VecSol,Int_t precon=0,int itnlim=2000,double rtol=1e-12); | |
35 | // | |
36 | // --------- FGMRES method (for general symmetric matrices) | |
37 | Bool_t SolveFGMRES(Double_t* VecSol,Int_t precon=0,int itnlim=2000,double rtol=1e-12, int nkrylov=60); | |
38 | Bool_t SolveFGMRES(TVectorD &VecSol,Int_t precon=0,int itnlim=2000,double rtol=1e-12, int nkrylov=60); | |
39 | // | |
40 | Bool_t InitAuxMinRes(); | |
41 | Bool_t InitAuxFGMRES(int nkrylov); | |
42 | void ApplyPrecon(const TVectorD& vecRHS, TVectorD& vecOut) const; | |
43 | void ApplyPrecon(const double* vecRHS, double* vecOut) const; | |
44 | // | |
45 | Int_t BuildPrecon(Int_t val=0); | |
46 | Int_t GetPrecon() const {return fPrecon;} | |
47 | void ClearAux(); | |
48 | // | |
7c3070ec | 49 | Int_t BuildPreconBD(Int_t hwidth); |
8a9ab0eb | 50 | Int_t BuildPreconILUK(Int_t lofM); |
51 | Int_t BuildPreconILUKDense(Int_t lofM); | |
52 | Int_t PreconILUKsymb(Int_t lofM); | |
53 | Int_t PreconILUKsymbDense(Int_t lofM); | |
54 | // | |
55 | protected: | |
56 | // | |
57 | Int_t fSize; // dimension of the input matrix | |
58 | Int_t fPrecon; // preconditioner type | |
7c3070ec | 59 | AliMatrixSq* fMatrix; // matrix defining the equations |
60 | Double_t* fRHS; // right hand side | |
8a9ab0eb | 61 | // |
7c3070ec | 62 | Double_t *fPVecY; // aux. space |
63 | Double_t *fPVecR1; // aux. space | |
64 | Double_t *fPVecR2; // aux. space | |
65 | Double_t *fPVecV; // aux. space | |
66 | Double_t *fPVecW; // aux. space | |
67 | Double_t *fPVecW1; // aux. space | |
68 | Double_t *fPVecW2; // aux. space | |
69 | Double_t **fPvv; // aux. space | |
70 | Double_t **fPvz; // aux. space | |
71 | Double_t **fPhh; // aux. space | |
72 | Double_t *fDiagLU; // aux space | |
73 | AliMatrixSparse *fMatL; // aux. space | |
74 | AliMatrixSparse *fMatU; // aux. space | |
75 | AliSymBDMatrix *fMatBD; // aux. space | |
8a9ab0eb | 76 | // |
77 | ClassDef(AliMinResSolve,0) | |
78 | }; | |
79 | ||
80 | #endif |