32 #include "ope_elementary.h" 39 Tbl _solh_poisson_2d_pas_prevu (
int,
int,
double,
double, Tbl&) {
41 cout <<
" Solution homogene pas prevue ..... : "<< endl ;
52 Tbl _solh_poisson_2d_r_cheb (
int n,
int l,
double alpha,
double beta,
56 double echelle = beta / alpha ;
60 val_lim.
set(0,0) =
pow(echelle-1,
double(l)) ;
61 val_lim.set(0,1) = double(l) *
pow(echelle-1,
double(l-1))/alpha ;
62 val_lim.
set(0,2) =
pow(echelle+1,
double(l)) ;
63 val_lim.set(0,3) = double(l) *
pow(echelle+1,
double(l-1))/alpha ;
66 val_lim.
set(1,0) =
pow(echelle-1, -
double(l)) ;
67 val_lim.set(1,1) = -double(l) *
pow(echelle-1, -
double(l+1))/alpha ;
68 val_lim.
set(1,2) =
pow(echelle+1, -
double(l)) ;
69 val_lim.set(1,3) = -double(l) *
pow(echelle+1, -
double(l+1))/alpha ;
73 val_lim.
set(0,0) = 1. ;
74 val_lim.
set(0,1) = 0. ;
75 val_lim.set(0,2) = 1. ;
76 val_lim.set(0,3) = 0. ;
78 val_lim.set(1,0) =
log(echelle-1) ;
79 val_lim.set(1,1) = 1./(echelle-1)/alpha ;
80 val_lim.set(1,2) =
log(echelle+1) ;
81 val_lim.set(1,3) = 1./(echelle+1)/alpha ;
84 const int nmax = 200 ;
85 static Tbl* tab[nmax] ;
86 static int nb_dejafait = 0 ;
87 static int l_dejafait[nmax] ;
88 static int nr_dejafait[nmax] ;
89 static double vieux_echelle = 0;
92 if (vieux_echelle != echelle) {
93 for (
int i=0 ; i<nb_dejafait ; i++) {
99 vieux_echelle = echelle ;
105 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
106 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
111 if (nb_dejafait >= nmax) {
112 cout <<
"_solh_poisson_2d_r_cheb : trop de Tbl" << endl ;
118 l_dejafait[nb_dejafait] = l ;
119 nr_dejafait[nb_dejafait] = n ;
123 double* coloc =
new double[n] ;
125 int * deg =
new int[3] ;
133 for (
int i=0 ; i<n ; i++)
135 coloc[i] =
pow(echelle-
cos(M_PI*i/(n-1)),
double(l)) ;
139 cfrcheb(deg, deg, coloc, deg, coloc) ;
140 for (
int i=0 ; i<n ;i++)
141 res.set(0, i) = coloc[i] ;
145 for (
int i=0 ; i<n ; i++)
147 coloc[i] =
pow(echelle-
cos(M_PI*i/(n-1)), -
double(l)) ;
149 coloc[i] =
log(echelle-
cos(M_PI*i/(n-1))) ;
151 cfrcheb(deg, deg, coloc, deg, coloc) ;
152 for (
int i=0 ; i<n ;i++)
153 res.set(1, i) = coloc[i] ;
158 tab[nb_dejafait] =
new Tbl(res) ;
163 else return *tab[indice] ;
170 Tbl _solh_poisson_2d_r_chebp (
int n,
int l,
double alpha,
171 double, Tbl& val_lim) {
173 val_lim.
set(0,0) = (l!=0) ? 1 : 0 ;
174 val_lim.set(0,1) = (l!=1) ? 0 : 1 ;
175 val_lim.set(0,2) = 1. ;
176 val_lim.set(0,3) = double(l)/alpha ;
178 const int nmax = 200 ;
179 static Tbl* tab[nmax] ;
180 static int nb_dejafait = 0 ;
181 static int l_dejafait[nmax] ;
182 static int nr_dejafait[nmax] ;
187 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
188 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
193 if (nb_dejafait >= nmax) {
194 cout <<
"_solh_poisson_2d_r_chebp : trop de Tbl" << endl ;
200 l_dejafait[nb_dejafait] = l ;
201 nr_dejafait[nb_dejafait] = n ;
203 assert (div(l, 2).rem ==0) ;
207 double* coloc =
new double[n] ;
209 int * deg =
new int[3] ;
214 for (
int i=0 ; i<n ; i++)
216 coloc[i] =
pow(
sin(M_PI*i/2/(n-1)),
double(l)) ;
220 cfrchebp(deg, deg, coloc, deg, coloc) ;
221 for (
int i=0 ; i<n ;i++)
222 res.set(i) = coloc[i] ;
226 tab[nb_dejafait] =
new Tbl(res) ;
231 else return *tab[indice] ;
239 Tbl _solh_poisson_2d_r_chebi (
int n,
int l,
240 double alpha,
double, Tbl& val_lim) {
242 val_lim.
set(0,0) = 0 ;
243 val_lim.set(0,1) = (l!=1) ? 0 : 1 ;
244 val_lim.set(0,2) = 1. ;
245 val_lim.set(0,3) = double(l)/alpha ;
247 const int nmax = 200 ;
248 static Tbl* tab[nmax] ;
249 static int nb_dejafait = 0 ;
250 static int l_dejafait[nmax] ;
251 static int nr_dejafait[nmax] ;
256 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
257 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
262 if (nb_dejafait >= nmax) {
263 cout <<
"_solh_r_chebi : trop de Tbl" << endl ;
269 l_dejafait[nb_dejafait] = l ;
270 nr_dejafait[nb_dejafait] = n ;
273 assert (div(l, 2).rem == 1) ;
277 double* coloc =
new double[n] ;
279 int * deg =
new int[3] ;
284 for (
int i=0 ; i<n ; i++)
285 coloc[i] =
pow(
sin(M_PI*i/2/(n-1)),
double(l)) ;
287 cfrchebi(deg, deg, coloc, deg, coloc) ;
288 for (
int i=0 ; i<n ;i++)
289 res.set(i) = coloc[i] ;
293 tab[nb_dejafait] =
new Tbl(res) ;
298 else return *tab[indice] ;
307 Tbl _solh_poisson_2d_r_chebu (
int n,
int l,
double alpha,
308 double, Tbl& val_lim) {
312 cout <<
"Case l=0 in 2D Poisson not defined in the external compactified domain..." << endl ;
316 val_lim.set(0,0) =
pow(-2.,
double(l)) ;
317 val_lim.set(0,1) = -double(l)*alpha*
pow(-2,
double(l+1.)) ;
318 val_lim.set(0,2) = 0 ;
319 val_lim.set(0,3) = 0 ;
321 const int nmax = 200 ;
322 static Tbl* tab[nmax] ;
323 static int nb_dejafait = 0 ;
324 static int l_dejafait[nmax] ;
325 static int nr_dejafait[nmax] ;
330 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
331 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
336 if (nb_dejafait >= nmax) {
337 cout <<
"_solh_poisson_2d_r_chebu : trop de Tbl" << endl ;
343 l_dejafait[nb_dejafait] = l ;
344 nr_dejafait[nb_dejafait] = n ;
350 double* coloc =
new double[n] ;
352 int * deg =
new int[3] ;
357 for (
int i=0 ; i<n ; i++)
358 coloc[i] =
pow(-1-
cos(M_PI*i/(n-1)),
double(l)) ;
360 cfrcheb(deg, deg, coloc, deg, coloc) ;
361 for (
int i=0 ; i<n ;i++)
362 res.set(i) = coloc[i] ;
366 tab[nb_dejafait] =
new Tbl(res) ;
371 else return *tab[indice] ;
378 static Tbl (*solh_poisson_2d[
MAX_BASE]) (int, int, double, double,
Tbl&) ;
385 solh_poisson_2d[i] = _solh_poisson_2d_pas_prevu ;
388 solh_poisson_2d[
R_CHEB >>
TRA_R] = _solh_poisson_2d_r_cheb ;
389 solh_poisson_2d[
R_CHEBP >>
TRA_R] = _solh_poisson_2d_r_chebp ;
390 solh_poisson_2d[
R_CHEBI >>
TRA_R] = _solh_poisson_2d_r_chebi ;
391 solh_poisson_2d[
R_CHEBU >>
TRA_R] = _solh_poisson_2d_r_chebu ;
double alpha
Parameter of the associated mapping.
Cmp log(const Cmp &)
Neperian logarithm.
double s_one_minus
Value of the first homogeneous solution at the inner boundary.
double ds_two_minus
Value of the derivative of the second homogeneous solution at the inner boundary. ...
double beta
Parameter of the associated mapping.
double & set(int i)
Read/write of a particular element (index i) (1D case)
double ds_two_plus
Value of the derivative of the second homogeneous solution at the outer boundary. ...
int l_quant
quantum number
Cmp cos(const Cmp &)
Cosine.
int base_r
Radial basis of decomposition.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
double ds_one_plus
Value of the derivative of the first homogeneous solution at the outer boundary.
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define R_CHEBP
base de Cheb. paire (rare) seulement
virtual Tbl get_solh() const
Computes the homogeneous solutions(s).
double s_two_minus
Value of the second homogeneous solution at the inner boundary.
Cmp pow(const Cmp &, int)
Power .
Tbl & set(int l)
Read/write of the value in a given domain.
double s_one_plus
Value of the first homogeneous solution at the outer boundary.
int nr
Number of radial points.
double ds_one_minus
Value of the derivative of the first homogeneous solution at the inner boundary.
Cmp sin(const Cmp &)
Sine.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
double s_two_plus
Value of the second homogeneous solution at the outer boundary.
#define MAX_BASE
Nombre max. de bases differentes.
#define R_CHEB
base de Chebychev ordinaire (fin)