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_2d_solp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_2d/ope_helmholtz_minus_2d_solp.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 Tbl _cl_helmholtz_minus_2d_pas_prevu (const Tbl & source, int) {
00039 cout << "Combinaison lineaire pas prevue..." << endl ;
00040 abort() ;
00041 exit(-1) ;
00042 return source;
00043 }
00044
00045
00046
00047
00048
00049
00050
00051 Tbl _cl_helmholtz_minus_2d_r_cheb (const Tbl &source, int) {
00052 Tbl barre(source) ;
00053 int n = source.get_dim(0) ;
00054
00055 int dirac = 1 ;
00056 for (int i=0 ; i<n-2 ; i++) {
00057 barre.set(i) = ((1+dirac)*source(i)-source(i+2))
00058 /(i+1) ;
00059 if (i==0) dirac = 0 ;
00060 }
00061
00062 Tbl res(barre) ;
00063 for (int i=0 ; i<n-4 ; i++)
00064 res.set(i) = barre(i)-barre(i+2) ;
00065 return res ;
00066 }
00067
00068
00069
00070
00071
00072
00073 Tbl _cl_helmholtz_minus_2d_r_chebu_deux(const Tbl&) ;
00074
00075 Tbl _cl_helmholtz_minus_2d_r_chebu (const Tbl &source, int puis) {
00076
00077 int n=source.get_dim(0) ;
00078 Tbl res(n) ;
00079 res.set_etat_qcq() ;
00080
00081 switch(puis) {
00082 case 2 :
00083 res = _cl_helmholtz_minus_2d_r_chebu_deux(source) ;
00084 break ;
00085
00086 default :
00087 abort() ;
00088 exit(-1) ;
00089 }
00090 return res ;
00091 }
00092
00093
00094 Tbl _cl_helmholtz_minus_2d_r_chebu_deux (const Tbl &source) {
00095
00096 Tbl barre(source) ;
00097 int n = source.get_dim(0) ;
00098
00099 int dirac = 1 ;
00100 for (int i=0 ; i<n-2 ; i++) {
00101 barre.set(i) = ((1+dirac)*source(i)-source(i+2)) ;
00102 if (i==0) dirac = 0 ;
00103 }
00104
00105 Tbl tilde(barre) ;
00106 for (int i=0 ; i<n-4 ; i++)
00107 tilde.set(i) = (barre(i)-barre(i+2)) ;
00108
00109 Tbl bis(tilde) ;
00110 for (int i=0 ; i<n-4 ; i++)
00111 bis.set(i) = (tilde(i)+tilde(i+1)) ;
00112
00113 Tbl res(bis) ;
00114 for (int i=0 ; i<n-4 ; i++)
00115 res.set(i) = (bis(i)-bis(i+1)) ;
00116
00117 return res ;
00118 }
00119
00120
00121
00122
00123
00124
00125 Tbl cl_helmholtz_minus_2d (const Tbl &source, int puis, int base_r) {
00126
00127 static Tbl (*cl_helmholtz_minus_2d[MAX_BASE])(const Tbl &, 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 cl_helmholtz_minus_2d[i] = _cl_helmholtz_minus_2d_pas_prevu ;
00135 }
00136
00137 cl_helmholtz_minus_2d[R_CHEB >> TRA_R] = _cl_helmholtz_minus_2d_r_cheb ;
00138 cl_helmholtz_minus_2d[R_CHEBU >> TRA_R] = _cl_helmholtz_minus_2d_r_chebu ;
00139
00140 }
00141
00142 Tbl res(cl_helmholtz_minus_2d[base_r](source, puis)) ;
00143 return res ;
00144 }
00145
00146
00147
00148
00149
00150 Tbl _solp_helmholtz_minus_2d_pas_prevu (const Matrice &, const Matrice &,
00151 double, double, const Tbl &, int) {
00152 cout << " Solution homogene pas prevue ..... : "<< endl ;
00153 abort() ;
00154 exit(-1) ;
00155 Tbl res(1) ;
00156 return res;
00157 }
00158
00159
00160
00161
00162
00163
00164 Tbl _solp_helmholtz_minus_2d_r_cheb (const Matrice &lap, const Matrice &nondege,
00165 double alpha, double beta,
00166 const Tbl &source, int) {
00167
00168 int n = lap.get_dim(0) ;
00169 int dege = n-nondege.get_dim(0) ;
00170 assert (dege ==2) ;
00171
00172 Tbl source_aux(source*alpha*alpha) ;
00173 Tbl xso(source_aux) ;
00174 Tbl xxso(source_aux) ;
00175 multx_1d(n, &xso.t, R_CHEB) ;
00176 multx_1d(n, &xxso.t, R_CHEB) ;
00177 multx_1d(n, &xxso.t, R_CHEB) ;
00178 source_aux = beta*beta/alpha/alpha*source_aux+2*beta/alpha*xso+xxso ;
00179 source_aux = cl_helmholtz_minus_2d(source_aux, 0, R_CHEB) ;
00180
00181 Tbl so(n-dege) ;
00182 so.set_etat_qcq() ;
00183 for (int i=0 ; i<n-dege ; i++)
00184 so.set(i) = source_aux(i) ;
00185
00186 Tbl auxi(nondege.inverse(so)) ;
00187
00188 Tbl res(n) ;
00189 res.set_etat_qcq() ;
00190 for (int i=dege ; i<n ; i++)
00191 res.set(i) = auxi(i-dege) ;
00192
00193 for (int i=0 ; i<dege ; i++)
00194 res.set(i) = 0 ;
00195
00196 return res ;
00197 }
00198
00199
00200
00201
00202
00203
00204 Tbl _solp_helmholtz_minus_2d_r_chebu_deux (const Matrice&, const Matrice&,
00205 const Tbl&) ;
00206
00207 Tbl _solp_helmholtz_minus_2d_r_chebu (const Matrice &lap, const Matrice &nondege,
00208 double, double,
00209 const Tbl &source, int puis) {
00210 int n = lap.get_dim(0) ;
00211 Tbl res(n+2) ;
00212 res.set_etat_qcq() ;
00213
00214 switch (puis) {
00215 case 2 :
00216 res = _solp_helmholtz_minus_2d_r_chebu_deux
00217 (lap, nondege, source) ;
00218 break ;
00219 default :
00220 abort() ;
00221 exit(-1) ;
00222 }
00223 return res ;
00224 }
00225
00226
00227 Tbl _solp_helmholtz_minus_2d_r_chebu_deux (const Matrice &lap, const Matrice &nondege,
00228 const Tbl &source) {
00229
00230 int n = lap.get_dim(0)+2 ;
00231 int dege = n-nondege.get_dim(0) ;
00232 assert (dege == 3) ;
00233
00234 Tbl source_cl (cl_helmholtz_minus_2d(source, 2, R_CHEBU)) ;
00235
00236 Tbl so(n-dege) ;
00237 so.set_etat_qcq() ;
00238 for (int i=0 ; i<n-dege ; i++)
00239 so.set(i) = source_cl(i);
00240
00241 Tbl sol (nondege.inverse(so)) ;
00242
00243 Tbl res(n) ;
00244 res.annule_hard() ;
00245 for (int i=1 ; i<n-2 ; i++) {
00246 res.set(i) += sol(i-1)*(2*i+3) ;
00247 res.set(i+1) += -sol(i-1)*(4*i+4) ;
00248 res.set(i+2) += sol(i-1)*(2*i+1) ;
00249 }
00250
00251 return res ;
00252 }
00253
00254
00255 Tbl Ope_helmholtz_minus_2d::get_solp (const Tbl& so) const {
00256
00257 if (non_dege == 0x0)
00258 do_non_dege() ;
00259
00260
00261 static Tbl (*solp_helmholtz_minus_2d[MAX_BASE]) (const Matrice&, const Matrice&,
00262 double, double,const Tbl&, int) ;
00263 static int nap = 0 ;
00264
00265
00266 if (nap==0) {
00267 nap = 1 ;
00268 for (int i=0 ; i<MAX_BASE ; i++) {
00269 solp_helmholtz_minus_2d[i] = _solp_helmholtz_minus_2d_pas_prevu ;
00270 }
00271
00272 solp_helmholtz_minus_2d[R_CHEB >> TRA_R] = _solp_helmholtz_minus_2d_r_cheb ;
00273 solp_helmholtz_minus_2d[R_CHEBU >> TRA_R] = _solp_helmholtz_minus_2d_r_chebu ;
00274 }
00275
00276 Tbl res(solp_helmholtz_minus_2d[base_r] (*ope_cl, *non_dege,
00277 alpha, beta, so, dzpuis)) ;
00278
00279 Tbl valeurs (val_solp (res, alpha, base_r)) ;
00280 valeurs *= sqrt(double(2)) ;
00281
00282 sp_plus = valeurs(0) ;
00283 sp_minus = valeurs(1) ;
00284 dsp_plus = valeurs(2) ;
00285 dsp_minus = valeurs(3) ;
00286
00287
00288 return res ;
00289 }