00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 char ope_vorton_solp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_vorton/ope_vorton_solp.C,v 1.2 2007/04/24 15:52:55 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_vorton_pas_prevu (const Tbl &so, int) {
00039
00040 cout << "Linear combination for vorton not implemented..." << endl ;
00041 abort() ;
00042 exit(-1) ;
00043 return so;
00044 }
00045
00046
00047
00048
00049 Tbl _cl_vorton_r_cheb (const Tbl& source, int) {
00050
00051 int n = source.get_dim(0) ;
00052
00053 Tbl barre(source) ;
00054 int dirac = 1 ;
00055 for (int i=0 ; i<n-2 ; i++) {
00056 barre.set(i) = ((1+dirac)*source(i)-source(i+2))
00057 /(i+1) ;
00058 if (i==0) dirac = 0 ;
00059 }
00060
00061 Tbl res(barre) ;
00062 for (int i=0 ; i<n-4 ; i++)
00063 res.set(i) = barre(i)-barre(i+2) ;
00064
00065 return res ;
00066 }
00067
00068
00069
00070
00071
00072 Tbl _cl_vorton_r_chebu_trois (const Tbl &source) {
00073 int n = source.get_dim(0) ;
00074 Tbl barre(source) ;
00075 int dirac = 1 ;
00076 for (int i=0 ; i<n-2 ; i++) {
00077 barre.set(i) = ((1+dirac)*source(i)-source(i+2)) ;
00078 if (i==0) dirac = 0 ;
00079 }
00080
00081 Tbl tilde(barre) ;
00082 for (int i=0 ; i<n-4 ; i++)
00083 tilde.set(i) = (barre(i)-barre(i+2)) ;
00084
00085 Tbl res(tilde) ;
00086 for (int i=0 ; i<n-4 ; i++)
00087 res.set(i) = (tilde(i)+tilde(i+1)) ;
00088 return res ;
00089 }
00090
00091 Tbl _cl_vorton_r_chebu (const Tbl& source, int puis) {
00092 int n = source.get_dim(0) ;
00093 Tbl res (n) ;
00094 res.set_etat_qcq() ;
00095
00096 switch (puis) {
00097 case 3 :
00098 res = _cl_vorton_r_chebu_trois(source) ;
00099 break ;
00100 default :
00101 abort() ;
00102 exit(-1) ;
00103 }
00104 return res ;
00105 }
00106
00107
00108
00109
00110
00111 Tbl cl_vorton (const Tbl &source, int puis, int base_r) {
00112
00113
00114 static Tbl (*cl_vorton[MAX_BASE])(const Tbl &, int) ;
00115 static int nap = 0 ;
00116
00117
00118 if (nap==0) {
00119 nap = 1 ;
00120 for (int i=0 ; i<MAX_BASE ; i++) {
00121 cl_vorton[i] = _cl_vorton_pas_prevu ;
00122 }
00123
00124 cl_vorton[R_CHEB >> TRA_R] = _cl_vorton_r_cheb ;
00125 cl_vorton[R_CHEBU >> TRA_R] = _cl_vorton_r_chebu ;
00126 }
00127
00128 Tbl res(cl_vorton[base_r](source, puis)) ;
00129 return res ;
00130 }
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 Tbl _solp_vorton_pas_prevu (const Matrice &, const Matrice &,
00141 const Tbl &, double, double, int) {
00142 cout << " Solution particuliere pas prevue in sec_order..... : "<< endl ;
00143 abort() ;
00144 exit(-1) ;
00145 Tbl res(1) ;
00146 return res;
00147 }
00148
00149
00150
00151
00152 Tbl _solp_vorton_r_chebu_trois (const Matrice &lap, const Matrice &nondege,
00153 const Tbl &source, double alpha) {
00154
00155 int n = lap.get_dim(0) ;
00156 int dege = n-nondege.get_dim(0) ;;
00157 assert ((dege==2) || (dege==1)) ;
00158
00159 Tbl source_aux (alpha*cl_vorton (source, 3, R_CHEBU)) ;
00160
00161 Tbl so(n-dege) ;
00162 so.set_etat_qcq() ;
00163 for (int i=0 ; i<n-dege ; i++)
00164 so.set(i) = source_aux(i) ;
00165
00166 Tbl auxi(nondege.inverse(so)) ;
00167
00168 Tbl res(n) ;
00169 res.set_etat_qcq() ;
00170 for (int i=dege ; i<n ; i++)
00171 res.set(i) = auxi(i-dege) ;
00172
00173 for (int i=0 ; i<dege ; i++)
00174 res.set(i) = 0 ;
00175
00176 if (dege==2) {
00177 double somme = 0 ;
00178 for (int i=0 ; i<n ; i++)
00179 somme -= res(i) ;
00180 res.set(0) = somme ;
00181 }
00182
00183 return res ;
00184 }
00185
00186
00187 Tbl _solp_vorton_r_chebu (const Matrice &lap, const Matrice &nondege,
00188 const Tbl &source,double alpha, double, int puis) {
00189 int n = source.get_dim(0) ;
00190 Tbl res (n) ;
00191 res.set_etat_qcq() ;
00192
00193 switch (puis) {
00194 case 3 :
00195 res = _solp_vorton_r_chebu_trois(lap, nondege, source, alpha) ;
00196 break ;
00197 default :
00198 abort() ;
00199 exit(-1) ;
00200 }
00201 return res ;
00202 }
00203
00204
00205
00206
00207
00208 Tbl _solp_vorton_r_cheb (const Matrice &lap, const Matrice &nondege,
00209 const Tbl &source,double alpha, double beta, int dz) {
00210
00211 int n = lap.get_dim(0) ;
00212 int dege = n-nondege.get_dim(0) ;
00213 assert (dege ==2) ;
00214
00215 Tbl source_aux(source*alpha*alpha) ;
00216 Tbl xso(source_aux) ;
00217 Tbl xxso(source_aux) ;
00218 multx_1d(n, &xso.t, R_CHEB) ;
00219 multx_1d(n, &xxso.t, R_CHEB) ;
00220 multx_1d(n, &xxso.t, R_CHEB) ;
00221 source_aux = beta*beta/alpha/alpha*source_aux+2*beta/alpha*xso+xxso ;
00222 source_aux = cl_vorton (source_aux, dz, R_CHEB) ;
00223
00224 Tbl so(n-dege) ;
00225 so.set_etat_qcq() ;
00226 for (int i=0 ; i<n-dege ; i++)
00227 so.set(i) = source_aux(i) ;
00228
00229 Tbl auxi(nondege.inverse(so)) ;
00230
00231 Tbl res(n) ;
00232 res.set_etat_qcq() ;
00233 for (int i=dege ; i<n ; i++)
00234 res.set(i) = auxi(i-dege) ;
00235
00236 for (int i=0 ; i<dege ; i++)
00237 res.set(i) = 0 ;
00238 return res ;
00239 }
00240
00241
00242
00243 Tbl Ope_vorton::get_solp (const Tbl& so) const {
00244
00245 if (non_dege == 0x0)
00246 do_non_dege() ;
00247
00248
00249 static Tbl (*solp_vorton[MAX_BASE]) (const Matrice&, const Matrice&,
00250 const Tbl&, double, double, int) ;
00251 static int nap = 0 ;
00252
00253
00254 if (nap==0) {
00255 nap = 1 ;
00256 for (int i=0 ; i<MAX_BASE ; i++) {
00257 solp_vorton[i] = _solp_vorton_pas_prevu ;
00258 }
00259
00260 solp_vorton[R_CHEB >> TRA_R] = _solp_vorton_r_cheb ;
00261 solp_vorton[R_CHEBU >> TRA_R] = _solp_vorton_r_chebu ;
00262 }
00263
00264 Tbl res(solp_vorton[base_r] (*ope_mat, *non_dege, so, alpha, beta, dzpuis)) ;
00265 Tbl valeurs (val_solp (res, alpha, base_r)) ;
00266
00267 sp_plus = valeurs(0) ;
00268 sp_minus = valeurs(1) ;
00269 dsp_plus = valeurs(2) ;
00270 dsp_minus = valeurs(3) ;
00271
00272 return res ;
00273 }