Debian Codegraph @

C++/Source/Valeur/valeur_mult_x.C

raw
1 /*
2 * Computation of x*Id
3 *
4 * for:
5 * - Valeur
6 * - Mtbl_cf
7 */
8
9 /*
10 * Copyright (c) 1999-2001 Jerome Novak
11 * Copyright (c) 1999-2001 Eric Gourgoulhon
12 *
13 * This file is part of LORENE.
14 *
15 * LORENE is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * LORENE is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with LORENE; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 *
29 */
30
31
32 char valeur_mult_x_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_x.C,v 1.6 2015/03/05 08:49:33 j_novak Exp $" ;
33
34 /*
35 * $Id: valeur_mult_x.C,v 1.6 2015/03/05 08:49:33 j_novak Exp $
36 * $Log: valeur_mult_x.C,v $
37 * Revision 1.6 2015/03/05 08:49:33 j_novak
38 * Implemented operators with Legendre bases.
39 *
40 * Revision 1.5 2014/10/13 08:53:50 j_novak
41 * Lorene classes and functions now belong to the namespace Lorene.
42 *
43 * Revision 1.4 2014/10/06 15:13:24 j_novak
44 * Modified #include directives to use c++ syntax.
45 *
46 * Revision 1.3 2008/08/27 08:52:55 jl_cornou
47 * Added Jacobi(0,2) polynomials case
48 *
49 * Revision 1.2 2004/11/23 15:17:19 m_forot
50 * Added the bases for the cases without any equatorial symmetry
51 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
52 *
53 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
54 * LORENE
55 *
56 * Revision 1.5 1999/11/30 12:45:07 eric
57 * Valeur::base est desormais du type Base_val et non plus Base_val*.
58 *
59 * Revision 1.4 1999/11/24 09:34:16 eric
60 * Modif commentaires.
61 *
62 * Revision 1.3 1999/11/23 16:18:04 eric
63 * Reorganisation du calcul dans le cas ETATZERO.
64 *
65 * Revision 1.2 1999/11/19 09:31:21 eric
66 * La valeur de retour est desormais const Valeur &.
67 *
68 * Revision 1.1 1999/11/16 13:37:24 novak
69 * Initial revision
70 *
71 *
72 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_x.C,v 1.6 2015/03/05 08:49:33 j_novak Exp $
73 *
74 */
75
76 // Headers C
77 #include <cassert>
78
79 // Headers Lorene
80 #include "mtbl_cf.h"
81 #include "valeur.h"
82
83 // Local prototypes
84 namespace Lorene {
85 void _mult_x_pas_prevu(Tbl *, int &) ;
86 void _mult_x_r_chebp(Tbl *, int &) ;
87 void _mult_x_r_chebi(Tbl *, int &) ;
88 void _mult_x_r_chebpim_p(Tbl *, int &) ;
89 void _mult_x_r_chebpim_i(Tbl *, int &) ;
90 void _mult_xm1_cheb(Tbl *, int&) ;
91 void _mult_x_identite (Tbl *, int &) ;
92 void _mult_x_r_chebpi_p(Tbl *, int &) ;
93 void _mult_x_r_chebpi_i(Tbl *, int &) ;
94 void _mult_x_r_jaco02(Tbl *, int &) ;
95 void _mult_x_r_legp(Tbl *, int &) ;
96 void _mult_x_r_legi(Tbl *, int &) ;
97
98 // Version membre d'un Valeur
99 // --------------------------
100
101 const Valeur& Valeur::mult_x() const {
102
103 // Protection
104 assert(etat != ETATNONDEF) ;
105
106 // Peut-etre rien a faire ?
107 if (p_mult_x != 0x0) {
108 return *p_mult_x ;
109 }
110
111 // ... si, il faut bosser
112
113 p_mult_x = new Valeur(mg) ;
114
115 if (etat == ETATZERO) {
116 p_mult_x->set_etat_zero() ;
117 }
118 else {
119 assert(etat == ETATQCQ) ;
120 p_mult_x->set_etat_cf_qcq() ;
121 Mtbl_cf* cfp = p_mult_x->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
122 // cree par le set_etat_cf_qcq()
123
124 // Initialisation de *cfp : recopie des coef. de la fonction
125 if (c_cf == 0x0) {
126 coef() ;
127 }
128 *cfp = *c_cf ;
129
130 cfp->mult_x() ; // calcul
131
132 p_mult_x->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
133 }
134
135 // Termine
136 return *p_mult_x ;
137 }
138
139
140
141 // Version membre d'un Mtbl_cf
142 // ---------------------------
143
144 void Mtbl_cf::mult_x() {
145
146 // Routines de derivation
147 static void (*_mult_x[MAX_BASE])(Tbl *, int &) ;
148 static int nap = 0 ;
149
150 // Premier appel
151 if (nap==0) {
152 nap = 1 ;
153 for (int i=0 ; i<MAX_BASE ; i++) {
154 _mult_x[i] = _mult_x_pas_prevu ;
155 }
156 // Les routines existantes
157 _mult_x[R_CHEB >> TRA_R] = _mult_x_identite ;
158 _mult_x[R_CHEBU >> TRA_R] = _mult_xm1_cheb ;
159 _mult_x[R_CHEBP >> TRA_R] = _mult_x_r_chebp ;
160 _mult_x[R_CHEBI >> TRA_R] = _mult_x_r_chebi ;
161 _mult_x[R_CHEBPIM_P >> TRA_R] = _mult_x_r_chebpim_p ;
162 _mult_x[R_CHEBPIM_I >> TRA_R] = _mult_x_r_chebpim_i ;
163 _mult_x[R_CHEBPI_P >> TRA_R] = _mult_x_r_chebpi_p ;
164 _mult_x[R_CHEBPI_I >> TRA_R] = _mult_x_r_chebpi_i ;
165 _mult_x[R_JACO02 >> TRA_R] = _mult_x_r_jaco02 ;
166 _mult_x[R_LEG >> TRA_R] = _mult_x_identite ;
167 _mult_x[R_LEGP >> TRA_R] = _mult_x_r_legp ;
168 _mult_x[R_LEGI >> TRA_R] = _mult_x_r_legi ;
169 }
170
171 // Debut de la routine
172
173 // Protection
174 assert(etat == ETATQCQ) ;
175
176 // Boucle sur les zones
177 int base_r ;
178 for (int l=0 ; l<nzone ; l++) {
179 base_r = (base.b[l] & MSQ_R) >> TRA_R ;
180 assert(t[l] != 0x0) ;
181 _mult_x[base_r](t[l], base.b[l]) ;
182 }
183 }
184 }