32 #include "ope_elementary.h"    39 Tbl _cl_poisson_2d_pas_prevu (
const Tbl &source, 
int puis) {
    40      cout << 
"Combinaison lineaire pas prevue..." << endl ;
    41     cout << 
"source : " << &source << endl ;
    42     cout << 
"dzpuis : " << puis << endl ;
    54 Tbl _cl_poisson_2d_r_cheb (
const Tbl &source, 
int) {
    56     int n = source.get_dim(0) ;
    59     for (
int i=0 ; i<n-2 ; i++) {
    60         barre.set(i) = ((1+dirac)*source(i)-source(i+2))
    66     for (
int i=0 ; i<n-4 ; i++)
    67         res.set(i) = barre(i)-barre(i+2) ;
    75 Tbl _cl_poisson_2d_r_chebp (
const Tbl &source, 
int) {
    77     int n = source.get_dim(0) ;
    80     for (
int i=0 ; i<n-2 ; i++) {
    81         barre.set(i) = (1+dirac)*source(i)-source(i+2) ;
    86     for (
int i=0 ; i<n-4 ; i++)
    87         tilde.set(i) = barre(i)-barre(i+2) ;
    90     for (
int i=0 ; i<n-4 ; i++)
    91         res.set(i) = tilde(i)-tilde(i+1) ;
   101 Tbl _cl_poisson_2d_r_chebi (
const Tbl &source, 
int) {
   103     int n = source.get_dim(0) ;
   105     for (
int i=0 ; i<n-2 ; i++)
   106         barre.set(i) = source(i)-source(i+2) ;
   109     for (
int i=0 ; i<n-4 ; i++)
   110         tilde.set(i) = barre(i)-barre(i+2) ;    
   113     for (
int i=0 ; i<n-4 ; i++)
   114         res.set(i) = tilde(i)-tilde(i+1) ;
   123 Tbl _cl_poisson_2d_r_chebu_quatre(
const Tbl&) ;
   124 Tbl _cl_poisson_2d_r_chebu_trois(
const Tbl&) ;
   125 Tbl _cl_poisson_2d_r_chebu_deux(
const Tbl&) ;
   127 Tbl _cl_poisson_2d_r_chebu (
const Tbl &source, 
int puis) {
   135         res = _cl_poisson_2d_r_chebu_quatre(source) ;
   138         res = _cl_poisson_2d_r_chebu_trois (source) ;
   141         res = _cl_poisson_2d_r_chebu_deux(source) ;
   152 Tbl _cl_poisson_2d_r_chebu_quatre (
const Tbl &source) {
   154     int n = source.get_dim(0) ;
   157     for (
int i=0 ; i<n-2 ; i++) {
   158          barre.set(i) = ((1+dirac)*source(i)-source(i+2)) ;
   159     if (i==0) dirac = 0 ;
   163     for (
int i=0 ; i<n-4 ; i++)
   164         tilde.set(i) = (barre(i)-barre(i+2)) ;
   167     for (
int i=0 ; i<n-4 ; i++)
   168         prime.set(i) = (tilde(i)-tilde(i+1)) ;
   171     for (
int i=0 ; i<n-4 ; i++)
   172         res.set(i) = (prime(i)-prime(i+2)) ;
   177 Tbl _cl_poisson_2d_r_chebu_trois (
const Tbl &source) {
   179     int n = source.get_dim(0) ;
   182     for (
int i=0 ; i<n-2 ; i++) {
   183          barre.set(i) = ((1+dirac)*source(i)-source(i+2)) ;
   184     if (i==0) dirac = 0 ;
   188     for (
int i=0 ; i<n-4 ; i++)
   189         tilde.set(i) = (barre(i)-barre(i+2)) ;
   192     for (
int i=0 ; i<n-4 ; i++)
   193         res.set(i) = (tilde(i)+tilde(i+1)) ;
   199 Tbl _cl_poisson_2d_r_chebu_deux (
const Tbl &source) {
   201     int n = source.get_dim(0) ;
   204     for (
int i=0 ; i<n-2 ; i++) {
   205          barre.set(i) = ((1+dirac)*source(i)-source(i+2)) ;
   206     if (i==0) dirac = 0 ;
   210     for (
int i=0 ; i<n-4 ; i++)
   211         tilde.set(i) = (barre(i)-barre(i+2)) ;
   214     for (
int i=0 ; i<n-4 ; i++)
   215         res.set(i) = (tilde(i)+tilde(i+1)) ;
   224 Tbl cl_poisson_2d (
const Tbl &source, 
int puis, 
int base_r) {
   227     static Tbl (*cl_poisson_2d[
MAX_BASE])(
const Tbl &, int) ;
   234         cl_poisson_2d[i] = _cl_poisson_2d_pas_prevu ;
   237     cl_poisson_2d[
R_CHEB >> 
TRA_R] = _cl_poisson_2d_r_cheb ;
   238     cl_poisson_2d[
R_CHEBU >> 
TRA_R] = _cl_poisson_2d_r_chebu ;
   239     cl_poisson_2d[
R_CHEBP >> 
TRA_R] = _cl_poisson_2d_r_chebp ;
   240     cl_poisson_2d[
R_CHEBI >> 
TRA_R] = _cl_poisson_2d_r_chebi ;
   243     Tbl res(cl_poisson_2d[base_r](source, puis)) ;
   251 Tbl _solp_poisson_2d_pas_prevu (
const Matrice &, 
const Matrice &,
   252                 double,  
double, 
const Tbl &, 
int) {
   253     cout << 
" Solution homogene pas prevue ..... : "<< endl ;
   265 Tbl _solp_poisson_2d_r_cheb (
const Matrice &lap, 
const Matrice &nondege, 
   266                  double alpha, 
double beta, 
   267                  const Tbl &source, 
int) {
   270     int dege = n-nondege.get_dim(0) ;
   273     Tbl source_aux(source*alpha*alpha) ;
   274     Tbl xso(source_aux) ;
   275     Tbl xxso(source_aux) ;
   276     multx_1d(n, &xso.t, 
R_CHEB) ;
   277     multx_1d(n, &xxso.t, 
R_CHEB) ;
   278     multx_1d(n, &xxso.t, 
R_CHEB) ;
   279     source_aux = beta*beta/alpha/alpha*source_aux+2*beta/alpha*xso+xxso ;
   280     source_aux = cl_poisson_2d(source_aux, 0, 
R_CHEB) ;
   284     for (
int i=0 ; i<n-dege ; i++)
   285     so.set(i) = source_aux(i) ;
   287     Tbl auxi(nondege.inverse(so)) ;
   291     for (
int i=dege ; i<n ; i++)
   292     res.set(i) = auxi(i-dege) ;
   294     for (
int i=0 ; i<dege ; i++)
   304 Tbl _solp_poisson_2d_r_chebp (
const Matrice &lap, 
const Matrice &nondege, 
   305                   double alpha, 
double , 
const Tbl &source, 
int) {
   308     int dege = n-nondege.get_dim(0) ;
   309     assert ((dege==2) || (dege == 1)) ;
   310     Tbl source_aux(alpha*alpha*source) ;
   311     source_aux = cl_poisson_2d(source_aux, 0, 
R_CHEBP) ;
   315     for (
int i=0 ; i<n-dege ; i++)
   316     so.set(i) = source_aux(i);
   318     Tbl auxi(nondege.inverse(so)) ;
   322     for (
int i=dege ; i<n ; i++)
   323     res.set(i) = auxi(i-dege) ;
   325     for (
int i=0 ; i<dege ; i++)
   330     for (
int i=0 ; i<n ; i++)
   333         else somme += res(i) ;
   345 Tbl _solp_poisson_2d_r_chebi (
const Matrice &lap, 
const Matrice &nondege, 
   346                   double alpha, 
double, 
const Tbl &source, 
int) {
   350     int dege = n-nondege.get_dim(0) ;
   351     assert ((dege == 2) || (dege ==1)) ;
   352     Tbl source_aux(source*alpha*alpha) ;
   353     source_aux = cl_poisson_2d(source_aux, 0, 
R_CHEBI) ;
   357     for (
int i=0 ; i<n-dege ; i++)
   358     so.set(i) = source_aux(i);
   360     Tbl auxi(nondege.inverse(so)) ;
   364     for (
int i=dege ; i<n ; i++)
   365     res.set(i) = auxi(i-dege) ;
   367     for (
int i=0 ; i<dege ; i++)
   372     for (
int i=0 ; i<n ; i++)
   374         somme -= (2*i+1)*res(i) ;
   375         else somme += (2*i+1)*res(i) ;
   387 Tbl _solp_poisson_2d_r_chebu_quatre (
const Matrice&, 
const Matrice&, 
   388                      double, 
const Tbl&) ;
   389 Tbl _solp_poisson_2d_r_chebu_trois (
const Matrice&, 
const Matrice&, 
   390                      double, 
const Tbl&) ;
   391 Tbl _solp_poisson_2d_r_chebu_deux (
const Matrice&, 
const Matrice&, 
   394 Tbl _solp_poisson_2d_r_chebu (
const Matrice &lap, 
const Matrice &nondege, 
   395                  double alpha, 
double, 
   396                  const Tbl &source, 
int puis) {
   404         res = _solp_poisson_2d_r_chebu_quatre 
   405           (lap, nondege, alpha, source) ;
   408         res = _solp_poisson_2d_r_chebu_trois 
   409           (lap, nondege, alpha, source) ;
   412         res = _solp_poisson_2d_r_chebu_deux 
   413           (lap, nondege, source) ;
   424 Tbl _solp_poisson_2d_r_chebu_quatre (
const Matrice &lap, 
const Matrice &nondege, 
   425                      double alpha, 
const Tbl &source) {
   428     int dege = n-nondege.get_dim(0) ;
   429     assert ((dege==3) || (dege ==2)) ;
   430     Tbl source_aux(source*alpha*alpha) ;
   431     source_aux = cl_poisson_2d(source_aux, 4, 
R_CHEBU) ;
   435     for (
int i=0 ; i<n-dege ; i++)
   436     so.set(i) = source_aux(i);
   438     Tbl auxi(nondege.inverse(so)) ;
   442     for (
int i=dege ; i<n ; i++)
   443     res.set(i) = auxi(i-dege) ;
   445     for (
int i=0 ; i<dege ; i++)
   450     for (
int i=0 ; i<n ; i++)
   451         somme += i*i*res(i) ;
   452     double somme_deux = somme ;
   453     for (
int i=0 ; i<n ; i++)
   454         somme_deux -= res(i) ;
   455     res.set(1) = -somme ;
   456     res.set(0) = somme_deux ;
   461     for (
int i=0 ; i<n ; i++)
   463     res.set(0) = -somme ;
   469 Tbl _solp_poisson_2d_r_chebu_trois (
const Matrice &lap, 
const Matrice &nondege, 
   470                     double alpha, 
const Tbl &source) {
   473     int dege = n-nondege.get_dim(0) ;
   476     Tbl source_aux(source*alpha) ;
   477     source_aux = cl_poisson_2d(source_aux, 3, 
R_CHEBU) ;
   481     for (
int i=0 ; i<n-dege ; i++)
   482     so.set(i) = source_aux(i);
   484     Tbl auxi(nondege.inverse(so)) ;
   488     for (
int i=dege ; i<n ; i++)
   489     res.set(i) = auxi(i-dege) ;
   491     for (
int i=0 ; i<dege ; i++)
   495     for (
int i=0 ; i<n ; i++)
   497     res.set(0) = -somme ;
   503 Tbl _solp_poisson_2d_r_chebu_deux (
const Matrice &lap, 
const Matrice &nondege, 
   507     int dege = n-nondege.get_dim(0) ;
   508     assert ((dege==1) || (dege ==2)) ;
   509     Tbl source_aux(cl_poisson_2d(source, 2, 
R_CHEBU)) ;
   513     for (
int i=0 ; i<n-dege ; i++)
   514     so.set(i) = source_aux(i);
   516     Tbl auxi(nondege.inverse(so)) ;
   520     for (
int i=dege ; i<n ; i++)
   521     res.set(i) = auxi(i-dege) ;
   523     for (
int i=0 ; i<dege ; i++)
   528     for (
int i=0 ; i<n ; i++)
   531     res.set(0) = -somme ;
   545                        double, double,
const Tbl&, int) ;
   552       solp_poisson_2d[i] = _solp_poisson_2d_pas_prevu ;
   555     solp_poisson_2d[
R_CHEB >> 
TRA_R] = _solp_poisson_2d_r_cheb ;
   556     solp_poisson_2d[
R_CHEBP >> 
TRA_R] = _solp_poisson_2d_r_chebp ;
   557     solp_poisson_2d[
R_CHEBI >> 
TRA_R] = _solp_poisson_2d_r_chebi ;
   558     solp_poisson_2d[
R_CHEBU >> 
TRA_R] = _solp_poisson_2d_r_chebu ;
   565   valeurs *= 
sqrt(
double(2)) ;
 double alpha
Parameter  of the associated mapping. 
Cmp sqrt(const Cmp &)
Square root. 
virtual void do_non_dege() const
Computes the non-degenerated matrix of the operator. 
double beta
Parameter  of the associated mapping. 
int dzpuis
the associated dzpuis, if in the compactified domain. 
Matrice * ope_mat
Pointer on the matrix representation of the operator. 
double dsp_minus
Value of the derivative of the particular solution at the inner boundary. 
double sp_minus
Value of the particular solution at the inner boundary. 
int base_r
Radial basis of decomposition. 
double sp_plus
Value of the particular solution at the outer boundary. 
#define TRA_R
Translation en R, used for a bitwise shift (in hex) 
double dsp_plus
Value of the derivative of the particular solution at the outer boundary. 
#define R_CHEBI
base de Cheb. impaire (rare) seulement 
#define R_CHEBP
base de Cheb. paire (rare) seulement 
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i]) 
int get_dim(int i) const
Returns the dimension of the matrix. 
virtual Tbl get_solp(const Tbl &so) const
Computes the particular solution, given the source so . 
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r 
#define MAX_BASE
Nombre max. de bases differentes. 
Matrice * non_dege
Pointer on the non-degenerated matrix of the operator. 
#define R_CHEB
base de Chebychev ordinaire (fin)