00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 char ope_helmholtz_minus_pseudo_1d_mat_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_mat.C,v 1.1 2004/08/24 09:14:46 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 Matrice _helmholtz_minus_pseudo_1d_mat_pas_prevu(int, int, double, double,
00039 double, int) {
00040 cout << "Operateur pas prevu..." << endl ;
00041 abort() ;
00042 exit(-1) ;
00043 Matrice res(1, 1) ;
00044 return res;
00045 }
00046
00047
00048
00049
00050
00051
00052
00053 Matrice _helmholtz_minus_pseudo_1d_mat_r_chebu_deux(int,int,double, double) ;
00054
00055 Matrice _helmholtz_minus_pseudo_1d_mat_r_chebu( int n, int l, double masse,
00056 double alpha, double, int puis) {
00057 Matrice res(n-2, n-2) ;
00058 res.set_etat_qcq() ;
00059 switch (puis) {
00060 case 2 :
00061 res = _helmholtz_minus_pseudo_1d_mat_r_chebu_deux (n, l,masse, alpha) ;
00062 break ;
00063 default :
00064 abort() ;
00065 exit(-1) ;
00066 }
00067 return res ;
00068 }
00069
00070
00071 Matrice _helmholtz_minus_pseudo_1d_mat_r_chebu_deux (int n, int l, double masse,
00072 double alpha) {
00073
00074
00075 Matrice res(n-2, n-2) ;
00076 res.set_etat_qcq() ;
00077 double* vect = new double[n] ;
00078 double* vect_bis = new double[n] ;
00079 double* vect_dd = new double[n] ;
00080 double* vect_d = new double[n] ;
00081
00082 for (int i=0 ; i<n-2 ; i++) {
00083 for (int j=0 ; j<n ; j++)
00084 vect[j] = 0 ;
00085 vect[i] = 2*i+3 ;
00086 vect[i+1] = -4*i-4 ;
00087 vect[i+2] = 2*i+1 ;
00088
00089
00090 for (int j=0 ; j<n ; j++)
00091 vect_bis[j] = vect[j] ;
00092
00093 d2sdx2_1d (n, &vect_bis, R_CHEBU) ;
00094 mult2_xm1_1d_cheb (n, vect_bis, vect_dd) ;
00095
00096
00097 for (int j=0 ; j<n ; j++)
00098 vect_bis[j] = vect[j] ;
00099
00100 dsdx_1d (n, &vect_bis, R_CHEBU) ;
00101 mult_xm1_1d_cheb (n, vect_bis, vect_d) ;
00102
00103
00104 for (int j=0 ; j<n ; j++)
00105 vect_bis[j] = vect[j] ;
00106 sx2_1d (n, &vect_bis, R_CHEBU) ;
00107
00108 for (int j=0 ; j<n-2 ; j++)
00109 res.set(j,i) = vect_dd[j] + 2*vect_d[j] - l*(l-1)*vect[j] - masse*masse/alpha/alpha*vect_bis[j] ;
00110 }
00111
00112 delete [] vect ;
00113 delete [] vect_bis ;
00114 delete [] vect_dd ;
00115
00116 return res ;
00117 }
00118
00119
00120
00121 void Ope_helmholtz_minus_pseudo_1d::do_ope_mat() const {
00122 if (ope_mat != 0x0)
00123 delete ope_mat ;
00124
00125
00126 static Matrice (*helmholtz_minus_pseudo_1d_mat[MAX_BASE])(int, int, double,
00127 double, double, int);
00128 static int nap = 0 ;
00129
00130
00131 if (nap==0) {
00132 nap = 1 ;
00133 for (int i=0 ; i<MAX_BASE ; i++) {
00134 helmholtz_minus_pseudo_1d_mat[i] = _helmholtz_minus_pseudo_1d_mat_pas_prevu ;
00135 }
00136
00137 helmholtz_minus_pseudo_1d_mat[R_CHEBU >> TRA_R] = _helmholtz_minus_pseudo_1d_mat_r_chebu ;
00138 }
00139 ope_mat = new Matrice(helmholtz_minus_pseudo_1d_mat[base_r](nr, l_quant, masse,
00140 alpha, beta, dzpuis)) ;
00141 }