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