| 1 | #ifndef LAMBDABUILDER_SEEN | 
|---|
| 2 | #define LAMBDABUILDER_SEEN | 
|---|
| 3 |  | 
|---|
| 4 | #include <math.h> | 
|---|
| 5 | #include "ndatablock.h" | 
|---|
| 6 | #include "tvector.h" | 
|---|
| 7 | #include "alm.h" | 
|---|
| 8 |  | 
|---|
| 9 |  | 
|---|
| 10 | namespace SOPHYA { | 
|---|
| 11 |  | 
|---|
| 12 | /*!  classe pour les polynomes de legendre*/ | 
|---|
| 13 | class Legendre { | 
|---|
| 14 |  | 
|---|
| 15 | public : | 
|---|
| 16 | Legendre(); | 
|---|
| 17 | Legendre(r_8 x, int_4 lmax); | 
|---|
| 18 | inline r_8 getPl(int_4 l) | 
|---|
| 19 | { | 
|---|
| 20 | if (l>lmax_) | 
|---|
| 21 | { | 
|---|
| 22 | throw (" illegal call of Legendre::getPl with index greater than lmax, which Legendre Class was instanciated with : instanciate Legendre with a greater lmax... "); | 
|---|
| 23 | } | 
|---|
| 24 | return Pl_(l); | 
|---|
| 25 | } | 
|---|
| 26 |  | 
|---|
| 27 | private : | 
|---|
| 28 | void array_init(int_4 lmax); | 
|---|
| 29 |  | 
|---|
| 30 | r_8 x_; | 
|---|
| 31 | int_4 lmax_; | 
|---|
| 32 | TVector<r_8> Pl_; | 
|---|
| 33 | }; | 
|---|
| 34 |  | 
|---|
| 35 |  | 
|---|
| 36 |  | 
|---|
| 37 | class LambdaLMBuilder { | 
|---|
| 38 |  | 
|---|
| 39 | public: | 
|---|
| 40 |  | 
|---|
| 41 | LambdaLMBuilder() {} | 
|---|
| 42 | LambdaLMBuilder(r_8 theta,int_4 lmax, int_4 mmax); | 
|---|
| 43 | virtual ~LambdaLMBuilder() {}; | 
|---|
| 44 |  | 
|---|
| 45 | /*! return the value of the coefficient \f$  \lambda_l^m \f$ */ | 
|---|
| 46 | inline double lamlm(int l, int m) const { return lambda_(l,m); } | 
|---|
| 47 |  | 
|---|
| 48 | private: | 
|---|
| 49 | void updateArrayRecurrence(int_4 lmax); | 
|---|
| 50 |  | 
|---|
| 51 | void array_init(int lmax, int mmax); | 
|---|
| 52 |  | 
|---|
| 53 |  | 
|---|
| 54 | static TriangularMatrix<r_8>* a_recurrence_; | 
|---|
| 55 | TriangularMatrix<r_8> lambda_; | 
|---|
| 56 |  | 
|---|
| 57 | protected : | 
|---|
| 58 |  | 
|---|
| 59 | void updateArrayLamNorm(); | 
|---|
| 60 |  | 
|---|
| 61 | static  TriangularMatrix<r_8>* lam_fact_; | 
|---|
| 62 | static  TVector<r_8>*  normal_l_; | 
|---|
| 63 | int_4 lmax_; | 
|---|
| 64 | int_4 mmax_; | 
|---|
| 65 | r_8 cth_; | 
|---|
| 66 | r_8 sth_; | 
|---|
| 67 |  | 
|---|
| 68 | }; | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 |  | 
|---|
| 72 | class LambdaWXBuilder : public LambdaLMBuilder | 
|---|
| 73 | { | 
|---|
| 74 | public: | 
|---|
| 75 |  | 
|---|
| 76 |  | 
|---|
| 77 | LambdaWXBuilder() {} | 
|---|
| 78 |  | 
|---|
| 79 | LambdaWXBuilder(r_8 theta, int_4 lmax, int_4 mmax); | 
|---|
| 80 |  | 
|---|
| 81 | /*! return the value of the coefficients \f$ _{w}\lambda_l^m\f$ and \f$_{x}\lambda_l^m\f$ */ | 
|---|
| 82 | inline void lam_wx(int l, int m, r_8& w, r_8& x) const | 
|---|
| 83 | { | 
|---|
| 84 | w=lamWlm_(l,m); | 
|---|
| 85 | x=lamXlm_(l,m); | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | private: | 
|---|
| 89 |  | 
|---|
| 90 | void array_init(); | 
|---|
| 91 |  | 
|---|
| 92 |  | 
|---|
| 93 | TriangularMatrix<r_8> lamWlm_; | 
|---|
| 94 | TriangularMatrix<r_8> lamXlm_; | 
|---|
| 95 |  | 
|---|
| 96 |  | 
|---|
| 97 | }; | 
|---|
| 98 |  | 
|---|
| 99 | class LambdaPMBuilder : public LambdaLMBuilder | 
|---|
| 100 | { | 
|---|
| 101 | public: | 
|---|
| 102 |  | 
|---|
| 103 | LambdaPMBuilder() {} | 
|---|
| 104 |  | 
|---|
| 105 | LambdaPMBuilder(r_8 theta, int_4 lmax, int_4 mmax); | 
|---|
| 106 | /*! return the value of the coefficients \f$ _{+}\lambda_l^m\f$ and \f$_{-}\lambda_l^m\f$ */ | 
|---|
| 107 | inline void lam_pm(int l, int m, r_8& lambda_plus, r_8& lambda_moins) const | 
|---|
| 108 | { | 
|---|
| 109 | lambda_plus = lamPlm_(l,m); | 
|---|
| 110 | lambda_moins = lamMlm_(l,m); | 
|---|
| 111 | } | 
|---|
| 112 |  | 
|---|
| 113 | private: | 
|---|
| 114 | void array_init(); | 
|---|
| 115 |  | 
|---|
| 116 | TriangularMatrix<r_8> lamPlm_; | 
|---|
| 117 | TriangularMatrix<r_8> lamMlm_; | 
|---|
| 118 |  | 
|---|
| 119 | }; | 
|---|
| 120 |  | 
|---|
| 121 | } // Fin du namespace | 
|---|
| 122 |  | 
|---|
| 123 | #endif | 
|---|