Debian Codegraph @

C++/Source/Mg3d/mg3d_std_base.C

raw
1 /*
2 * Methods of class Mg3d to get the standard spectral bases for scalar and
3 * vector fields.
4 */
5
6 /*
7 * Copyright (c) 1999-2001 Eric Gourgoulhon
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * LORENE is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with LORENE; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27
28 char mg3d_std_base_C[] = "$Header: /cvsroot/Lorene/C++/Source/Mg3d/mg3d_std_base.C,v 1.13 2014/10/13 08:53:07 j_novak Exp $" ;
29
30 /*
31 * $Id: mg3d_std_base.C,v 1.13 2014/10/13 08:53:07 j_novak Exp $
32 * $Log: mg3d_std_base.C,v $
33 * Revision 1.13 2014/10/13 08:53:07 j_novak
34 * Lorene classes and functions now belong to the namespace Lorene.
35 *
36 * Revision 1.12 2014/10/06 15:13:14 j_novak
37 * Modified #include directives to use c++ syntax.
38 *
39 * Revision 1.11 2013/06/05 15:10:42 j_novak
40 * Suppression of FINJAC sampling in r. This Jacobi(0,2) base is now
41 * available by setting colloc_r to BASE_JAC02 in the Mg3d constructor.
42 *
43 * Revision 1.10 2012/01/24 15:02:28 j_novak
44 * Minor change to avoid warnings
45 *
46 * Revision 1.9 2009/10/08 16:21:02 j_novak
47 * Addition of new bases T_COS and T_SIN.
48 *
49 * Revision 1.8 2008/10/29 08:21:35 jl_cornou
50 * Spectral bases for pseudo vectors added
51 *
52 * Revision 1.7 2007/12/14 10:19:32 jl_cornou
53 * *** empty log message ***
54 *
55 * Revision 1.6 2005/10/25 08:56:37 p_grandclement
56 * addition of std_spectral_base in the case of odd functions near the origin
57 *
58 * Revision 1.5 2005/02/16 15:09:16 m_forot
59 * Add R_CHEBPI_I and R_CHEBPI_P cases
60 *
61 * Revision 1.4 2004/11/04 15:21:42 e_gourgoulhon
62 * The case without any symmetry in theta is now treated.
63 *
64 * Revision 1.3 2003/12/19 16:21:45 j_novak
65 * Shadow hunt
66 *
67 * Revision 1.2 2002/08/13 08:02:45 j_novak
68 * Handling of spherical vector/tensor components added in the classes
69 * Mg3d and Tenseur. Minor corrections for the class Metconf.
70 *
71 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
72 * LORENE
73 *
74 * Revision 1.2 2000/09/27 15:07:40 eric
75 * Correction dans le cas type_p = SYM.
76 *
77 * Revision 1.1 1999/10/12 14:54:43 eric
78 * Initial revision
79 *
80 *
81 * $Header: /cvsroot/Lorene/C++/Source/Mg3d/mg3d_std_base.C,v 1.13 2014/10/13 08:53:07 j_novak Exp $
82 *
83 */
84
85 // headers C++
86
87 // headers C
88 #include <cassert>
89
90 // headers Lorene
91 #include "grilles.h"
92 #include "base_val.h"
93 #include "type_parite.h"
94
95 //-----------------------------//
96 // Bases for a scalar field //
97 //-----------------------------//
98
99
100 namespace Lorene {
101 Base_val Mg3d::std_base_scal() const {
102
103 Base_val base(nzone) ;
104
105 for (int l=0; l<nzone; l++) {
106 switch ( colloc_r[l] ) {
107 case BASE_CHEB :
108 base.b[l] = std_base_scal_1z(type_r[l], type_t, type_p) ;
109 break ;
110
111 case BASE_LEG :
112 base.b[l] = leg_base_scal_1z(type_r[l], type_t, type_p) ;
113 break ;
114
115 case BASE_JAC02 :
116 base.b[l] = jac02_base_scal_1z(type_r[l], type_t, type_p) ;
117 break ;
118
119 default :
120 cout << "Mg3d::std_base_scal : unknown type of radial base!"
121 << endl ;
122 abort() ;
123
124 } // End of switch
125 } // End of loop on domains
126
127 return base ;
128
129 }
130
131 Base_val Mg3d::std_base_scal_odd() const {
132
133 Base_val base(nzone) ;
134
135 for (int l=0; l<nzone; l++) {
136 switch ( colloc_r[l] ) {
137 case BASE_CHEB :
138 base.b[l] = std_base_scal_odd_1z(type_r[l], type_t, type_p) ;
139 break ;
140
141 case BASE_LEG :
142 base.b[l] = leg_base_scal_odd_1z(type_r[l], type_t, type_p) ;
143 break ;
144
145 case BASE_JAC02 : // No defined parity for Jacobi(0,2) polynomials
146 base.b[l] = jac02_base_scal_1z(type_r[l], type_t, type_p) ;
147 break ;
148
149 default :
150 cout << "Mg3d::std_base_scal_odd : unknown type of radial base!"
151 << endl ;
152 abort() ;
153
154 } // End of switch
155 } // End of loop on domains
156
157 return base ;
158
159 }
160
161 //---------------------------------------//
162 // Bases for the Cartesian components //
163 // of a vector field //
164 //---------------------------------------//
165
166
167 /*
168 * Calcul les bases spectrales associees aux composantes cartesiennes d'un vecteur
169 * antisymetrique en z (pour la composante z)
170 *
171 * (*THIS) est la grille du calcul
172 * SORTIE : un tableau sur les 3 compsantes (x=1, y=2, z=3) contenant les bases
173 * de decomposition
174 *
175 */
176
177 Base_val** Mg3d::std_base_vect_cart() const {
178
179 // nbre de zones :
180 int nz = get_nzone() ;
181
182 // Tableau contenant le resultat...
183 Base_val** bases = new Base_val*[3] ;
184 for (int i=0 ; i<3 ; i++)
185 bases[i] = new Base_val(nz) ;
186
187 // Boucle sur les differentes zones :
188 for (int l=0; l<nzone; l++) {
189
190 assert (colloc_r[l] == BASE_CHEB) ;
191
192 // Type d'echantillonnage de la zone l :
193 int type_r0 = get_type_r(l) ;
194
195 // Bases de developpement en (r,theta,phi) a determiner pour les composantes
196 // (1,2,3) du vecteur :
197
198 int base1, base2, base3 ;
199 switch ( type_p ) {
200
201 case NONSYM :
202 //---------------------------------------------------------
203 // Cas sans symetrie sur phi : phi dans [0, 2 pi[
204 //---------------------------------------------------------
205
206 // Base en phi:
207 //-------------
208 base1 = P_COSSIN ;
209 base2 = P_COSSIN ;
210 base3 = P_COSSIN ;
211
212
213 // Base en theta:
214 //---------------
215 switch ( type_t ) {
216 case SYM :
217 // symetrie theta -> pi - theta : theta dans [0, pi/2]
218 //------------------------------------------------------
219 base1 = base1 | T_COSSIN_CP ;
220 base2 = base2 | T_COSSIN_CP ;
221 base3 = base3 | T_COSSIN_CI ;
222
223 // Base en r :
224 //------------
225 switch ( type_r0 ) {
226
227 case FIN :
228 // echantillonnage fin
229
230 base1 = base1 | R_CHEB ;
231 base2 = base2 | R_CHEB ;
232 base3 = base3 | R_CHEB ;
233 break ;
234
235
236 case RARE :
237 // echantillonnage rarefie
238
239 base1 = base1 | R_CHEBPIM_P ;
240 base2 = base2 | R_CHEBPIM_P ;
241 base3 = base3 | R_CHEBPIM_I ;
242
243 break ;
244
245 case UNSURR :
246 // echantillonnage fin (1/r)
247
248 base1 = base1 | R_CHEBU ;
249 base2 = base2 | R_CHEBU ;
250 base3 = base3 | R_CHEBU ;
251 break ;
252
253
254 default :
255 cout <<
256 "Mg3d::std_base_vect_cart : le cas type_p, type_t, type_r = "
257 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
258 cout <<
259 " dans la zone l = " << l << " n'est pas prevu ! "
260 << endl ;
261 abort () ;
262 }
263
264 break ; // fin du cas type_t = SYM
265
266
267 case NONSYM :
268 // pas de symetrie en theta : theta dans [0, pi]
269 //------------------------------------------------
270 base1 = base1 | T_COSSIN_C ;
271 base2 = base2 | T_COSSIN_C ;
272 base3 = base3 | T_COSSIN_C ;
273
274 // Base en r :
275 //------------
276 switch ( type_r0 ) {
277
278 case FIN :
279 // echantillonnage fin
280
281 base1 = base1 | R_CHEB ;
282 base2 = base2 | R_CHEB ;
283 base3 = base3 | R_CHEB ;
284 break ;
285
286 case RARE :
287 // echantillonnage rarefie
288
289 base1 = base1 | R_CHEBPI_P ;
290 base2 = base2 | R_CHEBPI_P ;
291 base3 = base3 | R_CHEBPI_P ;
292
293 break ;
294
295 case UNSURR :
296 // echantillonnage fin (1/r)
297
298 base1 = base1 | R_CHEBU ;
299 base2 = base2 | R_CHEBU ;
300 base3 = base3 | R_CHEBU ;
301 break ;
302
303
304 default :
305 cout <<
306 "Mg3d::std_base_vect_cart : le cas type_p, type_t, type_r = "
307 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
308 cout <<
309 " dans la zone l = " << l << " n'est pas prevu ! "
310 << endl ;
311 abort () ;
312 }
313
314 break ; // fin du cas type_t = NONSYM
315
316
317
318
319 default :
320 cout <<
321 "Mg3d::std_base_vect_cart : le cas type_p, type_t = "
322 << type_p<< " " <<type_t << endl ;
323 cout <<
324 " dans la zone l = " << l << " n'est pas prevu ! "
325 << endl ;
326 abort () ;
327
328 } // fin des cas sur type_t
329
330
331
332 break ; // fin du cas sans symetrie pour phi
333
334
335 case SYM :
336 //---------------------------------------------------------
337 // Cas symetrie phi -> phi + pi : phi in [0, pi]
338 //---------------------------------------------------------
339
340 // Base en phi:
341 //-------------
342 base1 = P_COSSIN_I ;
343 base2 = P_COSSIN_I ;
344 base3 = P_COSSIN_P ;
345
346
347 // Base en theta:
348 //---------------
349 switch ( type_t ) {
350
351 case SYM :
352 // symetrie theta -> pi - theta : theta dans [0, pi/2]
353 //------------------------------------------------------
354 base1 = base1 | T_SIN_I ;
355 base2 = base2 | T_SIN_I ;
356 base3 = base3 | T_COS_I;
357
358 // Base en r :
359 //------------
360 switch ( type_r0 ) {
361
362 case FIN :
363 // echantillonnage fin
364
365 base1 = base1 | R_CHEB ;
366 base2 = base2 | R_CHEB ;
367 base3 = base3 | R_CHEB ;
368 break ;
369
370 case RARE :
371 // echantillonnage rarefie
372
373 base1 = base1 | R_CHEBI ;
374 base2 = base2 | R_CHEBI ;
375 base3 = base3 | R_CHEBI ;
376 break ;
377
378 case UNSURR :
379 // echantillonnage fin (1/r)
380
381 base1 = base1 | R_CHEBU ;
382 base2 = base2 | R_CHEBU ;
383 base3 = base3 | R_CHEBU ;
384 break ;
385
386
387 default :
388 cout <<
389 "Mg3d::std_base_vect_cart : le cas type_p, type_t, type_r = "
390 << type_p<< " " <<type_t<< " " <<type_r0 << endl ;
391 cout <<
392 " dans la zone l = " << l << " n'est pas prevu ! "
393 << endl ;
394 abort () ;
395 }
396
397 break ; // fin du cas type_t = SYM
398
399
400 case NONSYM :
401 // pas de symetrie en theta : theta dans [0, pi]
402 //------------------------------------------------
403 base1 = base1 | T_SIN ;
404 base2 = base2 | T_SIN ;
405 base3 = base3 | T_COS ;
406
407 // Base en r :
408 //------------
409 switch ( type_r0 ) {
410
411 case FIN :
412 // echantillonnage fin
413
414 base1 = base1 | R_CHEB ;
415 base2 = base2 | R_CHEB ;
416 base3 = base3 | R_CHEB ;
417 break ;
418
419 case RARE :
420 // echantillonnage rarefie
421
422 base1 = base1 | R_CHEBPI_P ;
423 base2 = base2 | R_CHEBPI_P ;
424 base3 = base3 | R_CHEBPI_P ;
425
426 break ;
427
428 case UNSURR :
429 // echantillonnage fin (1/r)
430
431 base1 = base1 | R_CHEBU ;
432 base2 = base2 | R_CHEBU ;
433 base3 = base3 | R_CHEBU ;
434 break ;
435
436
437 default :
438 cout <<
439 "Mg3d::std_base_vect_cart : le cas type_p, type_t, type_r = "
440 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
441 cout <<
442 " dans la zone l = " << l << " n'est pas prevu ! "
443 << endl ;
444 abort () ;
445 }
446
447 break ; // fin du cas type_t = NONSYM
448
449
450 default :
451 cout <<
452 "Mg3d::std_base_vect_cart : le cas type_p, type_t = "
453 << type_p<< " " <<type_t << endl ;
454 cout <<
455 " dans la zone l = " << l << " n'est pas prevu ! "
456 << endl ;
457 abort () ;
458
459 } // fin des cas sur type_t
460
461
462
463 break ; // fin du cas symetrie phi -> phi + pi
464
465
466 default :
467 cout <<
468 "Mg3d::std_base_vect_cart : le cas type_p = " << type_p << endl ;
469 cout << " dans la zone l = " << l << " n'est pas prevu ! "
470 << endl ;
471 abort () ;
472
473
474 } // Fin des cas en phi
475
476 bases[0]->b[l] = base1 ;
477 bases[1]->b[l] = base2 ;
478 bases[2]->b[l] = base3 ;
479 } //fin de la boucle sur les zones.
480
481 return bases ;
482 }
483 //---------------------------------------//
484 // Bases for the spherical components //
485 // of a vector field //
486 //---------------------------------------//
487
488
489 /*
490 * Calcul les bases spectrales associees aux composantes spheriques d'un
491 * vecteur antisymetrique en z (pour la composante z)
492 *
493 * (*THIS) est la grille du calcul
494 * SORTIE : un tableau sur les 3 compsantes (r=1, theta=2, phi=3) contenant
495 * les bases de decomposition
496 *
497 */
498
499 Base_val** Mg3d::std_base_vect_spher() const {
500
501 // nbre de zones :
502 int nz = get_nzone() ;
503
504 // Tableau contenant le resultat...
505 Base_val** bases = new Base_val*[3] ;
506 for (int i=0 ; i<3 ; i++)
507 bases[i] = new Base_val(nz) ;
508
509 // Boucle sur les differentes zones :
510 for (int l=0; l<nzone; l++) {
511
512 assert (colloc_r[l] == BASE_CHEB) ;
513
514 // Type d'echantillonnage de la zone l :
515 int type_r0 = get_type_r(l) ;
516
517 // Bases de developpement en (r,theta,phi) a determiner pour les
518 // composantes (1,2,3) du vecteur :
519
520 int base1, base2, base3 ;
521 switch ( type_p ) {
522
523 case NONSYM :
524 //---------------------------------------------------------
525 // Cas sans symetrie sur phi : phi dans [0, 2 pi[
526 //---------------------------------------------------------
527
528 // Base en phi:
529 //-------------
530 base1 = P_COSSIN ;
531 base2 = P_COSSIN ;
532 base3 = P_COSSIN ;
533
534
535 // Base en theta:
536 //---------------
537 switch ( type_t ) {
538 case SYM :
539 // symetrie theta -> pi - theta : theta dans [0, pi/2]
540 //------------------------------------------------------
541 base1 = base1 | T_COSSIN_CP ;
542 base2 = base2 | T_COSSIN_SP ;
543 base3 = base3 | T_COSSIN_SI ;
544
545 // Base en r :
546 //------------
547 switch ( type_r0 ) {
548
549 case FIN :
550 // echantillonnage fin
551
552 base1 = base1 | R_CHEB ;
553 base2 = base2 | R_CHEB ;
554 base3 = base3 | R_CHEB ;
555 break ;
556
557 case RARE :
558 // echantillonnage rarefie
559
560 base1 = base1 | R_CHEBPIM_I ;
561 base2 = base2 | R_CHEBPIM_I ;
562 base3 = base3 | R_CHEBPIM_I ;
563
564 break ;
565
566 case UNSURR :
567 // echantillonnage fin (1/r)
568
569 base1 = base1 | R_CHEBU ;
570 base2 = base2 | R_CHEBU ;
571 base3 = base3 | R_CHEBU ;
572 break ;
573
574
575 default :
576 cout <<
577 "Mg3d::std_base_vect_sphere : le cas type_p, type_t, type_r = "
578 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
579 cout << " dans la zone l = " << l << " n'est pas prevu ! "
580 << endl ;
581 abort () ;
582 }
583
584 break ; // fin du cas type_t = SYM
585
586 case NONSYM :
587 // pas de symetrie en theta : theta dans [0, pi]
588 //------------------------------------------------
589
590 base1 = base1 | T_COSSIN_C ;
591 base2 = base2 | T_COSSIN_S ;
592 base3 = base3 | T_COSSIN_S ;
593
594 // Base en r :
595 //------------
596 switch ( type_r0 ) {
597
598 case FIN :
599 // echantillonnage fin
600
601 base1 = base1 | R_CHEB ;
602 base2 = base2 | R_CHEB ;
603 base3 = base3 | R_CHEB ;
604 break ;
605
606 case RARE :
607 // echantillonnage rarefie
608
609 base1 = base1 | R_CHEBPI_I ;
610 base2 = base2 | R_CHEBPI_I ;
611 base3 = base3 | R_CHEBPI_P ;
612
613 break ;
614
615 case UNSURR :
616 // echantillonnage fin (1/r)
617
618 base1 = base1 | R_CHEBU ;
619 base2 = base2 | R_CHEBU ;
620 base3 = base3 | R_CHEBU ;
621 break ;
622
623
624 default :
625 cout <<
626 "Mg3d::std_base_vect_sphere : le cas type_p, type_t, type_r = "
627 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
628 cout << " dans la zone l = " << l << " n'est pas prevu ! "
629 << endl ;
630 abort () ;
631 }
632
633 break ; // fin du cas type_t = SYM
634
635
636 default :
637 cout << "Mg3d::std_base_vect_spher : le cas type_p, type_t = "
638 << type_p<< " " <<type_t << endl ;
639 cout << " dans la zone l = " << l << " n'est pas prevu ! "
640 << endl ;
641 abort () ;
642
643 } // fin des cas sur type_t
644
645 break ; // fin du cas sans symetrie pour phi
646
647
648 case SYM :
649 //---------------------------------------------------------
650 // Cas symetrie phi -> phi + pi : phi in [0, pi]
651 //---------------------------------------------------------
652
653 // Base en phi:
654 //-------------
655 base1 = P_COSSIN_P ;
656 base2 = P_COSSIN_P ;
657 base3 = P_COSSIN_P ;
658
659
660 // Base en theta:
661 //---------------
662 switch ( type_t ) {
663
664 case SYM :
665 // symetrie theta -> pi - theta : theta dans [0, pi/2]
666 //------------------------------------------------------
667 base1 = base1 | T_COS_P ;
668 base2 = base2 | T_SIN_P ;
669 base3 = base3 | T_SIN_I;
670
671 // Base en r :
672 //------------
673 switch ( type_r0 ) {
674
675 case FIN :
676 // echantillonnage fin
677
678 base1 = base1 | R_CHEB ;
679 base2 = base2 | R_CHEB ;
680 base3 = base3 | R_CHEB ;
681 break ;
682
683 case RARE :
684 // echantillonnage rarefie
685
686 base1 = base1 | R_CHEBI ;
687 base2 = base2 | R_CHEBI ;
688 base3 = base3 | R_CHEBI ;
689 break ;
690
691 case UNSURR :
692 // echantillonnage fin (1/r)
693
694 base1 = base1 | R_CHEBU ;
695 base2 = base2 | R_CHEBU ;
696 base3 = base3 | R_CHEBU ;
697 break ;
698
699
700 default :
701 cout <<
702 "Mg3d::std_base_vect_spher : le cas type_p, type_t, type_r = "
703 << type_p<< " " <<type_t<< " " <<type_r0 << endl ;
704 cout << " dans la zone l = " << l << " n'est pas prevu ! "
705 << endl ;
706 abort () ;
707 }
708
709 break ; // fin du cas type_t = SYM
710
711 case NONSYM :
712 // pas de symetrie en theta : theta dans [0, pi]
713 //------------------------------------------------
714
715 base1 = base1 | T_COS ;
716 base2 = base2 | T_SIN ;
717 base3 = base3 | T_SIN ;
718
719 // Base en r :
720 //------------
721 switch ( type_r0 ) {
722
723 case FIN :
724 // echantillonnage fin
725
726 base1 = base1 | R_CHEB ;
727 base2 = base2 | R_CHEB ;
728 base3 = base3 | R_CHEB ;
729 break ;
730
731 case RARE :
732 // echantillonnage rarefie
733
734 base1 = base1 | R_CHEBPI_I ;
735 base2 = base2 | R_CHEBPI_I ;
736 base3 = base3 | R_CHEBPI_P ;
737
738 break ;
739
740 case UNSURR :
741 // echantillonnage fin (1/r)
742
743 base1 = base1 | R_CHEBU ;
744 base2 = base2 | R_CHEBU ;
745 base3 = base3 | R_CHEBU ;
746 break ;
747
748 default :
749 cout << "Mg3d::std_base_vect_spher : le cas type_p, type_t = "
750 << type_p<< " " <<type_t << endl ;
751 cout << " dans la zone l = " << l << " n'est pas prevu ! "
752 << endl ;
753 abort () ;
754 }
755 } // fin des cas sur type_t
756
757 break ; // fin du cas symetrie phi -> phi + pi
758
759 default :
760 cout <<
761 "Mg3d::std_base_vect_spher : le cas type_p = " << type_p << endl ;
762 cout << " dans la zone l = " << l << " n'est pas prevu ! "
763 << endl ;
764 abort () ;
765
766
767 } // Fin des cas en phi
768
769 bases[0]->b[l] = base1 ;
770 bases[1]->b[l] = base2 ;
771 bases[2]->b[l] = base3 ;
772 } //fin de la boucle sur les zones.
773
774 return bases ;
775 }
776
777
778 //---------------------------------------//
779 // Bases for the Cartesian components //
780 // of a pseudo vector field //
781 //---------------------------------------//
782
783
784 /*
785 * Calcul les bases spectrales associees aux composantes cartesiennes d'un pseudo vecteur
786 * symetrique en z (pour la composante z)
787 *
788 * (*THIS) est la grille du calcul
789 * SORTIE : un tableau sur les 3 compsantes (x=1, y=2, z=3) contenant les bases
790 * de decomposition
791 *
792 */
793
794 Base_val** Mg3d::pseudo_base_vect_cart() const {
795
796 // nbre de zones :
797 int nz = get_nzone() ;
798
799 // Tableau contenant le resultat...
800 Base_val** bases = new Base_val*[3] ;
801 for (int i=0 ; i<3 ; i++)
802 bases[i] = new Base_val(nz) ;
803
804 // Boucle sur les differentes zones :
805 for (int l=0; l<nzone; l++) {
806
807 assert (colloc_r[l] == BASE_CHEB) ;
808
809 // Type d'echantillonnage de la zone l :
810 int type_r0 = get_type_r(l) ;
811
812 // Bases de developpement en (r,theta,phi) a determiner pour les composantes
813 // (1,2,3) du vecteur :
814
815 int base1, base2, base3 ;
816 switch ( type_p ) {
817
818 case NONSYM :
819 //---------------------------------------------------------
820 // Cas sans symetrie sur phi : phi dans [0, 2 pi[
821 //---------------------------------------------------------
822
823 // Base en phi:
824 //-------------
825 base1 = P_COSSIN ;
826 base2 = P_COSSIN ;
827 base3 = P_COSSIN ;
828
829
830 // Base en theta:
831 //---------------
832 switch ( type_t ) {
833 case SYM :
834 // symetrie theta -> pi - theta : theta dans [0, pi/2]
835 //------------------------------------------------------
836 base1 = base1 | T_COSSIN_CI ;
837 base2 = base2 | T_COSSIN_CI ;
838 base3 = base3 | T_COSSIN_CP ;
839
840 // Base en r :
841 //------------
842 switch ( type_r0 ) {
843
844 case FIN :
845 // echantillonnage fin
846
847 base1 = base1 | R_CHEB ;
848 base2 = base2 | R_CHEB ;
849 base3 = base3 | R_CHEB ;
850 break ;
851
852 case RARE :
853 // echantillonnage rarefie
854
855 base1 = base1 | R_CHEBPIM_I ;
856 base2 = base2 | R_CHEBPIM_I ;
857 base3 = base3 | R_CHEBPIM_P ;
858
859 break ;
860
861 case UNSURR :
862 // echantillonnage fin (1/r)
863
864 base1 = base1 | R_CHEBU ;
865 base2 = base2 | R_CHEBU ;
866 base3 = base3 | R_CHEBU ;
867 break ;
868
869
870 default :
871 cout <<
872 "Mg3d::std_base_vect_cart : le cas type_p, type_t, type_r = "
873 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
874 cout <<
875 " dans la zone l = " << l << " n'est pas prevu ! "
876 << endl ;
877 abort () ;
878 }
879
880 break ; // fin du cas type_t = SYM
881
882
883 case NONSYM :
884 // pas de symetrie en theta : theta dans [0, pi]
885 //------------------------------------------------
886 base1 = base1 | T_COSSIN_C ;
887 base2 = base2 | T_COSSIN_C ;
888 base3 = base3 | T_COSSIN_C ;
889
890 // Base en r :
891 //------------
892 switch ( type_r0 ) {
893
894 case FIN :
895 // echantillonnage fin
896
897 base1 = base1 | R_CHEB ;
898 base2 = base2 | R_CHEB ;
899 base3 = base3 | R_CHEB ;
900 break ;
901
902 case RARE :
903 // echantillonnage rarefie
904
905 base1 = base1 | R_CHEBPI_P ;
906 base2 = base2 | R_CHEBPI_P ;
907 base3 = base3 | R_CHEBPI_P ;
908
909 break ;
910
911 case UNSURR :
912 // echantillonnage fin (1/r)
913
914 base1 = base1 | R_CHEBU ;
915 base2 = base2 | R_CHEBU ;
916 base3 = base3 | R_CHEBU ;
917 break ;
918
919
920 default :
921 cout <<
922 "Mg3d::std_base_vect_cart : le cas type_p, type_t, type_r = "
923 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
924 cout <<
925 " dans la zone l = " << l << " n'est pas prevu ! "
926 << endl ;
927 abort () ;
928 }
929
930 break ; // fin du cas type_t = NONSYM
931
932
933
934
935 default :
936 cout <<
937 "Mg3d::std_base_vect_cart : le cas type_p, type_t = "
938 << type_p<< " " <<type_t << endl ;
939 cout <<
940 " dans la zone l = " << l << " n'est pas prevu ! "
941 << endl ;
942 abort () ;
943
944 } // fin des cas sur type_t
945
946
947
948 break ; // fin du cas sans symetrie pour phi
949
950
951 case SYM :
952 //---------------------------------------------------------
953 // Cas symetrie phi -> phi + pi : phi in [0, pi]
954 //---------------------------------------------------------
955
956 // Base en phi:
957 //-------------
958 base1 = P_COSSIN_I ;
959 base2 = P_COSSIN_I ;
960 base3 = P_COSSIN_P ;
961
962
963 // Base en theta:
964 //---------------
965 switch ( type_t ) {
966
967 case SYM :
968 // symetrie theta -> pi - theta : theta dans [0, pi/2]
969 //------------------------------------------------------
970 base1 = base1 | T_SIN_P ;
971 base2 = base2 | T_SIN_P ;
972 base3 = base3 | T_COS_P;
973
974 // Base en r :
975 //------------
976 switch ( type_r0 ) {
977
978 case FIN :
979 // echantillonnage fin
980
981 base1 = base1 | R_CHEB ;
982 base2 = base2 | R_CHEB ;
983 base3 = base3 | R_CHEB ;
984 break ;
985
986 case RARE :
987 // echantillonnage rarefie
988
989 base1 = base1 | R_CHEBP ;
990 base2 = base2 | R_CHEBP ;
991 base3 = base3 | R_CHEBP ;
992 break ;
993
994 case UNSURR :
995 // echantillonnage fin (1/r)
996
997 base1 = base1 | R_CHEBU ;
998 base2 = base2 | R_CHEBU ;
999 base3 = base3 | R_CHEBU ;
1000 break ;
1001
1002
1003 default :
1004 cout <<
1005 "Mg3d::std_base_vect_cart : le cas type_p, type_t, type_r = "
1006 << type_p<< " " <<type_t<< " " <<type_r0 << endl ;
1007 cout <<
1008 " dans la zone l = " << l << " n'est pas prevu ! "
1009 << endl ;
1010 abort () ;
1011 }
1012
1013 break ; // fin du cas type_t = SYM
1014
1015
1016 case NONSYM :
1017 // pas de symetrie en theta : theta dans [0, pi]
1018 //------------------------------------------------
1019 base1 = base1 | T_SIN ;
1020 base2 = base2 | T_SIN ;
1021 base3 = base3 | T_COS ;
1022
1023 // Base en r :
1024 //------------
1025 switch ( type_r0 ) {
1026
1027 case FIN :
1028 // echantillonnage fin
1029
1030 base1 = base1 | R_CHEB ;
1031 base2 = base2 | R_CHEB ;
1032 base3 = base3 | R_CHEB ;
1033 break ;
1034
1035 case RARE :
1036 // echantillonnage rarefie
1037
1038 base1 = base1 | R_CHEBPI_P ;
1039 base2 = base2 | R_CHEBPI_P ;
1040 base3 = base3 | R_CHEBPI_P ;
1041
1042 break ;
1043
1044 case UNSURR :
1045 // echantillonnage fin (1/r)
1046
1047 base1 = base1 | R_CHEBU ;
1048 base2 = base2 | R_CHEBU ;
1049 base3 = base3 | R_CHEBU ;
1050 break ;
1051
1052
1053 default :
1054 cout <<
1055 "Mg3d::std_base_vect_cart : le cas type_p, type_t, type_r = "
1056 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
1057 cout <<
1058 " dans la zone l = " << l << " n'est pas prevu ! "
1059 << endl ;
1060 abort () ;
1061 }
1062
1063 break ; // fin du cas type_t = NONSYM
1064
1065 default :
1066 cout <<
1067 "Mg3d::std_base_vect_cart : le cas type_p, type_t = "
1068 << type_p<< " " <<type_t << endl ;
1069 cout <<
1070 " dans la zone l = " << l << " n'est pas prevu ! "
1071 << endl ;
1072 abort () ;
1073
1074 } // fin des cas sur type_t
1075
1076
1077
1078 break ; // fin du cas symetrie phi -> phi + pi
1079
1080
1081 default :
1082 cout <<
1083 "Mg3d::std_base_vect_cart : le cas type_p = " << type_p << endl ;
1084 cout << " dans la zone l = " << l << " n'est pas prevu ! "
1085 << endl ;
1086 abort () ;
1087
1088
1089 } // Fin des cas en phi
1090
1091 bases[0]->b[l] = base1 ;
1092 bases[1]->b[l] = base2 ;
1093 bases[2]->b[l] = base3 ;
1094 } //fin de la boucle sur les zones.
1095
1096 return bases ;
1097 }
1098 //---------------------------------------//
1099 // Bases for the spherical components //
1100 // of a pseudo-vector field //
1101 //---------------------------------------//
1102
1103
1104 /*
1105 * Calcul les bases spectrales associees aux composantes spheriques d'un
1106 * pseudo-vecteur symetrique en z (pour la composante z)
1107 *
1108 * (*THIS) est la grille du calcul
1109 * SORTIE : un tableau sur les 3 compsantes (r=1, theta=2, phi=3) contenant
1110 * les bases de decomposition
1111 *
1112 */
1113
1114 Base_val** Mg3d::pseudo_base_vect_spher() const {
1115
1116 // nbre de zones :
1117 int nz = get_nzone() ;
1118
1119 // Tableau contenant le resultat...
1120 Base_val** bases = new Base_val*[3] ;
1121 for (int i=0 ; i<3 ; i++)
1122 bases[i] = new Base_val(nz) ;
1123
1124 // Boucle sur les differentes zones :
1125 for (int l=0; l<nzone; l++) {
1126
1127 assert (colloc_r[l] == BASE_CHEB) ;
1128
1129 // Type d'echantillonnage de la zone l :
1130 int type_r0 = get_type_r(l) ;
1131
1132 // Bases de developpement en (r,theta,phi) a determiner pour les
1133 // composantes (1,2,3) du vecteur :
1134
1135 int base1, base2, base3 ;
1136 switch ( type_p ) {
1137
1138 case NONSYM :
1139 //---------------------------------------------------------
1140 // Cas sans symetrie sur phi : phi dans [0, 2 pi[
1141 //---------------------------------------------------------
1142
1143 // Base en phi:
1144 //-------------
1145 base1 = P_COSSIN ;
1146 base2 = P_COSSIN ;
1147 base3 = P_COSSIN ;
1148
1149
1150 // Base en theta:
1151 //---------------
1152 switch ( type_t ) {
1153 case SYM :
1154 // symetrie theta -> pi - theta : theta dans [0, pi/2]
1155 //------------------------------------------------------
1156 base1 = base1 | T_COSSIN_CI ;
1157 base2 = base2 | T_COSSIN_SI ;
1158 base3 = base3 | T_COSSIN_SP ;
1159
1160 // Base en r :
1161 //------------
1162 switch ( type_r0 ) {
1163
1164 case FIN :
1165 // echantillonnage fin
1166
1167 base1 = base1 | R_CHEB ;
1168 base2 = base2 | R_CHEB ;
1169 base3 = base3 | R_CHEB ;
1170 break ;
1171
1172 case RARE :
1173 // echantillonnage rarefie
1174
1175 base1 = base1 | R_CHEBPIM_P ;
1176 base2 = base2 | R_CHEBPIM_P ;
1177 base3 = base3 | R_CHEBPIM_P ;
1178
1179 break ;
1180
1181 case UNSURR :
1182 // echantillonnage fin (1/r)
1183
1184 base1 = base1 | R_CHEBU ;
1185 base2 = base2 | R_CHEBU ;
1186 base3 = base3 | R_CHEBU ;
1187 break ;
1188
1189
1190 default :
1191 cout <<
1192 "Mg3d::std_base_vect_sphere : le cas type_p, type_t, type_r = "
1193 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
1194 cout << " dans la zone l = " << l << " n'est pas prevu ! "
1195 << endl ;
1196 abort () ;
1197 }
1198
1199 break ; // fin du cas type_t = SYM
1200
1201 case NONSYM :
1202 // pas de symetrie en theta : theta dans [0, pi]
1203 //------------------------------------------------
1204
1205 base1 = base1 | T_COSSIN_C ;
1206 base2 = base2 | T_COSSIN_S ;
1207 base3 = base3 | T_COSSIN_S ;
1208
1209 // Base en r :
1210 //------------
1211 switch ( type_r0 ) {
1212
1213 case FIN :
1214 // echantillonnage fin
1215
1216 base1 = base1 | R_CHEB ;
1217 base2 = base2 | R_CHEB ;
1218 base3 = base3 | R_CHEB ;
1219 break ;
1220
1221 case RARE :
1222 // echantillonnage rarefie
1223
1224 base1 = base1 | R_CHEBPI_I ;
1225 base2 = base2 | R_CHEBPI_I ;
1226 base3 = base3 | R_CHEBPI_P ;
1227
1228 break ;
1229
1230 case UNSURR :
1231 // echantillonnage fin (1/r)
1232
1233 base1 = base1 | R_CHEBU ;
1234 base2 = base2 | R_CHEBU ;
1235 base3 = base3 | R_CHEBU ;
1236 break ;
1237
1238
1239 default :
1240 cout <<
1241 "Mg3d::std_base_vect_sphere : le cas type_p, type_t, type_r = "
1242 << type_p<< " " << type_t<< " " <<type_r0 << endl ;
1243 cout << " dans la zone l = " << l << " n'est pas prevu ! "
1244 << endl ;
1245 abort () ;
1246 }
1247
1248 break ; // fin du cas type_t = NONSYM
1249
1250
1251 default :
1252 cout << "Mg3d::std_base_vect_spher : le cas type_p, type_t = "
1253 << type_p<< " " <<type_t << endl ;
1254 cout << " dans la zone l = " << l << " n'est pas prevu ! "
1255 << endl ;
1256 abort () ;
1257
1258 } // fin des cas sur type_t
1259
1260 break ; // fin du cas sans symetrie pour phi
1261
1262
1263 case SYM :
1264 //---------------------------------------------------------
1265 // Cas symetrie phi -> phi + pi : phi in [0, pi]
1266 //---------------------------------------------------------
1267
1268 // Base en phi:
1269 //-------------
1270 base1 = P_COSSIN_P ;
1271 base2 = P_COSSIN_P ;
1272 base3 = P_COSSIN_P ;
1273
1274
1275 // Base en theta:
1276 //---------------
1277 switch ( type_t ) {
1278
1279 case SYM :
1280 // symetrie theta -> pi - theta : theta dans [0, pi/2]
1281 //------------------------------------------------------
1282 base1 = base1 | T_COS_I ;
1283 base2 = base2 | T_SIN_I ;
1284 base3 = base3 | T_SIN_P;
1285
1286 // Base en r :
1287 //------------
1288 switch ( type_r0 ) {
1289
1290 case FIN :
1291 // echantillonnage fin
1292
1293 base1 = base1 | R_CHEB ;
1294 base2 = base2 | R_CHEB ;
1295 base3 = base3 | R_CHEB ;
1296 break ;
1297
1298 case RARE :
1299 // echantillonnage rarefie
1300
1301 base1 = base1 | R_CHEBP ;
1302 base2 = base2 | R_CHEBP ;
1303 base3 = base3 | R_CHEBP ;
1304 break ;
1305
1306 case UNSURR :
1307 // echantillonnage fin (1/r)
1308
1309 base1 = base1 | R_CHEBU ;
1310 base2 = base2 | R_CHEBU ;
1311 base3 = base3 | R_CHEBU ;
1312 break ;
1313
1314
1315 default :
1316 cout <<
1317 "Mg3d::std_base_vect_spher : le cas type_p, type_t, type_r = "
1318 << type_p<< " " <<type_t<< " " <<type_r0 << endl ;
1319 cout << " dans la zone l = " << l << " n'est pas prevu ! "
1320 << endl ;
1321 abort () ;
1322 }
1323
1324 break ; // fin du cas type_t = SYM
1325
1326 case NONSYM :
1327 // pas de symetrie en theta : theta dans [0, pi]
1328 //------------------------------------------------
1329
1330 base1 = base1 | T_COS ;
1331 base2 = base2 | T_SIN ;
1332 base3 = base3 | T_SIN ;
1333
1334 // Base en r :
1335 //------------
1336 switch ( type_r0 ) {
1337
1338 case FIN :
1339 // echantillonnage fin
1340
1341 base1 = base1 | R_CHEB ;
1342 base2 = base2 | R_CHEB ;
1343 base3 = base3 | R_CHEB ;
1344 break ;
1345
1346 case RARE :
1347 // echantillonnage rarefie
1348
1349 base1 = base1 | R_CHEBPI_I ;
1350 base2 = base2 | R_CHEBPI_I ;
1351 base3 = base3 | R_CHEBPI_P ;
1352
1353 break ;
1354
1355 case UNSURR :
1356 // echantillonnage fin (1/r)
1357
1358 base1 = base1 | R_CHEBU ;
1359 base2 = base2 | R_CHEBU ;
1360 base3 = base3 | R_CHEBU ;
1361 break ;
1362
1363 default :
1364 cout << "Mg3d::std_base_vect_spher : le cas type_p, type_t = "
1365 << type_p<< " " <<type_t << endl ;
1366 cout << " dans la zone l = " << l << " n'est pas prevu ! "
1367 << endl ;
1368 abort () ;
1369
1370 } // fin des cas sur type_t
1371
1372 default :
1373 cout << "Mg3d::std_base_vect_spher : le cas type_p, type_t = "
1374 << type_p<< " " <<type_t << endl ;
1375 cout << " dans la zone l = " << l << " n'est pas prevu ! "
1376 << endl ;
1377 abort () ;
1378
1379 } // fin des cas sur type_t
1380
1381 break ; // fin du cas symetrie phi -> phi + pi
1382
1383 default :
1384 cout <<
1385 "Mg3d::std_base_vect_spher : le cas type_p = " << type_p << endl ;
1386 cout << " dans la zone l = " << l << " n'est pas prevu ! "
1387 << endl ;
1388 abort () ;
1389
1390
1391 } // Fin des cas en phi
1392
1393 bases[0]->b[l] = base1 ;
1394 bases[1]->b[l] = base2 ;
1395 bases[2]->b[l] = base3 ;
1396 } //fin de la boucle sur les zones.
1397
1398 return bases ;
1399 }
1400
1401 }