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