00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 char ope_poisson_2d_non_dege_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_poisson_2d/ope_poisson_2d_non_dege.C,v 1.1 2004/08/24 09:14:47 p_grandclement Exp $" ;
00022
00023
00024
00025
00026
00027
00028 #include <math.h>
00029 #include <stdlib.h>
00030
00031 #include "proto.h"
00032 #include "ope_elementary.h"
00033
00034
00035
00036
00037
00038
00039 Matrice _poisson_2d_non_dege_pas_prevu(const Matrice &lap, int, double, int) {
00040 cout << "Construction non degeneree pas prevue..." << endl ;
00041 abort() ;
00042 exit(-1) ;
00043 return lap ;
00044 }
00045
00046
00047
00048
00049
00050
00051
00052 Matrice _poisson_2d_non_dege_r_cheb (const Matrice &lap, int l, double echelle, int) {
00053
00054
00055 int n = lap.get_dim(0) ;
00056
00057 const int nmax = 200 ;
00058 static Matrice* tab[nmax] ;
00059 static int nb_dejafait = 0 ;
00060 static int l_dejafait[nmax] ;
00061 static int nr_dejafait[nmax] ;
00062 static double vieux_echelle = 0;
00063
00064
00065 if (vieux_echelle != echelle) {
00066 for (int i=0 ; i<nb_dejafait ; i++) {
00067 l_dejafait[i] = -1 ;
00068 nr_dejafait[i] = -1 ;
00069 delete tab[i] ;
00070 }
00071 vieux_echelle = echelle ;
00072 nb_dejafait = 0 ;
00073 }
00074
00075 int indice = -1 ;
00076
00077
00078 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00079 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00080 indice = conte ;
00081
00082
00083 if (indice == -1) {
00084 if (nb_dejafait >= nmax) {
00085 cout << "_poisson_2d_non_dege_r_cheb : trop de matrices" << endl ;
00086 abort() ;
00087 exit (-1) ;
00088 }
00089
00090
00091 l_dejafait[nb_dejafait] = l ;
00092 nr_dejafait[nb_dejafait] = n ;
00093
00094
00095
00096
00097 Matrice res(n-2, n-2) ;
00098 res.set_etat_qcq() ;
00099 for (int i=0 ; i<n-2 ; i++)
00100 for (int j=0 ; j<n-2 ; j++)
00101 res.set(i, j) = lap(i, j+2) ;
00102
00103 res.set_band(2, 2) ;
00104 res.set_lu() ;
00105 tab[nb_dejafait] = new Matrice(res) ;
00106 nb_dejafait ++ ;
00107 return res ;
00108 }
00109
00110
00111 else
00112 return *tab[indice] ;
00113 }
00114
00115
00116
00117
00118
00119
00120
00121
00122 Matrice _poisson_2d_non_dege_r_chebp (const Matrice &lap, int l, double, int) {
00123
00124 int n = lap.get_dim(0) ;
00125
00126
00127 const int nmax = 200 ;
00128 static Matrice* tab[nmax] ;
00129 static int nb_dejafait = 0 ;
00130 static int l_dejafait[nmax] ;
00131 static int nr_dejafait[nmax] ;
00132
00133 int indice = -1 ;
00134
00135
00136 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00137 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00138 indice = conte ;
00139
00140
00141 if (indice == -1) {
00142 if (nb_dejafait >= nmax) {
00143 cout << "_poisson_2d_non_dege_r_chebp : trop de matrices" << endl ;
00144 abort() ;
00145 exit (-1) ;
00146 }
00147
00148
00149 l_dejafait[nb_dejafait] = l ;
00150 nr_dejafait[nb_dejafait] = n ;
00151
00152 assert (div(l, 2).rem == 0) ;
00153
00154
00155 if (l==0) {
00156 Matrice res(n-1, n-1) ;
00157 res.set_etat_qcq() ;
00158 for (int i=0 ; i<n-1 ; i++)
00159 for (int j=0 ; j<n-1 ; j++)
00160 res.set(i, j) = lap(i, j+1) ;
00161 res.set_band(3, 0) ;
00162 res.set_lu() ;
00163 tab[nb_dejafait] = new Matrice(res) ;
00164 nb_dejafait ++ ;
00165 return res ;
00166 }
00167 else {
00168 Matrice res(n-2, n-2) ;
00169 res.set_etat_qcq() ;
00170 for (int i=0 ;i<n-2 ; i++)
00171 for (int j=0 ; j<n-2 ; j++)
00172 res.set(i, j) = lap(i, j+2) ;
00173
00174 res.set_band(2, 1) ;
00175 res.set_lu() ;
00176 tab[nb_dejafait] = new Matrice(res) ;
00177 nb_dejafait ++ ;
00178 return res ;
00179 }
00180 }
00181
00182 else
00183 return *tab[indice] ;
00184 }
00185
00186
00187
00188
00189
00190
00191
00192
00193 Matrice _poisson_2d_non_dege_r_chebi (const Matrice &lap, int l, double, int) {
00194
00195 int n = lap.get_dim(0) ;
00196
00197 const int nmax = 200 ;
00198 static Matrice* tab[nmax] ;
00199 static int nb_dejafait = 0 ;
00200 static int l_dejafait[nmax] ;
00201 static int nr_dejafait[nmax] ;
00202
00203 int indice = -1 ;
00204
00205
00206 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00207 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00208 indice = conte ;
00209
00210
00211 if (indice == -1) {
00212 if (nb_dejafait >= nmax) {
00213 cout << "_poisson_2d_non_dege_r_chebi : trop de matrices" << endl ;
00214 abort() ;
00215 exit (-1) ;
00216 }
00217
00218
00219 l_dejafait[nb_dejafait] = l ;
00220 nr_dejafait[nb_dejafait] = n ;
00221
00222
00223 assert (div(l, 2).rem == 1) ;
00224
00225
00226 if (l==1) {
00227 Matrice res(n-1, n-1) ;
00228 res.set_etat_qcq() ;
00229 for (int i=0 ; i<n-1 ; i++)
00230 for (int j=0 ; j<n-1 ; j++)
00231 res.set(i, j) = lap(i, j+1) ;
00232 res.set_band(3, 0) ;
00233 res.set_lu() ;
00234 tab[nb_dejafait] = new Matrice(res) ;
00235 nb_dejafait ++ ;
00236 return res ;
00237 }
00238 else {
00239 Matrice res(n-2, n-2) ;
00240 res.set_etat_qcq() ;
00241 for (int i=0 ;i<n-2 ; i++)
00242 for (int j=0 ; j<n-2 ; j++)
00243 res.set(i, j) = lap(i, j+2) ;
00244
00245 res.set_band(2, 1) ;
00246 res.set_lu() ;
00247 tab[nb_dejafait] = new Matrice(res) ;
00248 nb_dejafait ++ ;
00249 return res ;
00250 }
00251 }
00252
00253 else
00254 return *tab[indice] ;
00255 }
00256
00257
00258
00259
00260
00261
00262
00263 Matrice _poisson_2d_non_dege_r_chebu_quatre (const Matrice&, int) ;
00264 Matrice _poisson_2d_non_dege_r_chebu_trois (const Matrice&, int) ;
00265 Matrice _poisson_2d_non_dege_r_chebu_deux (const Matrice&, int) ;
00266
00267 Matrice _poisson_2d_non_dege_r_chebu (const Matrice &lap, int l, double, int puis) {
00268
00269 switch (puis) {
00270 case 4 :
00271 return _poisson_2d_non_dege_r_chebu_quatre (lap, l) ;
00272 case 3 :
00273 return _poisson_2d_non_dege_r_chebu_trois (lap, l) ;
00274 case 2 :
00275 return _poisson_2d_non_dege_r_chebu_deux (lap, l) ;
00276 default :
00277 abort() ;
00278 exit(-1) ;
00279 return Matrice(0, 0) ;
00280 }
00281 }
00282
00283
00284 Matrice _poisson_2d_non_dege_r_chebu_quatre (const Matrice &lap, int l) {
00285
00286 int n = lap.get_dim(0) ;
00287
00288 const int nmax = 200;
00289 static Matrice* tab[nmax] ;
00290 static int nb_dejafait = 0 ;
00291 static int l_dejafait[nmax] ;
00292 static int nr_dejafait[nmax] ;
00293
00294 int indice = -1 ;
00295
00296
00297 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00298 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00299 indice = conte ;
00300
00301
00302 if (indice == -1) {
00303 if (nb_dejafait >= nmax) {
00304 cout << "_poisson_2d_non_dege_r_chebu : trop de matrices" << endl ;
00305 abort() ;
00306 exit (-1) ;
00307 }
00308
00309
00310 l_dejafait[nb_dejafait] = l ;
00311 nr_dejafait[nb_dejafait] = n ;
00312
00313
00314
00315 if (l==0) {
00316 Matrice res(n-2, n-2) ;
00317 res.set_etat_qcq() ;
00318 for (int i=0 ; i<n-2 ; i++)
00319 for (int j=0 ; j<n-2 ; j++)
00320 res.set(i, j) = lap(i, j+2) ;
00321 res.set_band(3, 0) ;
00322 res.set_lu() ;
00323 tab[nb_dejafait] = new Matrice(res) ;
00324 nb_dejafait ++ ;
00325 return res ;
00326 }
00327 else {
00328 Matrice res(n-3, n-3) ;
00329 res.set_etat_qcq() ;
00330 for (int i=0 ;i<n-3 ; i++)
00331 for (int j=0 ; j<n-3 ; j++)
00332 res.set(i, j) = lap(i, j+3) ;
00333
00334 res.set_band(2, 1) ;
00335 res.set_lu() ;
00336 tab[nb_dejafait] = new Matrice(res) ;
00337 nb_dejafait ++ ;
00338 return res ;
00339 }
00340 }
00341
00342 else
00343 return *tab[indice] ;
00344 }
00345
00346 Matrice _poisson_2d_non_dege_r_chebu_trois (const Matrice &lap, int l) {
00347
00348 int n = lap.get_dim(0) ;
00349
00350 const int nmax = 200;
00351 static Matrice* tab[nmax] ;
00352 static int nb_dejafait = 0 ;
00353 static int l_dejafait[nmax] ;
00354 static int nr_dejafait[nmax] ;
00355
00356 int indice = -1 ;
00357
00358
00359 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00360 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00361 indice = conte ;
00362
00363
00364 if (indice == -1) {
00365 if (nb_dejafait >= nmax) {
00366 cout << "_poisson_2d_non_dege_r_chebu_trois : trop de matrices" << endl ;
00367 abort() ;
00368 exit (-1) ;
00369 }
00370
00371 l_dejafait[nb_dejafait] = l ;
00372 nr_dejafait[nb_dejafait] = n ;
00373
00374 Matrice res(n-2, n-2) ;
00375 res.set_etat_qcq() ;
00376 for (int i=0 ; i<n-2 ; i++)
00377 for (int j=0 ; j<n-2 ; j++)
00378 res.set(i, j) = lap(i, j+2) ;
00379 res.set_band(2, 1) ;
00380 res.set_lu() ;
00381 tab[nb_dejafait] = new Matrice(res) ;
00382 nb_dejafait ++ ;
00383 return res ;
00384 }
00385
00386 else
00387 return *tab[indice] ;
00388 }
00389
00390
00391 Matrice _poisson_2d_non_dege_r_chebu_deux (const Matrice &lap, int l) {
00392
00393 int n = lap.get_dim(0) ;
00394
00395 const int nmax = 200;
00396 static Matrice* tab[nmax] ;
00397 static int nb_dejafait = 0 ;
00398 static int l_dejafait[nmax] ;
00399 static int nr_dejafait[nmax] ;
00400
00401 int indice = -1 ;
00402
00403
00404 for (int conte=0 ; conte<nb_dejafait ; conte ++)
00405 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
00406 indice = conte ;
00407
00408
00409 if (indice == -1) {
00410 if (nb_dejafait >= nmax) {
00411 cout << "_poisson_2d_non_dege_r_chebu : trop de matrices" << endl ;
00412 abort() ;
00413 exit (-1) ;
00414 }
00415
00416
00417 l_dejafait[nb_dejafait] = l ;
00418 nr_dejafait[nb_dejafait] = n ;
00419
00420
00421
00422 if (l==0) {
00423 Matrice res(n-2, n-2) ;
00424 res.set_etat_qcq() ;
00425 for (int i=0 ;i<n-2 ; i++)
00426 for (int j=0 ; j<n-2 ; j++)
00427 res.set(i, j) = lap(i, j+2) ;
00428 res.set_band(3, 2) ;
00429 res.set_lu() ;
00430 tab[nb_dejafait] = new Matrice(res) ;
00431 nb_dejafait ++ ;
00432 return res ;
00433 }
00434 else {
00435 Matrice res(n-1, n-1) ;
00436 res.set_etat_qcq() ;
00437 for (int i=0 ;i<n-1 ; i++)
00438 for (int j=0 ; j<n-1 ; j++)
00439 res.set(i, j) = lap(i, j+1) ;
00440 res.set_band(4, 1) ;
00441 res.set_lu() ;
00442 tab[nb_dejafait] = new Matrice(res) ;
00443 nb_dejafait ++ ;
00444 return res ;
00445 }
00446 }
00447
00448 else
00449 return *tab[indice] ;
00450 }
00451
00452
00453 void Ope_poisson_2d::do_non_dege() const {
00454 if (ope_cl == 0x0)
00455 do_ope_cl() ;
00456
00457 if (non_dege != 0x0)
00458 delete non_dege ;
00459
00460
00461 static Matrice (*poisson_2d_non_dege[MAX_BASE])(const Matrice&,
00462 int, double,int);
00463 static int nap = 0 ;
00464
00465
00466 if (nap==0) {
00467 nap = 1 ;
00468 for (int i=0 ; i<MAX_BASE ; i++) {
00469 poisson_2d_non_dege[i] = _poisson_2d_non_dege_pas_prevu ;
00470 }
00471
00472 poisson_2d_non_dege[R_CHEB >> TRA_R] = _poisson_2d_non_dege_r_cheb ;
00473 poisson_2d_non_dege[R_CHEBP >> TRA_R] = _poisson_2d_non_dege_r_chebp ;
00474 poisson_2d_non_dege[R_CHEBI >> TRA_R] = _poisson_2d_non_dege_r_chebi ;
00475 poisson_2d_non_dege[R_CHEBU >> TRA_R] = _poisson_2d_non_dege_r_chebu ;
00476 }
00477 non_dege = new Matrice(poisson_2d_non_dege[base_r](*ope_cl, l_quant,
00478 beta/alpha, dzpuis)) ;
00479 }