| [729] | 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" | 
|---|
| [3533] | 8 | #include "pexceptions.h" | 
|---|
| [729] | 9 |  | 
|---|
| [864] | 10 |  | 
|---|
|  | 11 | namespace SOPHYA { | 
|---|
|  | 12 |  | 
|---|
| [3533] | 13 | /*!  class of Legendre polynomials  */ | 
|---|
| [729] | 14 | class Legendre { | 
|---|
| [3533] | 15 | public : | 
|---|
|  | 16 | Legendre(r_8 x, int_4 lmax); | 
|---|
| [729] | 17 |  | 
|---|
| [3533] | 18 | inline r_8 getPl(int_4 l) const | 
|---|
|  | 19 | { | 
|---|
|  | 20 | if (l>lmax_)  { | 
|---|
|  | 21 | throw RangeCheckError("Legendre::getPl(l) l>lmax -> Instanciate class with greater lmax ..."); | 
|---|
|  | 22 | } | 
|---|
|  | 23 | return Pl_(l); | 
|---|
|  | 24 | } | 
|---|
| [2291] | 25 |  | 
|---|
| [3533] | 26 | private : | 
|---|
|  | 27 | Legendre() {;}   // this is forbidden | 
|---|
| [729] | 28 |  | 
|---|
| [3533] | 29 | void array_init(int_4 lmax); | 
|---|
| [2291] | 30 |  | 
|---|
| [729] | 31 | r_8 x_; | 
|---|
|  | 32 | int_4 lmax_; | 
|---|
|  | 33 | TVector<r_8> Pl_; | 
|---|
|  | 34 | }; | 
|---|
|  | 35 |  | 
|---|
|  | 36 |  | 
|---|
|  | 37 |  | 
|---|
| [3533] | 38 | class LambdaLMBuilder { | 
|---|
| [729] | 39 |  | 
|---|
| [3533] | 40 | public: | 
|---|
| [729] | 41 |  | 
|---|
|  | 42 | LambdaLMBuilder() {} | 
|---|
|  | 43 | LambdaLMBuilder(r_8 theta,int_4 lmax, int_4 mmax); | 
|---|
| [1683] | 44 | LambdaLMBuilder(r_8 ct, r_8 st,int_4 lmax, int_4 mmax); | 
|---|
| [2958] | 45 |  | 
|---|
| [864] | 46 | virtual ~LambdaLMBuilder() {}; | 
|---|
| [729] | 47 |  | 
|---|
| [2958] | 48 |  | 
|---|
|  | 49 | //--- Optimisation Reza mai 2006 Serie de fonctions statiques | 
|---|
|  | 50 | // specialisees/optimisees pour SphericalTransform | 
|---|
|  | 51 | static void ComputeBmFrAlm(r_8 theta,int_4 lmax, int_4 mmax, | 
|---|
|  | 52 | const Alm<r_8>& alm, Bm< complex<r_8> >& bm); | 
|---|
|  | 53 | static void ComputeBmFrAlm(r_8 theta,int_4 lmax, int_4 mmax, | 
|---|
|  | 54 | const Alm<r_4>& alm, Bm< complex<r_4> >& bm); | 
|---|
|  | 55 | static void ComputeAlmFrPhase(r_8 theta,int_4 lmax, int_4 mmax, | 
|---|
|  | 56 | TVector< complex<r_8> >& phase, Alm<r_8> & alm); | 
|---|
|  | 57 | static void ComputeAlmFrPhase(r_8 theta,int_4 lmax, int_4 mmax, | 
|---|
|  | 58 | TVector< complex<r_4> >& phase, Alm<r_4> & alm); | 
|---|
|  | 59 | //---- Fin foctions specialisees | 
|---|
|  | 60 |  | 
|---|
| [729] | 61 | /*! return the value of the coefficient \f$  \lambda_l^m \f$ */ | 
|---|
| [3810] | 62 | inline double lamlm(int l, int m) const   { | 
|---|
|  | 63 | return lambda_(l,m); | 
|---|
|  | 64 | } | 
|---|
| [729] | 65 |  | 
|---|
| [2291] | 66 | inline double lamlm(int index) const { | 
|---|
| [3810] | 67 | return lambda_[index]; | 
|---|
| [2291] | 68 | } | 
|---|
| [1683] | 69 |  | 
|---|
|  | 70 |  | 
|---|
|  | 71 | //Return pointer to first element address of the alm's | 
|---|
|  | 72 | //inline r_8* Data()  {return lambda_.Data();} | 
|---|
|  | 73 |  | 
|---|
|  | 74 |  | 
|---|
| [729] | 75 | private: | 
|---|
| [2958] | 76 | static void updateArrayRecurrence(int_4 lmax); | 
|---|
| [729] | 77 |  | 
|---|
|  | 78 | void array_init(int lmax, int mmax); | 
|---|
|  | 79 |  | 
|---|
|  | 80 |  | 
|---|
| [3810] | 81 | // static LowerTriangularMatrix<r_8>* a_recurrence_; | 
|---|
|  | 82 | static LowerTriangularMatrix<r_8> a_recurrence_; | 
|---|
|  | 83 | LowerTriangularMatrix<r_8> lambda_; | 
|---|
| [729] | 84 |  | 
|---|
|  | 85 | protected : | 
|---|
|  | 86 |  | 
|---|
|  | 87 | void updateArrayLamNorm(); | 
|---|
|  | 88 |  | 
|---|
| [3810] | 89 | // static  LowerTriangularMatrix<r_8>* lam_fact_; | 
|---|
|  | 90 | static  LowerTriangularMatrix<r_8> lam_fact_; | 
|---|
| [729] | 91 | static  TVector<r_8>*  normal_l_; | 
|---|
|  | 92 | int_4 lmax_; | 
|---|
|  | 93 | int_4 mmax_; | 
|---|
|  | 94 | r_8 cth_; | 
|---|
|  | 95 | r_8 sth_; | 
|---|
|  | 96 |  | 
|---|
|  | 97 | }; | 
|---|
|  | 98 |  | 
|---|
|  | 99 |  | 
|---|
|  | 100 | class LambdaWXBuilder : public LambdaLMBuilder | 
|---|
|  | 101 | { | 
|---|
| [3533] | 102 | public: | 
|---|
| [729] | 103 |  | 
|---|
|  | 104 |  | 
|---|
|  | 105 | LambdaWXBuilder() {} | 
|---|
|  | 106 |  | 
|---|
|  | 107 | LambdaWXBuilder(r_8 theta, int_4 lmax, int_4 mmax); | 
|---|
|  | 108 |  | 
|---|
|  | 109 | /*! return the value of the coefficients \f$ _{w}\lambda_l^m\f$ and \f$_{x}\lambda_l^m\f$ */ | 
|---|
|  | 110 | inline void lam_wx(int l, int m, r_8& w, r_8& x) const | 
|---|
|  | 111 | { | 
|---|
| [2291] | 112 | if (m > l ) | 
|---|
|  | 113 | { | 
|---|
|  | 114 | throw RangeCheckError("LambdaWXBuilder::lam_wx : l < m !" ); | 
|---|
|  | 115 | } | 
|---|
| [729] | 116 | w=lamWlm_(l,m); | 
|---|
|  | 117 | x=lamXlm_(l,m); | 
|---|
|  | 118 | } | 
|---|
|  | 119 |  | 
|---|
|  | 120 | private: | 
|---|
|  | 121 |  | 
|---|
|  | 122 | void array_init(); | 
|---|
|  | 123 |  | 
|---|
|  | 124 |  | 
|---|
| [3810] | 125 | LowerTriangularMatrix<r_8> lamWlm_; | 
|---|
|  | 126 | LowerTriangularMatrix<r_8> lamXlm_; | 
|---|
| [729] | 127 |  | 
|---|
|  | 128 |  | 
|---|
|  | 129 | }; | 
|---|
|  | 130 |  | 
|---|
|  | 131 | class LambdaPMBuilder : public LambdaLMBuilder | 
|---|
|  | 132 | { | 
|---|
|  | 133 | public: | 
|---|
|  | 134 |  | 
|---|
|  | 135 | LambdaPMBuilder() {} | 
|---|
|  | 136 |  | 
|---|
|  | 137 | LambdaPMBuilder(r_8 theta, int_4 lmax, int_4 mmax); | 
|---|
|  | 138 | /*! return the value of the coefficients \f$ _{+}\lambda_l^m\f$ and \f$_{-}\lambda_l^m\f$ */ | 
|---|
|  | 139 | inline void lam_pm(int l, int m, r_8& lambda_plus, r_8& lambda_moins) const | 
|---|
|  | 140 | { | 
|---|
| [2291] | 141 | if (m > l ) | 
|---|
|  | 142 | { | 
|---|
|  | 143 | throw RangeCheckError("LambdaPMBuilder::lam_pm : l < m !" ); | 
|---|
|  | 144 | } | 
|---|
| [729] | 145 | lambda_plus = lamPlm_(l,m); | 
|---|
|  | 146 | lambda_moins = lamMlm_(l,m); | 
|---|
|  | 147 | } | 
|---|
|  | 148 |  | 
|---|
|  | 149 | private: | 
|---|
|  | 150 | void array_init(); | 
|---|
|  | 151 |  | 
|---|
| [3810] | 152 | LowerTriangularMatrix<r_8> lamPlm_; | 
|---|
|  | 153 | LowerTriangularMatrix<r_8> lamMlm_; | 
|---|
| [729] | 154 |  | 
|---|
| [864] | 155 | }; | 
|---|
| [729] | 156 |  | 
|---|
| [864] | 157 | } // Fin du namespace | 
|---|
| [729] | 158 |  | 
|---|
|  | 159 | #endif | 
|---|