23char prepa_poisson_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/prepa_poisson.C,v 1.9 2014/10/13 08:53:30 j_novak Exp $" ;
122#include "type_parite.h"
148Matrice _prepa_nondege_pas_prevu(
const Matrice &lap,
int l,
double echelle,
int puis) {
149 cout <<
"Construction non degeneree pas prevue..." << endl ;
150 cout <<
"l : " << l << endl ;
151 cout <<
"lap : " << lap << endl ;
152 cout <<
"echelle : " << echelle << endl ;
153 cout <<
" puis : " << puis << endl ;
166Matrice _prepa_nondege_r_cheb (
const Matrice &lap,
int l,
double echelle,
int) {
171 const int nmax = 200 ;
172 static Matrice* tab[nmax] ;
173 static int nb_dejafait = 0 ;
174 static int l_dejafait[nmax] ;
175 static int nr_dejafait[nmax] ;
176 static double vieux_echelle = 0;
179 if (vieux_echelle != echelle) {
180 for (
int i=0 ; i<nb_dejafait ; i++) {
182 nr_dejafait[i] = -1 ;
185 vieux_echelle = echelle ;
192 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
193 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
198 if (nb_dejafait >= nmax) {
199 cout <<
"_prepa_nondege_r_cheb : trop de matrices" << endl ;
205 l_dejafait[nb_dejafait] = l ;
206 nr_dejafait[nb_dejafait] = n ;
211 Matrice res(n-2, n-2) ;
213 for (
int i=0 ; i<n-2 ; i++)
214 for (
int j=0 ; j<n-2 ; j++)
215 res.set(i, j) = lap(i, j+2) ;
219 tab[nb_dejafait] =
new Matrice(res) ;
226 return *tab[indice] ;
234Matrice _prepa_nondege_r_jaco02 (
const Matrice &lap,
int l,
double echelle,
int) {
239 const int nmax = 200 ;
240 static Matrice* tab[nmax] ;
241 static int nb_dejafait = 0 ;
242 static int l_dejafait[nmax] ;
243 static int nr_dejafait[nmax] ;
244 static double vieux_echelle = 0;
247 if (vieux_echelle != echelle) {
248 for (
int i=0 ; i<nb_dejafait ; i++) {
250 nr_dejafait[i] = -1 ;
253 vieux_echelle = echelle ;
260 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
261 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
266 if (nb_dejafait >= nmax) {
267 cout <<
"_prepa_nondege_r_jaco02 : trop de matrices" << endl ;
273 l_dejafait[nb_dejafait] = l ;
274 nr_dejafait[nb_dejafait] = n ;
279 Matrice res(n-2, n-2) ;
281 for (
int i=0 ; i<n-2 ; i++)
282 for (
int j=0 ; j<n-2 ; j++)
283 res.set(i, j) = lap(i, j+2) ;
287 tab[nb_dejafait] =
new Matrice(res) ;
294 return *tab[indice] ;
301Matrice _prepa_nondege_r_chebp (
const Matrice &lap,
int l,
double,
int) {
306 const int nmax = 200 ;
307 static Matrice* tab[nmax] ;
308 static int nb_dejafait = 0 ;
309 static int l_dejafait[nmax] ;
310 static int nr_dejafait[nmax] ;
315 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
316 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
321 if (nb_dejafait >= nmax) {
322 cout <<
"_prepa_nondege_r_chebp : trop de matrices" << endl ;
328 l_dejafait[nb_dejafait] = l ;
329 nr_dejafait[nb_dejafait] = n ;
331 assert (div(l, 2).rem == 0) ;
335 Matrice res(n-1, n-1) ;
337 for (
int i=0 ; i<n-1 ; i++)
338 for (
int j=0 ; j<n-1 ; j++)
339 res.set(i, j) = lap(i, j+1) ;
342 tab[nb_dejafait] =
new Matrice(res) ;
347 Matrice res(n-2, n-2) ;
349 for (
int i=0 ;i<n-2 ; i++)
350 for (
int j=0 ; j<n-2 ; j++)
351 res.set(i, j) = lap(i, j+2) ;
355 tab[nb_dejafait] =
new Matrice(res) ;
362 return *tab[indice] ;
372Matrice _prepa_nondege_r_chebi (
const Matrice &lap,
int l,
double,
int) {
376 const int nmax = 200 ;
377 static Matrice* tab[nmax] ;
378 static int nb_dejafait = 0 ;
379 static int l_dejafait[nmax] ;
380 static int nr_dejafait[nmax] ;
385 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
386 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
391 if (nb_dejafait >= nmax) {
392 cout <<
"_prepa_nondege_r_chebi : trop de matrices" << endl ;
398 l_dejafait[nb_dejafait] = l ;
399 nr_dejafait[nb_dejafait] = n ;
402 assert (div(l, 2).rem == 1) ;
406 Matrice res(n-1, n-1) ;
408 for (
int i=0 ; i<n-1 ; i++)
409 for (
int j=0 ; j<n-1 ; j++)
410 res.set(i, j) = lap(i, j+1) ;
413 tab[nb_dejafait] =
new Matrice(res) ;
418 Matrice res(n-2, n-2) ;
420 for (
int i=0 ;i<n-2 ; i++)
421 for (
int j=0 ; j<n-2 ; j++)
422 res.set(i, j) = lap(i, j+2) ;
426 tab[nb_dejafait] =
new Matrice(res) ;
433 return *tab[indice] ;
444Matrice _prepa_nondege_r_chebu (
const Matrice &lap,
int l,
double,
int puis) {
448 return _prepa_nondege_r_chebu_cinq (lap, l) ;
450 return _prepa_nondege_r_chebu_quatre (lap, l) ;
452 return _prepa_nondege_r_chebu_trois (lap, l) ;
454 return _prepa_nondege_r_chebu_deux (lap, l) ;
458 return Matrice(0, 0) ;
463Matrice _prepa_nondege_r_chebu_quatre (
const Matrice &lap,
int l) {
467 const int nmax = 200;
468 static Matrice* tab[nmax] ;
469 static int nb_dejafait = 0 ;
470 static int l_dejafait[nmax] ;
471 static int nr_dejafait[nmax] ;
476 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
477 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
482 if (nb_dejafait >= nmax) {
483 cout <<
"_prepa_nondege_r_chebu : trop de matrices" << endl ;
489 l_dejafait[nb_dejafait] = l ;
490 nr_dejafait[nb_dejafait] = n ;
495 Matrice res(n-2, n-2) ;
497 for (
int i=0 ; i<n-2 ; i++)
498 for (
int j=0 ; j<n-2 ; j++)
499 res.set(i, j) = lap(i, j+2) ;
502 tab[nb_dejafait] =
new Matrice(res) ;
507 Matrice res(n-3, n-3) ;
509 for (
int i=0 ;i<n-3 ; i++)
510 for (
int j=0 ; j<n-3 ; j++)
511 res.set(i, j) = lap(i, j+3) ;
515 tab[nb_dejafait] =
new Matrice(res) ;
522 return *tab[indice] ;
525Matrice _prepa_nondege_r_chebu_trois (
const Matrice &lap,
int l) {
529 const int nmax = 200;
530 static Matrice* tab[nmax] ;
531 static int nb_dejafait = 0 ;
532 static int l_dejafait[nmax] ;
533 static int nr_dejafait[nmax] ;
538 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
539 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
544 if (nb_dejafait >= nmax) {
545 cout <<
"_prepa_nondege_r_chebu_trois : trop de matrices" << endl ;
550 l_dejafait[nb_dejafait] = l ;
551 nr_dejafait[nb_dejafait] = n ;
553 Matrice res(n-2, n-2) ;
555 for (
int i=0 ; i<n-2 ; i++)
556 for (
int j=0 ; j<n-2 ; j++)
557 res.set(i, j) = lap(i, j+2) ;
560 tab[nb_dejafait] =
new Matrice(res) ;
566 return *tab[indice] ;
570Matrice _prepa_nondege_r_chebu_deux (
const Matrice &lap,
int l) {
574 const int nmax = 200;
575 static Matrice* tab[nmax] ;
576 static int nb_dejafait = 0 ;
577 static int l_dejafait[nmax] ;
578 static int nr_dejafait[nmax] ;
583 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
584 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
589 if (nb_dejafait >= nmax) {
590 cout <<
"_prepa_nondege_r_chebu : trop de matrices" << endl ;
596 l_dejafait[nb_dejafait] = l ;
597 nr_dejafait[nb_dejafait] = n ;
602 Matrice res(n-2, n-2) ;
604 for (
int i=0 ;i<n-2 ; i++)
605 for (
int j=0 ; j<n-2 ; j++)
606 res.set(i, j) = lap(i, j+2) ;
609 tab[nb_dejafait] =
new Matrice(res) ;
614 Matrice res(n-1, n-1) ;
616 for (
int i=0 ;i<n-1 ; i++)
617 for (
int j=0 ; j<n-1 ; j++)
618 res.set(i, j) = lap(i, j+1) ;
621 tab[nb_dejafait] =
new Matrice(res) ;
628 return *tab[indice] ;
632Matrice _prepa_nondege_r_chebu_cinq (
const Matrice &lap,
int l) {
636 const int nmax = 200;
637 static Matrice* tab[nmax] ;
638 static int nb_dejafait = 0 ;
639 static int l_dejafait[nmax] ;
640 static int nr_dejafait[nmax] ;
645 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
646 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
651 if (nb_dejafait >= nmax) {
652 cout <<
"_prepa_nondege_r_chebu : trop de matrices" << endl ;
658 l_dejafait[nb_dejafait] = l ;
659 nr_dejafait[nb_dejafait] = n ;
664 tab[nb_dejafait] =
new Matrice(lap) ;
665 tab[nb_dejafait]->set_band(5,0) ;
666 tab[nb_dejafait]->set_lu() ;
668 return *tab[nb_dejafait-1] ;
671 Matrice res(n-1, n-1) ;
673 for (
int i=0 ;i<n-1 ; i++)
674 for (
int j=0 ; j<n-1 ; j++)
675 res.set(i, j) = lap(i, j+1) ;
678 tab[nb_dejafait] =
new Matrice(res) ;
686 return *tab[indice] ;
694Matrice prepa_nondege(
const Matrice &lap,
int l,
double echelle,
int puis,
int base_r)
698 static Matrice (*prepa_nondege[
MAX_BASE])(
const Matrice&, int, double, int) ;
705 prepa_nondege[i] = _prepa_nondege_pas_prevu ;
708 prepa_nondege[
R_CHEB >>
TRA_R] = _prepa_nondege_r_cheb ;
709 prepa_nondege[
R_CHEBU >>
TRA_R] = _prepa_nondege_r_chebu ;
710 prepa_nondege[
R_CHEBP >>
TRA_R] = _prepa_nondege_r_chebp ;
711 prepa_nondege[
R_CHEBI >>
TRA_R] = _prepa_nondege_r_chebi ;
715 Matrice res(prepa_nondege[base_r](lap, l, echelle, puis)) ;
int get_dim(int i) const
Returns the dimension of the matrix.
#define MAX_BASE
Nombre max. de bases differentes.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
#define R_JACO02
base de Jacobi(0,2) ordinaire (finjac)
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
#define R_CHEB
base de Chebychev ordinaire (fin)
#define R_CHEBP
base de Cheb. paire (rare) seulement