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 char prepa_pvect_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_pois_vect_r/prepa_pvect_r.C,v 1.2 2004/05/17 15:42:21 j_novak Exp $" ;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include <stdlib.h>
00048
00049 #include "matrice.h"
00050 #include "type_parite.h"
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 Matrice _nondeg_pvect_r_pas_prevu(const Matrice &, int , double, int) ;
00068 Matrice _nondeg_pvect_r_cheb (const Matrice&, int, double, int) ;
00069 Matrice _nondeg_pvect_r_chebp (const Matrice&, int, double, int) ;
00070 Matrice _nondeg_pvect_r_chebi (const Matrice&, int, double, int) ;
00071 Matrice _nondeg_pvect_r_chebu (const Matrice&, int, double, int) ;
00072
00073
00074
00075
00076
00077
00078 Matrice _nondeg_pvect_r_pas_prevu(const Matrice &lap, int l, double echelle, int puis) {
00079 cout << "Construction non degeneree pas prevue..." << endl ;
00080 cout << "l : " << l << endl ;
00081 cout << "lap : " << lap << endl ;
00082 cout << "echelle : " << echelle << endl ;
00083 cout << " puis : " << puis << endl ;
00084 abort() ;
00085 exit(-1) ;
00086 Matrice res(1, 1) ;
00087 return res;
00088 }
00089
00090
00091
00092
00093
00094
00095
00096 Matrice _nondeg_pvect_r_cheb (const Matrice &lap, int l, double echelle, int) {
00097
00098
00099 int n = lap.get_dim(0) ;
00100
00101 const int nmax = 200 ;
00102 static Matrice* tab[nmax] ;
00103 static int nb_dejafait = 0 ;
00104 static int l_dejafait[nmax] ;
00105 static int nr_dejafait[nmax] ;
00106 static double vieux_echelle = 0;
00107
00108
00109 if (vieux_echelle != echelle) {
00110 for (int i=0 ; i<nb_dejafait ; i++) {
00111 l_dejafait[i] = -1 ;
00112 nr_dejafait[i] = -1 ;
00113 delete tab[i] ;
00114 }
00115 vieux_echelle = echelle ;
00116 nb_dejafait = 0 ;
00117 }
00118
00119 int indice = -1 ;
00120
00121
00122 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00123 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00124 indice = conte ;
00125
00126
00127 if (indice == -1) {
00128 if (nb_dejafait >= nmax) {
00129 cout << "_nondeg_pvect_r_cheb : trop de matrices" << endl ;
00130 abort() ;
00131 exit (-1) ;
00132 }
00133
00134
00135 l_dejafait[nb_dejafait] = l ;
00136 nr_dejafait[nb_dejafait] = n ;
00137
00138
00139
00140
00141 Matrice res(n-2, n-2) ;
00142 res.set_etat_qcq() ;
00143 for (int i=0 ; i<n-2 ; i++)
00144 for (int j=0 ; j<n-2 ; j++)
00145 res.set(i, j) = lap(i, j+2) ;
00146
00147 res.set_band(2, 2) ;
00148 res.set_lu() ;
00149 tab[nb_dejafait] = new Matrice(res) ;
00150 nb_dejafait ++ ;
00151 return res ;
00152 }
00153
00154
00155 else
00156 return *tab[indice] ;
00157 }
00158
00159
00160
00161
00162
00163
00164
00165
00166 Matrice _nondeg_pvect_r_chebp (const Matrice &lap, int l, double, int) {
00167
00168 int n = lap.get_dim(0) ;
00169
00170
00171 const int nmax = 200 ;
00172 static Matrice* tab[nmax] ;
00173 static int nb_dejafait = 0 ;
00174 static int l_dejafait[nmax] ;
00175 static int nr_dejafait[nmax] ;
00176
00177 int indice = -1 ;
00178
00179
00180 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00181 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00182 indice = conte ;
00183
00184
00185 if (indice == -1) {
00186 if (nb_dejafait >= nmax) {
00187 cout << "_nondeg_pvect_r_chebp : trop de matrices" << endl ;
00188 abort() ;
00189 exit (-1) ;
00190 }
00191
00192
00193 l_dejafait[nb_dejafait] = l ;
00194 nr_dejafait[nb_dejafait] = n ;
00195
00196 assert (div(l, 2).rem == 1) ;
00197
00198 if (l==1) {
00199 Matrice res(n-1, n-1) ;
00200 res.set_etat_qcq() ;
00201 for (int i=0 ; i<n-1 ; i++)
00202 for (int j=0 ; j<n-1 ; j++)
00203 res.set(i, j) = lap(i, j+1) ;
00204 res.set_band(3, 0) ;
00205 res.set_lu() ;
00206 tab[nb_dejafait] = new Matrice(res) ;
00207 nb_dejafait ++ ;
00208 return res ;
00209 }
00210 else {
00211 Matrice res(n-2, n-2) ;
00212 res.set_etat_qcq() ;
00213 for (int i=0 ;i<n-2 ; i++)
00214 for (int j=0 ; j<n-2 ; j++)
00215 res.set(i, j) = lap(i, j+2) ;
00216
00217 res.set_band(2, 1) ;
00218 res.set_lu() ;
00219 tab[nb_dejafait] = new Matrice(res) ;
00220 nb_dejafait ++ ;
00221 return res ;
00222 }
00223 }
00224
00225 else
00226 return *tab[indice] ;
00227 }
00228
00229
00230
00231
00232
00233
00234
00235
00236 Matrice _nondeg_pvect_r_chebi (const Matrice &lap, int l, double, int) {
00237
00238 int n = lap.get_dim(0) ;
00239
00240 const int nmax = 200 ;
00241 static Matrice* tab[nmax] ;
00242 static int nb_dejafait = 0 ;
00243 static int l_dejafait[nmax] ;
00244 static int nr_dejafait[nmax] ;
00245
00246 int indice = -1 ;
00247
00248
00249 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00250 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00251 indice = conte ;
00252
00253
00254 if (indice == -1) {
00255 if (nb_dejafait >= nmax) {
00256 cout << "_nondeg_pvect_r_chebi : trop de matrices" << endl ;
00257 abort() ;
00258 exit (-1) ;
00259 }
00260
00261
00262 l_dejafait[nb_dejafait] = l ;
00263 nr_dejafait[nb_dejafait] = n ;
00264
00265
00266 assert (div(l, 2).rem == 0) ;
00267
00268
00269 if (l<=2) {
00270 Matrice res(n-1, n-1) ;
00271 res.set_etat_qcq() ;
00272 for (int i=0 ; i<n-1 ; i++)
00273 for (int j=0 ; j<n-1 ; j++)
00274 res.set(i, j) = lap(i, j+1) ;
00275 res.set_band(3, 0) ;
00276 res.set_lu() ;
00277 tab[nb_dejafait] = new Matrice(res) ;
00278 nb_dejafait ++ ;
00279 return res ;
00280 }
00281 else {
00282 Matrice res(n-2, n-2) ;
00283 res.set_etat_qcq() ;
00284 for (int i=0 ;i<n-2 ; i++)
00285 for (int j=0 ; j<n-2 ; j++)
00286 res.set(i, j) = lap(i, j+2) ;
00287
00288 res.set_band(2, 1) ;
00289 res.set_lu() ;
00290 tab[nb_dejafait] = new Matrice(res) ;
00291 nb_dejafait ++ ;
00292 return res ;
00293 }
00294 }
00295
00296 else
00297 return *tab[indice] ;
00298 }
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308 Matrice _nondeg_pvect_r_chebu (const Matrice &lap, int l, double, int puis) {
00309
00310 if (puis != 4) {
00311 cout << "_ope_pvect_r_mat_r_chebu : only the case dzpuis = 4 "
00312 << '\n' << "is implemented! \n"
00313 << "dzpuis = " << puis << endl ;
00314 abort() ;
00315 }
00316 int n = lap.get_dim(0) ;
00317
00318 const int nmax = 200;
00319 static Matrice* tab[nmax] ;
00320 static int nb_dejafait = 0 ;
00321 static int l_dejafait[nmax] ;
00322 static int nr_dejafait[nmax] ;
00323
00324 int indice = -1 ;
00325
00326
00327 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00328 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00329 indice = conte ;
00330
00331
00332 if (indice == -1) {
00333 if (nb_dejafait >= nmax) {
00334 cout << "_nondeg_pvect_r_chebu : trop de matrices" << endl ;
00335 abort() ;
00336 exit (-1) ;
00337 }
00338
00339 l_dejafait[nb_dejafait] = l ;
00340 nr_dejafait[nb_dejafait] = n ;
00341
00342 Matrice res(n-3, n-3) ;
00343 res.set_etat_qcq() ;
00344 for (int i=0 ;i<n-3 ; i++)
00345 for (int j=0 ; j<n-3 ; j++)
00346 res.set(i, j) = lap(i, j+3) ;
00347
00348 res.set_band(2, 1) ;
00349 res.set_lu() ;
00350 tab[nb_dejafait] = new Matrice(res) ;
00351 nb_dejafait ++ ;
00352 return res ;
00353
00354 }
00355
00356 else
00357 return *tab[indice] ;
00358 }
00359
00360
00361
00362
00363
00364
00365
00366 Matrice nondeg_pvect_r(const Matrice &lap, int l, double echelle, int puis, int base_r)
00367 {
00368
00369
00370 static Matrice (*nondeg_pvect_r[MAX_BASE])(const Matrice&, int, double, int) ;
00371 static int nap = 0 ;
00372
00373
00374 if (nap==0) {
00375 nap = 1 ;
00376 for (int i=0 ; i<MAX_BASE ; i++) {
00377 nondeg_pvect_r[i] = _nondeg_pvect_r_pas_prevu ;
00378 }
00379
00380 nondeg_pvect_r[R_CHEB >> TRA_R] = _nondeg_pvect_r_cheb ;
00381 nondeg_pvect_r[R_CHEBU >> TRA_R] = _nondeg_pvect_r_chebu ;
00382 nondeg_pvect_r[R_CHEBP >> TRA_R] = _nondeg_pvect_r_chebp ;
00383 nondeg_pvect_r[R_CHEBI >> TRA_R] = _nondeg_pvect_r_chebi ;
00384 }
00385
00386 Matrice res(nondeg_pvect_r[base_r](lap, l, echelle, puis)) ;
00387 return res ;
00388 }
00389