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