[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$ */
|
---|
[2291] | 62 | inline double lamlm(int l, int m) const
|
---|
| 63 | {
|
---|
| 64 | lambda_.CheckRelativeIndices(l,m);
|
---|
| 65 | return lambda_(l,m);
|
---|
| 66 | }
|
---|
[729] | 67 |
|
---|
[2291] | 68 | inline double lamlm(int index) const {
|
---|
| 69 | return lambda_(index);
|
---|
| 70 | }
|
---|
[1683] | 71 |
|
---|
| 72 |
|
---|
| 73 | //Return pointer to first element address of the alm's
|
---|
| 74 | //inline r_8* Data() {return lambda_.Data();}
|
---|
| 75 |
|
---|
| 76 |
|
---|
[729] | 77 | private:
|
---|
[2958] | 78 | static void updateArrayRecurrence(int_4 lmax);
|
---|
[729] | 79 |
|
---|
| 80 | void array_init(int lmax, int mmax);
|
---|
| 81 |
|
---|
| 82 |
|
---|
[1756] | 83 | // static TriangularMatrix<r_8>* a_recurrence_;
|
---|
| 84 | static TriangularMatrix<r_8> a_recurrence_;
|
---|
[729] | 85 | TriangularMatrix<r_8> lambda_;
|
---|
| 86 |
|
---|
| 87 | protected :
|
---|
| 88 |
|
---|
| 89 | void updateArrayLamNorm();
|
---|
| 90 |
|
---|
[1756] | 91 | // static TriangularMatrix<r_8>* lam_fact_;
|
---|
| 92 | static TriangularMatrix<r_8> lam_fact_;
|
---|
[729] | 93 | static TVector<r_8>* normal_l_;
|
---|
| 94 | int_4 lmax_;
|
---|
| 95 | int_4 mmax_;
|
---|
| 96 | r_8 cth_;
|
---|
| 97 | r_8 sth_;
|
---|
| 98 |
|
---|
| 99 | };
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | class LambdaWXBuilder : public LambdaLMBuilder
|
---|
| 103 | {
|
---|
[3533] | 104 | public:
|
---|
[729] | 105 |
|
---|
| 106 |
|
---|
| 107 | LambdaWXBuilder() {}
|
---|
| 108 |
|
---|
| 109 | LambdaWXBuilder(r_8 theta, int_4 lmax, int_4 mmax);
|
---|
| 110 |
|
---|
| 111 | /*! return the value of the coefficients \f$ _{w}\lambda_l^m\f$ and \f$_{x}\lambda_l^m\f$ */
|
---|
| 112 | inline void lam_wx(int l, int m, r_8& w, r_8& x) const
|
---|
| 113 | {
|
---|
[2291] | 114 | if (m > l )
|
---|
| 115 | {
|
---|
| 116 | throw RangeCheckError("LambdaWXBuilder::lam_wx : l < m !" );
|
---|
| 117 | }
|
---|
[729] | 118 | w=lamWlm_(l,m);
|
---|
| 119 | x=lamXlm_(l,m);
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | private:
|
---|
| 123 |
|
---|
| 124 | void array_init();
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | TriangularMatrix<r_8> lamWlm_;
|
---|
| 128 | TriangularMatrix<r_8> lamXlm_;
|
---|
| 129 |
|
---|
| 130 |
|
---|
| 131 | };
|
---|
| 132 |
|
---|
| 133 | class LambdaPMBuilder : public LambdaLMBuilder
|
---|
| 134 | {
|
---|
| 135 | public:
|
---|
| 136 |
|
---|
| 137 | LambdaPMBuilder() {}
|
---|
| 138 |
|
---|
| 139 | LambdaPMBuilder(r_8 theta, int_4 lmax, int_4 mmax);
|
---|
| 140 | /*! return the value of the coefficients \f$ _{+}\lambda_l^m\f$ and \f$_{-}\lambda_l^m\f$ */
|
---|
| 141 | inline void lam_pm(int l, int m, r_8& lambda_plus, r_8& lambda_moins) const
|
---|
| 142 | {
|
---|
[2291] | 143 | if (m > l )
|
---|
| 144 | {
|
---|
| 145 | throw RangeCheckError("LambdaPMBuilder::lam_pm : l < m !" );
|
---|
| 146 | }
|
---|
[729] | 147 | lambda_plus = lamPlm_(l,m);
|
---|
| 148 | lambda_moins = lamMlm_(l,m);
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | private:
|
---|
| 152 | void array_init();
|
---|
| 153 |
|
---|
| 154 | TriangularMatrix<r_8> lamPlm_;
|
---|
| 155 | TriangularMatrix<r_8> lamMlm_;
|
---|
| 156 |
|
---|
[864] | 157 | };
|
---|
[729] | 158 |
|
---|
[864] | 159 | } // Fin du namespace
|
---|
[729] | 160 |
|
---|
| 161 | #endif
|
---|