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