00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 char som_asymy_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/som_asymy.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $" ;
00024
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 #include <math.h>
00063
00064
00065
00066
00067
00071
00072 void som_r_cheb_asymy(double* ti, const int nr, const int nt, const int np,
00073 const double x, double* trtp) {
00074
00075
00076 int i, j, k ;
00077 double* pi = ti ;
00078 double* po = trtp ;
00079
00080
00081 double* cheb = new double [nr] ;
00082 cheb[0] = 1. ;
00083 cheb[1] = x ;
00084 for (i=2; i<nr; i++) {
00085 cheb[i] = 2*x* cheb[i-1] - cheb[i-2] ;
00086 }
00087
00088
00089
00090 pi += 3*nr*nt ;
00091 po += 3*nt ;
00092
00093
00094
00095 for (k=3 ; k<np+1 ; k+=2) {
00096 for (j=0 ; j<nt ; j++) {
00097
00098 *po = 0 ;
00099 for (i=0 ; i<nr ; i++) {
00100 *po += (*pi) * cheb[i] ;
00101 pi++ ;
00102 }
00103 po++ ;
00104 }
00105
00106 pi += nr*nt ;
00107 po += nt ;
00108 }
00109
00110
00111 delete [] cheb ;
00112 }
00113
00114
00115
00119
00120 void som_r_chebu_asymy(double* ti, const int nr, const int nt, const int np,
00121 const double x, double* trtp) {
00122
00123
00124 int i, j, k ;
00125 double* pi = ti ;
00126 double* po = trtp ;
00127
00128
00129 double* cheb = new double [nr] ;
00130 cheb[0] = 1. ;
00131 cheb[1] = x ;
00132 for (i=2; i<nr; i++) {
00133 cheb[i] = 2*x* cheb[i-1] - cheb[i-2] ;
00134 }
00135
00136
00137
00138 pi += 3*nr*nt ;
00139 po += 3*nt ;
00140
00141
00142
00143 for (k=3 ; k<np+1 ; k+=2) {
00144 for (j=0 ; j<nt ; j++) {
00145
00146 *po = 0 ;
00147 for (i=0 ; i<nr ; i++) {
00148 *po += (*pi) * cheb[i] ;
00149 pi++ ;
00150 }
00151 po++ ;
00152 }
00153
00154 pi += nr*nt ;
00155 po += nt ;
00156 }
00157
00158
00159 delete [] cheb ;
00160
00161 }
00162
00163
00164
00168
00169 void som_r_chebpim_p_asymy(double* ti, const int nr, const int nt,
00170 const int np, const double x, double* trtp) {
00171
00172
00173 int i, j, k ;
00174 double* pi = ti ;
00175 double* po = trtp ;
00176
00177
00178 double* cheb = new double [2*nr] ;
00179 cheb[0] = 1. ;
00180 cheb[1] = x ;
00181 for (i=2 ; i<2*nr ; i++) {
00182 cheb[i] = 2*x* cheb[i-1] - cheb[i-2] ;
00183 }
00184
00185
00186
00187
00188 pi += 3*nr*nt ;
00189 po += 3*nt ;
00190
00191
00192
00193 for (k=3 ; k<np+1 ; k+=2) {
00194 int m = (k/2) % 2 ;
00195 for (j=0 ; j<nt ; j++) {
00196
00197 *po = 0 ;
00198 for (i=0 ; i<nr ; i++) {
00199 *po += (*pi) * cheb[2*i + m] ;
00200 pi++ ;
00201 }
00202 po++ ;
00203 }
00204
00205 pi += nr*nt ;
00206 po += nt ;
00207 }
00208
00209
00210
00211 delete [] cheb ;
00212
00213 }
00214
00218
00219 void som_r_chebpim_i_asymy(double* ti, const int nr, const int nt,
00220 const int np, const double x, double* trtp) {
00221
00222
00223 int i, j, k ;
00224 double* pi = ti ;
00225 double* po = trtp ;
00226
00227
00228 double* cheb = new double [2*nr] ;
00229 cheb[0] = 1. ;
00230 cheb[1] = x ;
00231 for (i=2 ; i<2*nr ; i++) {
00232 cheb[i] = 2*x* cheb[i-1] - cheb[i-2] ;
00233 }
00234
00235
00236
00237 pi += 3*nr*nt ;
00238 po += 3*nt ;
00239
00240
00241
00242 for (k=3 ; k<np+1 ; k+=2) {
00243 int m = (k/2) % 2 ;
00244 for (j=0 ; j<nt ; j++) {
00245
00246 *po = 0 ;
00247 for (i=0 ; i<nr ; i++) {
00248 *po += (*pi) * cheb[2*i + 1 - m] ;
00249 pi++ ;
00250 }
00251 po++ ;
00252 }
00253
00254 pi += nr*nt ;
00255 po += nt ;
00256 }
00257
00258
00259 delete [] cheb ;
00260
00261 }
00262
00263
00264
00265
00266
00267
00268
00272
00273 void som_tet_cossin_cp_asymy(double* ti, const int nt, const int np,
00274 const double tet, double* to) {
00275
00276
00277 int j, k ;
00278 double* pi = ti ;
00279 double* po = to ;
00280
00281
00282 double* cossin = new double [2*nt] ;
00283 for (j=0 ; j<2*nt ; j +=2) {
00284 cossin[j] = cos(j * tet) ;
00285 cossin[j+1] = sin((j+1) * tet) ;
00286 }
00287
00288
00289
00290 pi += 3*nt ;
00291 po += 3 ;
00292
00293
00294 for (k=3 ; k<np+1 ; k+=2) {
00295 int m = (k/2) % 2 ;
00296 (*po) = 0 ;
00297 for (j=0 ; j<nt ; j++) {
00298 *po += (*pi) * cossin[2*j + m] ;
00299 pi++ ;
00300 }
00301 po++ ;
00302
00303
00304 pi += nt ;
00305 po++ ;
00306
00307 }
00308
00309
00310 delete [] cossin ;
00311 }
00312
00316
00317 void som_tet_cossin_ci_asymy(double* ti, const int nt, const int np,
00318 const double tet, double* to) {
00319
00320
00321 int j, k ;
00322 double* pi = ti ;
00323 double* po = to ;
00324
00325
00326 double* cossin = new double [2*nt] ;
00327 for (j=0 ; j<2*nt ; j +=2) {
00328 cossin[j] = cos((j+1) * tet) ;
00329 cossin[j+1] = sin(j * tet) ;
00330 }
00331
00332
00333
00334 pi += 3*nt ;
00335 po += 3 ;
00336
00337
00338 for (k=3 ; k<np+1 ; k+=2) {
00339 int m = (k/2) % 2 ;
00340 (*po) = 0 ;
00341 for (j=0 ; j<nt ; j++) {
00342 *po += (*pi) * cossin[2*j + m] ;
00343 pi++ ;
00344 }
00345 po++ ;
00346
00347
00348 pi += nt ;
00349 po++ ;
00350
00351 }
00352
00353
00354 delete [] cossin ;
00355 }
00356
00357
00358
00359
00360
00361
00362 void som_phi_cossin_asymy(double* ti, const int np, const double phi,
00363 double* xo) {
00364
00365 *xo = 0 ;
00366
00367
00368 for (int k=3 ; k<np+1 ; k +=2 ) {
00369 int m = k/2 ;
00370 *xo += ti[k] * sin(m * phi) ;
00371 }
00372
00373 }
00374