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 char valeur_coef_i_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_coef_i.C,v 1.14 2012/01/17 15:08:02 j_penner Exp $" ;
00030
00031
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
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 #include <math.h>
00116
00117
00118 #include "valeur.h"
00119 #include "proto.h"
00120
00121 void c_est_pas_fait(char * ) ;
00122
00123 void ipasprevu_r(const int*, const int*, double*, const int*, double*) ;
00124 void ipasprevu_t(const int*, const int*, double*, const int*, double*) ;
00125 void ipasprevu_p(const int* , const int* , const int* , double* , double* ) ;
00126 void ibase_non_def_r(const int*, const int*, double*, const int*, double*) ;
00127 void ibase_non_def_t(const int*, const int*, double*, const int*, double*) ;
00128 void ibase_non_def_p(const int* , const int* , const int* , double* , double* ) ;
00129
00130 void Valeur::coef_i() const {
00131
00132
00133 static void (*invcf_r[MAX_BASE])(const int*, const int*, double*, const int*, double*) ;
00134 static void (*invcf_t[MAX_BASE])(const int*, const int*, double*, const int*, double*) ;
00135 static void (*invcf_p[MAX_BASE_2])(const int* , const int* , const int*, double* , double* ) ;
00136 static int premier_appel = 1 ;
00137
00138
00139 if (premier_appel) {
00140 premier_appel = 0 ;
00141
00142 for (int i=0; i<MAX_BASE; i++) {
00143 invcf_r[i] = ipasprevu_r ;
00144 invcf_t[i] = ipasprevu_t ;
00145 if(i%2==0){
00146 invcf_p[i/2] = ipasprevu_p ;
00147 }
00148 }
00149
00150 invcf_r[NONDEF] = ibase_non_def_r ;
00151 invcf_r[R_CHEB >> TRA_R] = circheb ;
00152 invcf_r[R_CHEBU >> TRA_R] = circheb ;
00153 invcf_r[R_CHEBP >> TRA_R] = circhebp ;
00154 invcf_r[R_CHEBI >> TRA_R] = circhebi ;
00155 invcf_r[R_CHEBPIM_P >> TRA_R] = circhebpimp ;
00156 invcf_r[R_CHEBPIM_I >> TRA_R] = circhebpimi ;
00157 invcf_r[R_CHEBPI_P >> TRA_R] = circhebpip ;
00158 invcf_r[R_CHEBPI_I >> TRA_R] = circhebpii ;
00159 invcf_r[R_JACO02 >> TRA_R] = cirjaco02 ;
00160
00161 invcf_t[NONDEF] = ibase_non_def_t ;
00162 invcf_t[T_COS >> TRA_T] = citcos ;
00163 invcf_t[T_SIN >> TRA_T] = citsin ;
00164 invcf_t[T_COS_P >> TRA_T] = citcosp ;
00165 invcf_t[T_COS_I >> TRA_T] = citcosi ;
00166 invcf_t[T_SIN_P >> TRA_T] = citsinp ;
00167 invcf_t[T_SIN_I >> TRA_T] = citsini ;
00168 invcf_t[T_COSSIN_CP >> TRA_T] = citcossincp ;
00169 invcf_t[T_COSSIN_SI >> TRA_T] = citcossinsi ;
00170 invcf_t[T_COSSIN_SP >> TRA_T] = citcossinsp ;
00171 invcf_t[T_COSSIN_CI >> TRA_T] = citcossinci ;
00172 invcf_t[T_COSSIN_S >> TRA_T] = citcossins ;
00173 invcf_t[T_COSSIN_C >> TRA_T] = citcossinc ;
00174 invcf_t[T_LEG_P >> TRA_T] = citlegp ;
00175 invcf_t[T_LEG_PP >> TRA_T] = citlegpp ;
00176 invcf_t[T_LEG_I >> TRA_T] = citlegi ;
00177 invcf_t[T_LEG_IP >> TRA_T] = citlegip ;
00178 invcf_t[T_LEG_PI >> TRA_T] = citlegpi ;
00179 invcf_t[T_LEG_II >> TRA_T] = citlegii ;
00180 invcf_t[T_LEG_MP >> TRA_T] = citlegmp ;
00181 invcf_t[T_LEG_MI >> TRA_T] = citlegmi ;
00182 invcf_t[T_LEG >> TRA_T] = citleg ;
00183
00184 invcf_p[NONDEF] = ibase_non_def_p ;
00185 invcf_p[P_COSSIN >> TRA_P] = cipcossin ;
00186 invcf_p[P_COSSIN_P >> TRA_P] = cipcossin ;
00187 invcf_p[P_COSSIN_I >> TRA_P] = cipcossini ;
00188
00189 }
00190
00191
00192
00193
00194
00195
00196 if (etat == ETATZERO) {
00197 return ;
00198 }
00199
00200
00201 assert(etat != ETATNONDEF) ;
00202
00203
00204 if (c != 0x0) {
00205 return ;
00206 }
00207
00208
00209 assert(c_cf != 0x0) ;
00210 assert(c_cf->base == base) ;
00211
00212 c = new Mtbl(mg) ;
00213 c->set_etat_qcq() ;
00214
00215
00216 int nz = mg->get_nzone() ;
00217 for (int l=0; l<nz; l++) {
00218
00219
00220 Tbl* f = (c->t)[l] ;
00221 const Tbl* cf = (c_cf->t)[l] ;
00222
00223 if (cf->get_etat() == ETATZERO) {
00224 f->set_etat_zero() ;
00225 continue ;
00226 }
00227
00228 f->set_etat_qcq() ;
00229
00230 int np = f->get_dim(2) ;
00231 int nt = f->get_dim(1) ;
00232 int nr = f->get_dim(0) ;
00233
00234 int np_c = cf->get_dim(2) ;
00235 int nt_c = cf->get_dim(1) ;
00236 int nr_c = cf->get_dim(0) ;
00237
00238
00239 int deg[3] ;
00240 deg[0] = np ;
00241 deg[1] = nt ;
00242 deg[2] = nr ;
00243
00244 int dimc[3] ;
00245 dimc[0] = np_c ;
00246 dimc[1] = nt_c ;
00247 dimc[2] = nr_c ;
00248
00249
00250 int ntot = cf->get_taille() ;
00251 double* trav = new double[ntot] ;
00252
00253
00254 int base_r = ( base.b[l] & MSQ_R ) >> TRA_R ;
00255 int base_t = ( base.b[l] & MSQ_T ) >> TRA_T ;
00256 int base_p = ( base.b[l] & MSQ_P ) >> TRA_P ;
00257 int vbase_t = base.b[l] & MSQ_T ;
00258 int vbase_p = base.b[l] & MSQ_P ;
00259
00260 assert(base_r < MAX_BASE) ;
00261 assert(base_t < MAX_BASE) ;
00262 assert(base_p < MAX_BASE_2) ;
00263
00264
00265 if ( nr == 1 ) {
00266 for (int i=0; i<ntot; i++) {
00267 trav[i] = cf->t[i] ;
00268 }
00269 }
00270 else {
00271 invcf_r[base_r]( deg, dimc, (cf->t), dimc, trav ) ;
00272 }
00273
00274
00275 if ( np == 1) {
00276 if (nt==1) {
00277 for (int i=0 ; i<f->get_taille() ; i++)
00278 f->t[i] = trav[i] ;
00279 if ((vbase_t == T_LEG_PP) || (vbase_t == T_LEG_PI) ||
00280 (vbase_t == T_LEG_IP) || (vbase_t == T_LEG_II) ||
00281 (vbase_t == T_LEG_P) || (vbase_t == T_LEG_I) ||
00282 (vbase_t == T_LEG_MP) || (vbase_t == T_LEG_MI) ||
00283 (vbase_t == T_LEG) ) {
00284
00285 *f /=sqrt(2.) ;
00286 }
00287 }
00288
00289 else {
00290 bool pair = ( (vbase_t == T_LEG_PP) || (vbase_t == T_LEG_IP)
00291 || (vbase_t == T_LEG_MP) ) ;
00292 bool impair = ( (vbase_t == T_LEG_PI) || (vbase_t == T_LEG_II)
00293 || (vbase_t == T_LEG_MI)) ;
00294
00295 if ((pair && (vbase_p == P_COSSIN_I)) ||
00296 (impair && (vbase_p == P_COSSIN_P)) )
00297 ipasprevu_t(deg, dimc, trav, deg, (f->t) ) ;
00298 else
00299 invcf_t[base_t]( deg, dimc, trav, deg, (f->t) ) ;
00300 }
00301 }
00302 else {
00303
00304
00305 bool pair = ( (vbase_t == T_LEG_PP) || (vbase_t == T_LEG_IP)
00306 || (vbase_t == T_LEG_MP) ) ;
00307 bool impair = ( (vbase_t == T_LEG_PI) || (vbase_t == T_LEG_II)
00308 || (vbase_t == T_LEG_MI) ) ;
00309
00310 if ((pair && (vbase_p == P_COSSIN_I)) ||
00311 (impair && (vbase_p == P_COSSIN_P)) )
00312 ipasprevu_t(deg, dimc, trav, dimc, trav ) ;
00313 else
00314 invcf_t[base_t]( deg, dimc, trav, dimc, trav ) ;
00315
00316 invcf_p[base_p]( deg, dimc, deg, trav, (f->t) ) ;
00317 }
00318
00319 delete [] trav ;
00320 }
00321
00322 }
00323
00324
00325
00326
00327
00328 void ipasprevu_r(const int*, const int*, double*, const int*, double*) {
00329 cout << "Valeur::coef_i: the required expansion basis in r " << endl ;
00330 cout << " is not implemented !" << endl ;
00331 abort() ;
00332 }
00333
00334 void ipasprevu_t(const int*, const int*, double*, const int*, double* ) {
00335 cout << "Valeur::coef_i: the required expansion basis in theta " << endl ;
00336 cout << " is not implemented !" << endl ;
00337 abort() ;
00338 }
00339
00340 void ipasprevu_p(const int*, const int*, const int*, double*, double* ) {
00341 cout << "Valeur::coef_i: the required expansion basis in phi " << endl ;
00342 cout << " is not implemented !" << endl ;
00343 abort() ;
00344 }
00345
00346 void ibase_non_def_r(const int*, const int*, double*, const int*, double*) {
00347 cout << "Valeur::coef_i: the expansion basis in r is undefined !" << endl ;
00348 abort() ;
00349 }
00350
00351 void ibase_non_def_t(const int*, const int*, double*, const int*, double*) {
00352 cout << "Valeur::coef_i: the expansion basis in theta is undefined !"
00353 << endl ;
00354 abort() ;
00355 }
00356
00357 void ibase_non_def_p(const int*, const int*, const int*, double*, double*) {
00358 cout << "Valeur::coef_i: the expansion basis in phi is undefined !" << endl ;
00359 abort() ;
00360 }
00361