28char sh_pvect_r_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_pois_vect_r/sh_pvect_r.C,v 1.5 2014/10/13 08:53:34 j_novak Exp $" ;
59#include "type_parite.h"
89Tbl _sh_pvect_r_pas_prevu (
int,
int,
double) ;
90Tbl _sh_pvect_r_cheb (
int,
int,
double) ;
91Tbl _sh_pvect_r_chebp (
int,
int,
double) ;
92Tbl _sh_pvect_r_chebi (
int,
int,
double) ;
93Tbl _sh_pvect_r_chebu (
int,
int,
double) ;
98Tbl _sh_pvect_r_pas_prevu (
int n,
int l,
double echelle) {
100 cout <<
" Solution homogene pas prevue ..... : "<< endl ;
101 cout <<
" N : " << n << endl ;
102 cout <<
" l : " << l << endl ;
103 cout <<
" echelle : " << echelle << endl ;
115Tbl _sh_pvect_r_cheb (
int n,
int l,
double echelle) {
117 const int nmax = 200 ;
118 static Tbl* tab[nmax] ;
119 static int nb_dejafait = 0 ;
120 static int l_dejafait[nmax] ;
121 static int nr_dejafait[nmax] ;
122 static double vieux_echelle = 0;
125 if (vieux_echelle != echelle) {
126 for (
int i=0 ; i<nb_dejafait ; i++) {
128 nr_dejafait[i] = -1 ;
132 vieux_echelle = echelle ;
138 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
139 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
144 if (nb_dejafait >= nmax) {
145 cout <<
"_sh_pvect_r_cheb : trop de Tbl" << endl ;
151 l_dejafait[nb_dejafait] = l ;
152 nr_dejafait[nb_dejafait] = n ;
158 double* coloc =
new double[n] ;
160 int * deg =
new int[3] ;
169 for (
int i=0 ; i<n ; i++)
170 coloc[i] = echelle -
cos(M_PI*i/(n-1)) ;
172 cfrcheb(deg, deg, coloc, deg, coloc) ;
173 for (
int i=0 ; i<n ;i++)
174 res.set(0, i) = coloc[i] ;
178 for (
int i=1 ; i<n ; i++)
183 for (
int i=0 ; i<n ; i++)
184 coloc[i] =
pow(echelle-
cos(M_PI*i/(n-1)),
double(l-1)) ;
186 cfrcheb(deg, deg, coloc, deg, coloc) ;
187 for (
int i=0 ; i<n ;i++)
188 res.set(0, i) = coloc[i] ;
194 for (
int i=0 ; i<n ; i++)
195 coloc[i] = 1/
pow(echelle-
cos(M_PI*i/(n-1)),
double(l+2)) ;
197 cfrcheb(deg, deg, coloc, deg, coloc) ;
198 for (
int i=0 ; i<n ;i++)
199 res.set(1, i) = coloc[i] ;
203 tab[nb_dejafait] =
new Tbl(res) ;
208 else return *tab[indice] ;
215Tbl _sh_pvect_r_chebp (
int n,
int l,
double) {
217 const int nmax = 200 ;
218 static Tbl* tab[nmax] ;
219 static int nb_dejafait = 0 ;
220 static int l_dejafait[nmax] ;
221 static int nr_dejafait[nmax] ;
226 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
227 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
232 if (nb_dejafait >= nmax) {
233 cout <<
"_sh_pvect_r_chebp : trop de Tbl" << endl ;
239 l_dejafait[nb_dejafait] = l ;
240 nr_dejafait[nb_dejafait] = n ;
244 double* coloc =
new double[n] ;
246 int * deg =
new int[3] ;
251 assert (div(l, 2).rem == 1) ;
254 for (
int i=1 ; i<n ; i++)
258 for (
int i=0 ; i<n ; i++)
259 coloc[i] =
pow(
sin(M_PI*i/2/(n-1)),
double(l-1)) ;
261 cfrchebp(deg, deg, coloc, deg, coloc) ;
262 for (
int i=0 ; i<n ;i++)
263 res.set(i) = coloc[i] ;
268 tab[nb_dejafait] =
new Tbl(res) ;
273 else return *tab[indice] ;
281Tbl _sh_pvect_r_chebi (
int n,
int l,
double) {
283 const int nmax = 200 ;
284 static Tbl* tab[nmax] ;
285 static int nb_dejafait = 0 ;
286 static int l_dejafait[nmax] ;
287 static int nr_dejafait[nmax] ;
292 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
293 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
298 if (nb_dejafait >= nmax) {
299 cout <<
"_sh_pvect_r_chebi : trop de Tbl" << endl ;
305 l_dejafait[nb_dejafait] = l ;
306 nr_dejafait[nb_dejafait] = n ;
309 assert (div(l, 2).rem == 0) ;
314 double* coloc =
new double[n] ;
316 int * deg =
new int[3] ;
323 for (
int i=1 ; i<n ; i++)
327 for (
int i=0 ; i<n ; i++)
328 coloc[i] =
pow(
sin(M_PI*i/2/(n-1)),
double(l-1)) ;
330 cfrchebi(deg, deg, coloc, deg, coloc) ;
331 for (
int i=0 ; i<n ;i++)
332 res.set(i) = coloc[i] ;
337 tab[nb_dejafait] =
new Tbl(res) ;
342 else return *tab[indice] ;
351Tbl _sh_pvect_r_chebu (
int n,
int l,
double) {
353 const int nmax = 200 ;
354 static Tbl* tab[nmax] ;
355 static int nb_dejafait = 0 ;
356 static int l_dejafait[nmax] ;
357 static int nr_dejafait[nmax] ;
362 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
363 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
368 if (nb_dejafait >= nmax) {
369 cout <<
"_sh_pvect_r_chebu : trop de Tbl" << endl ;
375 l_dejafait[nb_dejafait] = l ;
376 nr_dejafait[nb_dejafait] = n ;
382 double* coloc =
new double[n] ;
384 int * deg =
new int[3] ;
389 for (
int i=0 ; i<n ; i++)
390 coloc[i] =
pow(-1-
cos(M_PI*i/(n-1)),
double(l+2)) ;
392 cfrcheb(deg, deg, coloc, deg, coloc) ;
393 for (
int i=0 ; i<n ;i++)
394 res.set(i) = coloc[i] ;
398 tab[nb_dejafait] =
new Tbl(res) ;
403 else return *tab[indice] ;
414Tbl sh_pvect_r(
int n,
int l,
double echelle,
int base_r) {
417 static Tbl (*sh_pvect_r[
MAX_BASE])(int, int, double) ;
424 sh_pvect_r[i] = _sh_pvect_r_pas_prevu ;
433 Tbl res(sh_pvect_r[base_r](n, l, echelle)) ;
Cmp sin(const Cmp &)
Sine.
Cmp pow(const Cmp &, int)
Power .
Cmp cos(const Cmp &)
Cosine.
#define MAX_BASE
Nombre max. de bases differentes.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
#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