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 | #include "pexceptions.h"
|
---|
9 |
|
---|
10 |
|
---|
11 | namespace SOPHYA {
|
---|
12 |
|
---|
13 | /*! class of Legendre polynomials */
|
---|
14 | class Legendre {
|
---|
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 | throw RangeCheckError("Legendre::getPl(l) l>lmax -> Instanciate class with greater lmax ...");
|
---|
22 | }
|
---|
23 | return Pl_(l);
|
---|
24 | }
|
---|
25 |
|
---|
26 | private :
|
---|
27 | Legendre() {;} // this is forbidden
|
---|
28 |
|
---|
29 | void array_init(int_4 lmax);
|
---|
30 |
|
---|
31 | r_8 x_;
|
---|
32 | int_4 lmax_;
|
---|
33 | TVector<r_8> Pl_;
|
---|
34 | };
|
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 | class LambdaLMBuilder {
|
---|
39 |
|
---|
40 | public:
|
---|
41 |
|
---|
42 | LambdaLMBuilder() {}
|
---|
43 | LambdaLMBuilder(r_8 theta,int_4 lmax, int_4 mmax);
|
---|
44 | LambdaLMBuilder(r_8 ct, r_8 st,int_4 lmax, int_4 mmax);
|
---|
45 |
|
---|
46 | virtual ~LambdaLMBuilder() {};
|
---|
47 |
|
---|
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 |
|
---|
61 | /*! return the value of the coefficient \f$ \lambda_l^m \f$ */
|
---|
62 | inline double lamlm(int l, int m) const
|
---|
63 | {
|
---|
64 | lambda_.CheckRelativeIndices(l,m);
|
---|
65 | return lambda_(l,m);
|
---|
66 | }
|
---|
67 |
|
---|
68 | inline double lamlm(int index) const {
|
---|
69 | return lambda_(index);
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 | //Return pointer to first element address of the alm's
|
---|
74 | //inline r_8* Data() {return lambda_.Data();}
|
---|
75 |
|
---|
76 |
|
---|
77 | private:
|
---|
78 | static void updateArrayRecurrence(int_4 lmax);
|
---|
79 |
|
---|
80 | void array_init(int lmax, int mmax);
|
---|
81 |
|
---|
82 |
|
---|
83 | // static TriangularMatrix<r_8>* a_recurrence_;
|
---|
84 | static TriangularMatrix<r_8> a_recurrence_;
|
---|
85 | TriangularMatrix<r_8> lambda_;
|
---|
86 |
|
---|
87 | protected :
|
---|
88 |
|
---|
89 | void updateArrayLamNorm();
|
---|
90 |
|
---|
91 | // static TriangularMatrix<r_8>* lam_fact_;
|
---|
92 | static TriangularMatrix<r_8> lam_fact_;
|
---|
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 | {
|
---|
104 | public:
|
---|
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 | {
|
---|
114 | if (m > l )
|
---|
115 | {
|
---|
116 | throw RangeCheckError("LambdaWXBuilder::lam_wx : l < m !" );
|
---|
117 | }
|
---|
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 | {
|
---|
143 | if (m > l )
|
---|
144 | {
|
---|
145 | throw RangeCheckError("LambdaPMBuilder::lam_pm : l < m !" );
|
---|
146 | }
|
---|
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 |
|
---|
157 | };
|
---|
158 |
|
---|
159 | } // Fin du namespace
|
---|
160 |
|
---|
161 | #endif
|
---|