00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 char regularise_shift_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/regularise_shift.C,v 1.5 2006/04/27 09:12:32 p_grandclement Exp $" ;
00024
00025
00026
00027
00028
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 #include <stdlib.h>
00077 #include <math.h>
00078
00079
00080 #include "nbr_spx.h"
00081 #include "tenseur.h"
00082
00083 double regle (Tenseur& shift_auto, const Tenseur& shift_comp, double omega, double omega_local) {
00084
00085 Tenseur shift_old (shift_auto) ;
00086
00087 double orientation = shift_auto.get_mp()->get_rot_phi() ;
00088 assert ((orientation==0) || (orientation == M_PI)) ;
00089 double orientation_autre = shift_comp.get_mp()->get_rot_phi() ;
00090 assert ((orientation_autre==0) || (orientation_autre == M_PI)) ;
00091
00092 int alignes = (orientation == orientation_autre) ? 1 : -1 ;
00093
00094
00095 if (*shift_comp.get_triad() == *shift_auto.get_triad())
00096 alignes = 1 ;
00097
00098 int nz = shift_auto.get_mp()->get_mg()->get_nzone() ;
00099 int np = shift_auto.get_mp()->get_mg()->get_np(1) ;
00100 int nt = shift_auto.get_mp()->get_mg()->get_nt(1) ;
00101 int nr = shift_auto.get_mp()->get_mg()->get_nr(1) ;
00102
00103
00104 Tenseur shift_tot (*shift_auto.get_mp(), 1, CON, *shift_auto.get_triad()) ;
00105 shift_tot.set_etat_qcq() ;
00106 shift_tot.set(0).import_asymy (alignes*shift_comp(0)) ;
00107 shift_tot.set(1).import_symy (alignes*shift_comp(1)) ;
00108 shift_tot.set(2).import_asymy (shift_comp(2)) ;
00109
00110 shift_tot = shift_tot + shift_auto ;
00111
00112 double indic = (orientation == 0) ? 1 : -1 ;
00113
00114 Mtbl xa_mtbl (shift_tot.get_mp()->get_mg()) ;
00115 xa_mtbl = shift_tot.get_mp()->xa ;
00116 Mtbl ya_mtbl (shift_tot.get_mp()->get_mg()) ;
00117 ya_mtbl = shift_tot.get_mp()->ya ;
00118
00119 Tenseur tbi (shift_tot) ;
00120 if (omega != 0) {
00121 for (int i=0 ; i<3 ; i++) {
00122 tbi.set(i).va.coef_i() ;
00123 tbi.set(i).va.set_etat_c_qcq() ;
00124 }
00125
00126 tbi.set(0) = *shift_tot(0).va.c - indic *omega * ya_mtbl(0,0,0,0) - indic*omega_local* shift_tot.get_mp()->y ;
00127 tbi.set(1) = *shift_tot(1).va.c + indic *omega * xa_mtbl(0,0,0,0) + indic*omega_local* shift_tot.get_mp()->x ;
00128 tbi.set_std_base() ;
00129 tbi.set(0).annule(nz-1) ;
00130 tbi.set(1).annule(nz-1) ;
00131 }
00132
00133 Tenseur derive_r (*shift_auto.get_mp(), 1, CON, *shift_auto.get_triad()) ;
00134 derive_r.set_etat_qcq() ;
00135 for (int i=0 ; i<3 ; i++) {
00136 if (tbi(i).get_etat() != ETATZERO)
00137 derive_r.set(i) = tbi(i).dsdr() ;
00138 else
00139 derive_r.set(i).set_etat_zero() ;
00140 }
00141
00142
00143
00144 Valeur val_hor (shift_auto.get_mp()->get_mg()) ;
00145 Valeur fonction_radiale (shift_auto.get_mp()->get_mg()) ;
00146 Cmp enleve (shift_auto.get_mp()) ;
00147
00148 double erreur = 0 ;
00149 for (int comp=0 ; comp<3 ; comp++)
00150 {
00151 val_hor.annule_hard() ;
00152 for (int k=0 ; k<np ; k++)
00153 for (int j=0 ; j<nt ; j++)
00154 for (int i=0 ; i<nr ; i++)
00155 val_hor.set(1, k, j, i) = derive_r(comp) (1, k, j, 0) ;
00156
00157 double r_0 = shift_auto.get_mp()->val_r (1, -1, 0, 0) ;
00158 double r_1 = shift_auto.get_mp()->val_r (1, 1, 0, 0) ;
00159
00160 fonction_radiale = pow(r_1-shift_auto.get_mp()->r, 3.)*
00161 (shift_auto.get_mp()->r-r_0)/pow(r_1-r_0, 3.) ;
00162 fonction_radiale.annule(0) ;
00163 fonction_radiale.annule(2, nz-1) ;
00164
00165 enleve = fonction_radiale * val_hor ;
00166 enleve.va.base = shift_auto(comp).va.base ;
00167
00168 if (norme(enleve)(1) != 0)
00169 shift_auto.set(comp) = shift_auto(comp) - enleve ;
00170 if (norme(shift_auto(comp))(1) > 1e-5) {
00171 Tbl diff (diffrelmax (shift_auto(comp), shift_old(comp))) ;
00172 if (erreur < diff(1))
00173 erreur = diff(1) ;
00174 }
00175 }
00176 return erreur ;
00177 }