00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 char op_dsdphi_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_dsdphi.C,v 1.4 2006/03/10 12:45:38 j_novak Exp $" ;
00025
00026
00027
00028
00029
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 #include "tbl.h"
00087 #include "proto_f77.h"
00088
00089
00090
00091
00092 void _dsdphi_pas_prevu(Tbl* , int & b) {
00093 cout << "Unknown phi basis in Mtbl_cf::dsdp() !" << endl ;
00094 cout << " basis: " << hex << b << endl ;
00095 abort() ;
00096 }
00097
00098
00099
00100
00101
00102 void _dsdphi_p_cossin(Tbl* tb, int & )
00103 {
00104
00105
00106 if (tb->get_etat() == ETATZERO) {
00107 return ;
00108 }
00109
00110
00111 assert(tb->get_etat() == ETATQCQ) ;
00112
00113
00114 int nr = (tb->dim).dim[0] ;
00115 int nt = (tb->dim).dim[1] ;
00116 int np = (tb->dim).dim[2] ;
00117 np = np - 2 ;
00118
00119
00120 static double* cx = 0 ;
00121 static int np_pre =0 ;
00122
00123
00124
00125 {
00126 if (np > np_pre) {
00127 np_pre = np ;
00128 cx = reinterpret_cast<double*>(realloc(cx, (np+2) * sizeof(double))) ;
00129 for (int i=0 ; i<np+2 ; i += 2) {
00130 cx[i] = - (i/2) ;
00131 cx[i+1] = (i/2) ;
00132 }
00133 }
00134 }
00135
00136
00137 double* xo = new double[(tb->dim).taille] ;
00138
00139
00140 for (int i=0; i<(tb->dim).taille; i++) {
00141 xo[i] = 0 ;
00142 }
00143
00144
00145 double* xi = tb->t ;
00146 double* xci = xi ;
00147 double* xco = xo ;
00148 int k, j ;
00149
00150
00151 xci += nr*nt ;
00152 xco += nr*nt ;
00153
00154
00155 for (j=0 ; j<nr*nt ; j++) {
00156 xco[j] = 0 ;
00157 }
00158 xci += nr*nt ;
00159 xco += nr*nt ;
00160
00161
00162 for (k=2 ; k<np ; k++) {
00163 for (j=0 ; j<nr*nt ; j++) {
00164 xco[j] = cx[k] * xci[j] ;
00165 }
00166 xci += nr*nt ;
00167 xco += nr*nt ;
00168 }
00169
00170
00171 xci += nr*nt ;
00172 xco += nr*nt ;
00173
00174
00175 for (j=0 ; j<nr*nt ; j++) {
00176 xco[j] = 0 ;
00177 }
00178
00179
00180 int nbr = nr*nt ;
00181 int inc = 1 ;
00182 double* p1 = xo ;
00183 double* p2 = p1 + nr*nt ;
00184 for (k=0 ; k<np+1 ; k +=2, p1 += 2*nr*nt, p2 += 2*nr*nt) {
00185 F77_dswap(&nbr, p1, &inc, p2, &inc) ;
00186 }
00187
00188
00189 delete [] tb->t ;
00190 tb->t = xo ;
00191
00192
00193
00194 }
00195
00196
00197
00198
00199
00200 void _dsdphi_p_cossin_p(Tbl* tb, int & )
00201 {
00202
00203
00204 if (tb->get_etat() == ETATZERO) {
00205 return ;
00206 }
00207
00208
00209 assert(tb->get_etat() == ETATQCQ) ;
00210
00211
00212 int nr = (tb->dim).dim[0] ;
00213 int nt = (tb->dim).dim[1] ;
00214 int np = (tb->dim).dim[2] ;
00215 np = np - 2 ;
00216
00217
00218 if (np == 1) {
00219 tb->set_etat_zero() ;
00220 return ;
00221 }
00222
00223
00224 static double* cx = 0 ;
00225 static int np_pre =0 ;
00226
00227
00228
00229 {
00230 if (np > np_pre) {
00231 np_pre = np ;
00232 cx = reinterpret_cast<double*>(realloc(cx, (np+2) * sizeof(double))) ;
00233 int i ;
00234 for (i=0 ; i<np+2 ; i += 2) {
00235 cx[i] = - (i/2) ;
00236 cx[i+1] = (i/2) ;
00237 }
00238 for (i=0 ; i<np+2 ; i++) {
00239 cx[i] = 2 * cx[i] ;
00240 }
00241 }
00242 }
00243
00244
00245 double* xo = new double[(tb->dim).taille] ;
00246
00247
00248 for (int i=0; i<(tb->dim).taille; i++) {
00249 xo[i] = 0 ;
00250 }
00251
00252
00253 double* xi = tb->t ;
00254 double* xci = xi ;
00255 double* xco = xo ;
00256 int k, j ;
00257
00258
00259 xci += nr*nt ;
00260 xco += nr*nt ;
00261
00262
00263 for (j=0 ; j<nr*nt ; j++) {
00264 xco[j] = 0 ;
00265 }
00266 xci += nr*nt ;
00267 xco += nr*nt ;
00268
00269
00270 for (k=2 ; k<np ; k++) {
00271 for (j=0 ; j<nr*nt ; j++) {
00272 xco[j] = cx[k] * xci[j] ;
00273 }
00274 xci += nr*nt ;
00275 xco += nr*nt ;
00276 }
00277
00278
00279 xci += nr*nt ;
00280 xco += nr*nt ;
00281
00282
00283 for (j=0 ; j<nr*nt ; j++) {
00284 xco[j] = 0 ;
00285 }
00286
00287
00288 int nbr = nr*nt ;
00289 int inc = 1 ;
00290 double* p1 = xo ;
00291 double* p2 = p1 + nr*nt ;
00292 for (k=0 ; k<np+1 ; k +=2, p1 += 2*nr*nt, p2 += 2*nr*nt) {
00293 F77_dswap(&nbr, p1, &inc, p2, &inc) ;
00294 }
00295
00296
00297 delete [] tb->t ;
00298 tb->t = xo ;
00299
00300
00301
00302 }
00303
00304
00305
00306
00307
00308 void _dsdphi_p_cossin_i(Tbl* tb, int & )
00309 {
00310
00311
00312 if (tb->get_etat() == ETATZERO) {
00313 return ;
00314 }
00315
00316
00317 assert(tb->get_etat() == ETATQCQ) ;
00318
00319
00320 int nr = (tb->dim).dim[0] ;
00321 int nt = (tb->dim).dim[1] ;
00322 int np = (tb->dim).dim[2] ;
00323 np = np - 2 ;
00324
00325 int ntnr = nt*nr ;
00326
00327
00328 if (np == 1) {
00329 tb->set_etat_zero() ;
00330 return ;
00331 }
00332
00333
00334 double* xo = new double[(tb->dim).taille] ;
00335
00336
00337 const double* xi = tb->t ;
00338
00339
00340
00341
00342 double* xco = xo ;
00343 const double* xci = xi + 2*ntnr ;
00344 for (int i=0; i<ntnr; i++) {
00345 xco[i] = xci[i] ;
00346 }
00347
00348
00349
00350
00351 xco = xo + ntnr ;
00352 for (int i=0; i<ntnr; i++) {
00353 xco[i] = 0 ;
00354 }
00355
00356
00357
00358
00359 xco = xo + 2*ntnr ;
00360 xci = xi ;
00361 for (int i=0; i<ntnr; i++) {
00362 xco[i] = - xci[i] ;
00363 }
00364
00365
00366
00367
00368 for (int k=3; k<np; k+=2) {
00369
00370
00371
00372
00373 xco = xo + k*ntnr ;
00374 xci = xi + (k+1)*ntnr ;
00375
00376 for (int i=0; i<ntnr; i++) {
00377 xco[i] = k * xci[i] ;
00378 }
00379
00380
00381
00382
00383 xco = xo + (k+1)*ntnr ;
00384 xci = xi + k*ntnr ;
00385
00386 for (int i=0; i<ntnr; i++) {
00387 xco[i] = - k * xci[i] ;
00388 }
00389
00390 }
00391
00392
00393
00394
00395 xco = xo + (np+1)*ntnr ;
00396 for (int i=0; i<ntnr; i++) {
00397 xco[i] = 0 ;
00398 }
00399
00400
00401
00402 delete [] tb->t ;
00403 tb->t = xo ;
00404
00405
00406
00407 }