LORENE
donne_lm.C
1/*
2 * Copyright (c) 1999-2001 Philippe Grandclement
3 * Copyright (c) 2000-2001 Eric Gourgoulhon
4 * Copyright (c) 2000-2001 Jerome Novak
5 *
6 * This file is part of LORENE.
7 *
8 * LORENE is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * LORENE is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with LORENE; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24
25char donne_lm_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/donne_lm.C,v 1.10 2014/10/13 08:53:12 j_novak Exp $" ;
26
27
28/*
29 * $Id: donne_lm.C,v 1.10 2014/10/13 08:53:12 j_novak Exp $
30 * $Log: donne_lm.C,v $
31 * Revision 1.10 2014/10/13 08:53:12 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.9 2014/10/06 15:16:02 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.8 2009/10/26 10:48:37 j_novak
38 * Completed the T_LEG_MI case.
39 *
40 * Revision 1.7 2009/10/23 12:54:47 j_novak
41 * New base T_LEG_MI
42 *
43 * Revision 1.6 2009/10/13 19:45:01 j_novak
44 * New base T_LEG_MP.
45 *
46 * Revision 1.5 2005/02/18 13:14:13 j_novak
47 * Changing of malloc/free to new/delete + suppression of some unused variables
48 * (trying to avoid compilation warnings).
49 *
50 * Revision 1.4 2004/11/23 15:13:50 m_forot
51 * Added the bases for the cases without any equatorial symmetry
52 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
53 *
54 * Revision 1.3 2003/09/16 12:11:59 j_novak
55 * Added the base T_LEG_II.
56 *
57 * Revision 1.2 2002/10/16 14:36:54 j_novak
58 * Reorganization of #include instructions of standard C++, in order to
59 * use experimental version 3 of gcc.
60 *
61 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
62 * LORENE
63 *
64 * Revision 3.0 2000/10/09 09:15:01 novak
65 * correction pour les cas de bases en r alternees
66 *
67 * Revision 2.8 2000/10/04 14:55:33 eric
68 * Ajout des bases T_LEG_IP et T_LEG_PI.
69 *
70 * Revision 2.7 1999/12/16 16:41:33 phil
71 * *** empty log message ***
72 *
73 * Revision 2.6 1999/12/16 16:23:39 phil
74 * vire un assert
75 *
76 * Revision 2.5 1999/12/16 16:21:38 phil
77 * correction cas nt = 1
78 *
79 * Revision 2.4 1999/09/16 12:06:11 phil
80 * correction des cas antisymetriques en z=0
81 *
82 * Revision 2.3 1999/09/14 17:52:59 phil
83 * *** empty log message ***
84 *
85 * Revision 2.2 1999/09/14 17:44:16 phil
86 * *** empty log message ***
87 *
88 * Revision 2.1 1999/04/13 13:50:01 phil
89 * *** empty log message ***
90 *
91 * Revision 2.0 1999/04/13 13:31:01 phil
92 * *** empty log message ***
93 *
94 * Revision 1.1 1999/04/13 13:30:28 phil
95 * Initial revision
96 *
97 *
98 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/donne_lm.C,v 1.10 2014/10/13 08:53:12 j_novak Exp $
99 *
100 */
101
102// Entetes C
103#include <cstdlib>
104
105// Entete Lorene
106#include "headcpp.h"
107#include "type_parite.h"
108#include "base_val.h"
109
110/*
111 * Fonction affection les nombres l_quant, m_quant et la base en r
112 *
113 * ENTREES : nz : le nombre de zones
114 * zone : la zone de travail
115 * j et k : indices en theta et phi, respectivement
116 * base : la base de developpement
117 *
118 * SORTIES : les variables m_quant, l_quant et base_r.
119 *
120 */
121
122//-----------------------------------------------------------------
123// Developpement en P_COSSIN pour phi et T_LEG en theta
124//-------------------------------------------------------------------
125
126namespace Lorene {
127void donne_lm_nonsymTP (int j, int k, int &m_quant, int &l_quant) {
128
129 m_quant = (k%2 == 0) ? k/2 : (k-1)/2;
130 l_quant = j ;
131
132}
133
134
135 //-----------------------------------------------------------------
136 // Developpement en P_COSSIN pour phi et T_LEG_P en theta
137 //-------------------------------------------------------------------
138
139void donne_lm_nonsym (int j, int k, int &m_quant, int &l_quant) {
140
141 m_quant = (k%2 == 0) ? k/2 : (k-1)/2;
142 l_quant = (m_quant%2 == 0) ? 2*j : 2*j+1 ;
143
144}
145
146 //-----------------------------------------------------------------
147 // Developpement en P_COSSIN pour phi et T_LEG_I en theta
148 //-------------------------------------------------------------------
149
150void donne_lm_nonsym_anti (int j, int k, int &m_quant, int &l_quant) {
151
152 m_quant = (k%2 == 0) ? k/2 : (k-1)/2;
153 l_quant = (m_quant%2 == 1) ? 2*j : 2*j+1 ;
154
155}
156
157 //------------------------------------------------------
158 // Developpement en P_COSSIN_P pour phi et T_LEG_PP en theta
159 //-------------------------------------------------------
160
161void donne_lm_sym (int j, int k, int &m_quant, int &l_quant) {
162
163 m_quant = (k%2 == 0) ? k : k-1;
164 l_quant = 2*j ;
165
166}
167
168
169 //-------------------------------------------------------
170 // Developpement en P_COSSIN_P pour phi et T_LEG_IP en theta
171 //---------------------------------------------------------
172
173void donne_lm_t_leg_ip (int j, int k, int &m_quant, int &l_quant) {
174
175 m_quant = (k%2 == 0) ? k : k-1 ;
176 l_quant = 2*j+1 ;
177
178}
179
180
181 //----------------------------------------------------------
182 // Developpement en P_COSSIN_P pour phi et T_LEG_MP en theta
183 //------------------------------------------------------------
184
185void donne_lm_t_leg_mp (int j, int k, int &m_quant, int &l_quant) {
186
187 m_quant = (k%2 == 0) ? k : k-1;
188 l_quant = j ;
189
190}
191
192 //----------------------------------------------------------
193 // Developpement en P_COSSIN_I pour phi et T_LEG_MI en theta
194 //------------------------------------------------------------
195
196void donne_lm_t_leg_mi (int j, int k, int &m_quant, int &l_quant) {
197
198 m_quant = 2*((k-1)/2 ) + 1 ;
199 l_quant = j ;
200
201}
202
203 //-------------------------------------------------------
204 // Developpement en P_COSSIN_I pour phi et T_LEG_PI en theta
205 //---------------------------------------------------------
206
207void donne_lm_t_leg_pi (int j, int k, int &m_quant, int &l_quant) {
208
209 if (k<=2) {
210 m_quant = 1 ;
211 }
212 else{
213 m_quant = (k%2 == 0) ? k-1 : k ;
214 }
215
216 l_quant = 2*j+1 ;
217
218}
219
220 //-------------------------------------------------------
221 // Developpement en P_COSSIN_I pour phi et T_LEG_II en theta
222 //---------------------------------------------------------
223
224void donne_lm_t_leg_ii (int j, int k, int &m_quant, int &l_quant) {
225
226 if (k<=2) {
227 m_quant = 1 ;
228 }
229 else{
230 m_quant = (k%2 == 0) ? k-1 : k ;
231 }
232
233 l_quant = 2*j ;
234
235}
236
237
238
239 //-----------------------------
240 // La fonction
241 //-------------------------------
242
243void donne_lm (int nz, int zone, int j, int k, Base_val base,
244 int &m_quant, int &l_quant, int& base_r) {
245
246 //verifications :
247 assert (zone >= 0) ;
248 assert (zone < nz) ;
249
250 int base_t = (base.b[zone] & MSQ_T) ;
251 int base_p = (base.b[zone] & MSQ_P) ;
252 base_r = (base.b[zone] & MSQ_R) ;
253
254 switch (base_p) {
255 case P_COSSIN :
256 // cas sym ou antisym en z=0 ...
257 switch (base_t) {
258
259 case T_LEG :
260 donne_lm_nonsymTP (j, k, m_quant, l_quant) ;
261 break ;
262
263 case T_LEG_P :
264 donne_lm_nonsym (j, k, m_quant, l_quant) ;
265 break ;
266
267 case T_LEG_I :
268 donne_lm_nonsym_anti (j, k, m_quant, l_quant) ;
269 break ;
270
271 default :
272 cout << "donne_lm : cas inconnu ..." << endl ;
273 abort() ;
274 break ;
275 }
276 break ;
277
278 case P_COSSIN_P :
279 switch (base_t) {
280
281 case T_LEG_PP :
282 donne_lm_sym (j, k, m_quant, l_quant) ;
283 break ;
284
285 case T_LEG_MP :
286 donne_lm_t_leg_mp (j, k, m_quant, l_quant) ;
287 break ;
288
289 case T_LEG_IP :
290 donne_lm_t_leg_ip (j, k, m_quant, l_quant);
291 break ;
292
293 default :
294 cout << "donne_lm : cas inconnu ..." << endl ;
295 abort() ;
296 break ;
297 }
298 break ;
299
300 case P_COSSIN_I :
301 switch (base_t) {
302
303 case T_LEG_PI :
304 donne_lm_t_leg_pi (j, k, m_quant, l_quant) ;
305 break ;
306
307 case T_LEG_II :
308 donne_lm_t_leg_ii (j, k, m_quant, l_quant) ;
309 break ;
310
311 case T_LEG_MI :
312 donne_lm_t_leg_mp (j, k, m_quant, l_quant) ;
313 break ;
314
315 default :
316 cout << "donne_lm : cas inconnu ..." << endl ;
317 abort() ;
318 break ;
319
320 }
321 break ;
322
323 default :
324 cout << "donne_lm : cas inconnu ..." << endl ;
325 cout << nz << endl ; // to avoid compilation warnings ...
326 abort() ;
327 break ;
328 }
329 switch (base_r) {
330
331 case R_CHEBPI_P :
332 base_r = (l_quant%2 == 0) ? R_CHEBP : R_CHEBI ;
333 break ;
334
335 case R_CHEBPI_I :
336 base_r = (l_quant%2 == 1) ? R_CHEBP : R_CHEBI ;
337 break ;
338
339 case R_CHEBPIM_P :
340 base_r = (m_quant%2 == 0) ? R_CHEBP : R_CHEBI ;
341 break ;
342
343 case R_CHEBPIM_I :
344 base_r = (m_quant%2 == 1) ? R_CHEBP : R_CHEBI ;
345 break ;
346
347 }
348}
349}
#define T_LEG_MP
fct. de Legendre associees avec m pair
#define P_COSSIN_P
dev. sur Phi = 2*phi, freq. paires
#define T_LEG_PI
fct. de Legendre associees paires avec m impair
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define T_LEG
fct. de Legendre associees
#define MSQ_R
Extraction de l'info sur R.
#define R_CHEBPIM_I
Cheb. pair-impair suivant m, impair pour m=0.
#define R_CHEBPI_I
Cheb. pair-impair suivant l impair pour l=0.
#define T_LEG_P
fct. de Legendre associees paires
#define T_LEG_IP
fct. de Legendre associees impaires avec m pair
#define P_COSSIN
dev. standart
#define P_COSSIN_I
dev. sur Phi = 2*phi, freq. impaires
#define R_CHEBPIM_P
Cheb. pair-impair suivant m, pair pour m=0.
#define T_LEG_MI
fct. de Legendre associees avec m impair
#define MSQ_T
Extraction de l'info sur Theta.
#define T_LEG_II
fct. de Legendre associees impaires avec m impair
#define T_LEG_I
fct. de Legendre associees impaires
#define R_CHEBP
base de Cheb. paire (rare) seulement
#define MSQ_P
Extraction de l'info sur Phi.
#define T_LEG_PP
fct. de Legendre associees paires avec m pair
#define R_CHEBPI_P
Cheb. pair-impair suivant l pair pour l=0.
Lorene prototypes.
Definition app_hor.h:64