00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 char sym_tensor_decomp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/sym_tensor_decomp.C,v 1.13 2008/12/05 08:45:12 j_novak Exp $" ;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 #include "metric.h"
00082 #include "param.h"
00083
00084 void Sym_tensor::set_longit_trans(const Vector& v_pot,
00085 const Sym_tensor_trans& ht ) {
00086
00087 assert ( v_pot.get_index_type(0) == CON ) ;
00088
00089 const Metric& metre = ht.get_met_div() ;
00090
00091 *this = ht + v_pot.ope_killing(metre) ;
00092 if ((*this)(1,1).get_dzpuis() == 2)
00093 dec_dzpuis(2) ;
00094
00095 del_deriv() ;
00096
00097 set_dependance(metre) ;
00098 int jp = get_place_met(metre) ;
00099 assert ((jp>=0) && (jp<N_MET_MAX)) ;
00100
00101 p_transverse[jp] = new Sym_tensor_trans(ht) ;
00102 p_longit_pot[jp] = new Vector( v_pot ) ;
00103
00104 }
00105
00106 const Sym_tensor_trans& Sym_tensor::transverse(const Metric& metre, Param* par,
00107 int method_poisson) const {
00108
00109 set_dependance(metre) ;
00110 int jp = get_place_met(metre) ;
00111 assert ((jp>=0) && (jp<N_MET_MAX)) ;
00112
00113 if (p_transverse[jp] == 0x0) {
00114
00115 assert( (type_indice(0) == CON) && (type_indice(1) == CON) ) ;
00116
00117 for (int ic=0; ic<n_comp; ic++) {
00118 assert(cmp[ic]->check_dzpuis(4)) ;
00119 }
00120
00121 const Vector& ww = longit_pot(metre, par, method_poisson) ;
00122
00123 Sym_tensor lww = ww.ope_killing(metre) ;
00124
00125 lww.inc_dzpuis(2) ;
00126
00127 p_transverse[jp] = new Sym_tensor_trans(*mp, *triad, metre) ;
00128
00129 *(p_transverse[jp]) = *this - lww ;
00130
00131 }
00132
00133 return *p_transverse[jp] ;
00134
00135
00136 }
00137
00138
00139 const Vector& Sym_tensor::longit_pot(const Metric& metre, Param* par,
00140 int method_poisson) const {
00141
00142 set_dependance(metre) ;
00143 int jp = get_place_met(metre) ;
00144 assert ((jp>=0) && (jp<N_MET_MAX)) ;
00145
00146 if (p_longit_pot[jp] == 0x0) {
00147
00148 const Metric_flat* metf = dynamic_cast<const Metric_flat*>(&metre) ;
00149 if (metf == 0x0) {
00150 cout << "Sym_tensor::longit_pot : the case of a non flat metric"
00151 << endl <<" is not treated yet !" << endl ;
00152 abort() ;
00153 }
00154
00155 Vector hhh = divergence(metre) ;
00156
00157
00158
00159 bool dzp5 = false ;
00160 for (int i=1; i<=3; i++) {
00161 dzp5 = dzp5 || hhh(i).check_dzpuis(5) ;
00162 }
00163 if (dzp5) hhh.dec_dzpuis() ;
00164
00165 if (dynamic_cast<const Map_af*>(mp) != 0x0)
00166 p_longit_pot[jp] = new Vector( hhh.poisson(double(1),
00167 method_poisson) ) ;
00168 else
00169 p_longit_pot[jp] = new Vector( hhh.poisson(double(1), *par,
00170 method_poisson) ) ;
00171
00172
00173
00174 const Vector& ww = *(p_longit_pot[jp]) ;
00175
00176 hhh.dec_dzpuis() ;
00177
00178 Vector lapw = ww.derive_con(metre).divergence(metre)
00179 + (ww.divergence(metre)).derive_con(metre) ;
00180 #ifndef NDEBUG
00181 cout << "## Sym_tensor::longit_pot : test of Poisson : \n" ;
00182 cout <<
00183 " Max absolute error in each domain on the vector Poisson equation:\n" ;
00184 maxabs(lapw - hhh) ;
00185
00186 int nz = mp->get_mg()->get_nzone() ;
00187
00188 cout << " Relative error in each domain on the vector Poisson equation:\n" ;
00189 for (int i=1; i<=3; i++){
00190 cout << " Comp. " << i << " : " ;
00191 for (int l=0; l<nz; l++){
00192 cout << diffrel(lapw(i),hhh(i) )(l) << " " ;
00193 }
00194 cout << endl ;
00195 }
00196 cout << endl ;
00197 #endif
00198 }
00199
00200 return *p_longit_pot[jp] ;
00201
00202
00203 }
00204
00205