00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 char mtbl_cf_vp_symy_C[] = "$Header: /cvsroot/Lorene/C++/Source/Mtbl_cf/mtbl_cf_vp_symy.C,v 1.2 2012/01/17 15:09:22 j_penner Exp $" ;
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #include "mtbl_cf.h"
00059 #include "proto.h"
00060
00061
00062
00063
00064
00065 double Mtbl_cf::val_point_symy(int l, double x, double theta, double phi)
00066 const {
00067
00068
00069 static void (*som_r[MAX_BASE])
00070 (double*, const int, const int, const int, const double, double*) ;
00071 static void (*som_tet[MAX_BASE])
00072 (double*, const int, const int, const double, double*) ;
00073 static void (*som_phi[MAX_BASE_2])
00074 (double*, const int, const double, double*) ;
00075 static int premier_appel = 1 ;
00076
00077
00078
00079 if (premier_appel == 1) {
00080
00081 premier_appel = 0 ;
00082
00083 for (int i=0 ; i<MAX_BASE ; i++) {
00084 if(i%2==0){
00085 som_phi[i/2] = som_phi_pas_prevu ;
00086 }
00087 som_tet[i] = som_tet_pas_prevu ;
00088 som_r[i] = som_r_pas_prevu ;
00089 }
00090
00091 som_r[R_CHEB >> TRA_R] = som_r_cheb_symy ;
00092 som_r[R_CHEBP >> TRA_R] = som_r_chebp ;
00093 som_r[R_CHEBI >> TRA_R] = som_r_chebi ;
00094 som_r[R_CHEBU >> TRA_R] = som_r_chebu_symy ;
00095 som_r[R_CHEBPIM_P >> TRA_R] = som_r_chebpim_p_symy ;
00096 som_r[R_CHEBPIM_I >> TRA_R] = som_r_chebpim_i_symy ;
00097
00098 som_tet[T_COS >> TRA_T] = som_tet_cos ;
00099 som_tet[T_SIN >> TRA_T] = som_tet_sin ;
00100 som_tet[T_COS_P >> TRA_T] = som_tet_cos_p ;
00101 som_tet[T_SIN_P >> TRA_T] = som_tet_sin_p ;
00102 som_tet[T_COSSIN_CP >> TRA_T] = som_tet_cossin_cp_symy ;
00103 som_tet[T_COSSIN_CI >> TRA_T] = som_tet_cossin_ci_symy ;
00104
00105 som_phi[P_COSSIN >> TRA_P] = som_phi_cossin_symy ;
00106 som_phi[P_COSSIN_P >> TRA_P] = som_phi_cossin_p ;
00107 som_phi[P_COSSIN_I >> TRA_P] = som_phi_cossin_i ;
00108
00109 }
00110
00111
00112 assert (etat != ETATNONDEF) ;
00113
00114 double resu ;
00115
00116
00117 if (etat == ETATZERO ) {
00118 resu = 0 ;
00119 return resu ;
00120 }
00121
00122
00123 int np = mg->get_np(l) ;
00124 int nt = mg->get_nt(l) ;
00125 int nr = mg->get_nr(l) ;
00126
00127
00128 int base_r = (base.b[l] & MSQ_R) >> TRA_R ;
00129 int base_t = (base.b[l] & MSQ_T) >> TRA_T ;
00130 int base_p = (base.b[l] & MSQ_P) >> TRA_P ;
00131
00132
00133
00134
00135
00136
00137
00138 assert(etat == ETATQCQ) ;
00139 Tbl* tbcf = t[l] ;
00140
00141 if (tbcf->get_etat() == ETATZERO ) {
00142 resu = 0 ;
00143 return resu ;
00144 }
00145
00146
00147 assert(tbcf->get_etat() == ETATQCQ) ;
00148
00149 double* cf = tbcf->t ;
00150
00151
00152 double* trp = new double [np+2] ;
00153 double* trtp = new double [(np+2)*nt] ;
00154
00155 if (nr == 1) {
00156
00157
00158
00159
00160 som_tet[base_t](cf, nt, np, theta, trp) ;
00161 }
00162 else {
00163
00164
00165
00166
00167 som_r[base_r](cf, nr, nt, np, x, trtp) ;
00168 som_tet[base_t](trtp, nt, np, theta, trp) ;
00169 }
00170
00171
00172
00173
00174 if (np == 1) {
00175 resu = trp[0] ;
00176 }
00177 else {
00178 som_phi[base_p](trp, np, phi, &resu) ;
00179 }
00180
00181
00182 delete [] trp ;
00183 delete [] trtp ;
00184
00185
00186 return resu ;
00187
00188 }
00189
00190
00191
00192
00193
00194
00195
00196
00197 double Mtbl_cf::val_point_jk_symy(int l, double x, int j0, int k0) const {
00198
00199
00200 static void (*som_r[MAX_BASE])
00201 (double*, const int, const int, const int, const double, double*) ;
00202 static int premier_appel = 1 ;
00203
00204
00205
00206 if (premier_appel == 1) {
00207
00208 premier_appel = 0 ;
00209
00210 for (int i=0 ; i<MAX_BASE ; i++) {
00211 som_r[i] = som_r_pas_prevu ;
00212 }
00213
00214 som_r[R_CHEB >> TRA_R] = som_r_cheb_symy ;
00215 som_r[R_CHEBP >> TRA_R] = som_r_chebp ;
00216 som_r[R_CHEBI >> TRA_R] = som_r_chebi ;
00217 som_r[R_CHEBU >> TRA_R] = som_r_chebu_symy ;
00218 som_r[R_CHEBPIM_P >> TRA_R] = som_r_chebpim_p_symy ;
00219 som_r[R_CHEBPIM_I >> TRA_R] = som_r_chebpim_i_symy ;
00220
00221 }
00222
00223 assert (etat != ETATNONDEF) ;
00224
00225 double resu ;
00226
00227
00228 if (etat == ETATZERO ) {
00229 resu = 0 ;
00230 return resu ;
00231 }
00232
00233
00234 int np = mg->get_np(l) ;
00235 int nt = mg->get_nt(l) ;
00236 int nr = mg->get_nr(l) ;
00237
00238
00239 int base_r = (base.b[l] & MSQ_R) >> TRA_R ;
00240
00241
00242
00243
00244
00245
00246 Tbl tab_phi = base.phi_functions(l, np) ;
00247 Tbl tab_theta = base.theta_functions(l, nt) ;
00248
00249
00250
00251
00252
00253
00254
00255
00256 assert(etat == ETATQCQ) ;
00257 Tbl* tbcf = t[l] ;
00258
00259 if (tbcf->get_etat() == ETATZERO ) {
00260 resu = 0 ;
00261 return resu ;
00262 }
00263
00264
00265 assert(tbcf->get_etat() == ETATQCQ) ;
00266
00267 double* cf = tbcf->t ;
00268
00269
00270 double* coef_tp = new double [(np+2)*nt] ;
00271
00272
00273
00274
00275
00276 som_r[base_r](cf, nr, nt, np, x, coef_tp) ;
00277
00278
00279
00280
00281 double* pi = coef_tp ;
00282
00283
00284
00285 double somt = 0 ;
00286 for (int j=0 ; j<nt ; j++) {
00287 somt += (*pi) * tab_theta(0, j, j0) ;
00288 pi++ ;
00289 }
00290 resu = somt * tab_phi(0, k0) ;
00291
00292 if (np > 1) {
00293
00294
00295 pi += nt ;
00296
00297
00298
00299 int base_t = base.b[l] & MSQ_T ;
00300
00301 switch (base_t) {
00302
00303 case T_COSSIN_CP : {
00304
00305 for (int k=2 ; k<np+1 ; k+=2) {
00306 int m_par = (k/2)%2 ;
00307 somt = 0 ;
00308 for (int j=0 ; j<nt ; j++) {
00309 somt += (*pi) * tab_theta(m_par, j, j0) ;
00310 pi++ ;
00311 }
00312 resu += somt * tab_phi(k, k0) ;
00313
00314
00315 pi += nt ;
00316 }
00317 break ;
00318 }
00319
00320 default: {
00321 cout << "Mtbl_cf::val_point_jk_symy: unknown theta basis ! "
00322 << endl ;
00323 abort () ;
00324 }
00325
00326 }
00327
00328 }
00329
00330
00331
00332 delete [] coef_tp ;
00333
00334
00335 return resu ;
00336
00337 }
00338
00339