23char regularise_shift_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/regularise_shift.C,v 1.7 2014/10/13 08:52:41 j_novak Exp $" ;
90double regle (Tenseur& shift_auto,
const Tenseur& shift_comp,
double omega,
double omega_local) {
92 Tenseur shift_old (shift_auto) ;
94 double orientation = shift_auto.get_mp()->get_rot_phi() ;
95 assert ((orientation==0) || (orientation == M_PI)) ;
96 double orientation_autre = shift_comp.get_mp()->get_rot_phi() ;
97 assert ((orientation_autre==0) || (orientation_autre == M_PI)) ;
99 int alignes = (orientation == orientation_autre) ? 1 : -1 ;
102 if (*shift_comp.get_triad() == *shift_auto.get_triad())
105 int nz = shift_auto.get_mp()->get_mg()->get_nzone() ;
106 int np = shift_auto.get_mp()->get_mg()->get_np(1) ;
107 int nt = shift_auto.get_mp()->get_mg()->get_nt(1) ;
108 int nr = shift_auto.get_mp()->get_mg()->get_nr(1) ;
111 Tenseur shift_tot (*shift_auto.get_mp(), 1, CON, *shift_auto.get_triad()) ;
112 shift_tot.set_etat_qcq() ;
113 shift_tot.set(0).import_asymy (alignes*shift_comp(0)) ;
114 shift_tot.set(1).import_symy (alignes*shift_comp(1)) ;
115 shift_tot.set(2).import_asymy (shift_comp(2)) ;
117 shift_tot = shift_tot + shift_auto ;
119 double indic = (orientation == 0) ? 1 : -1 ;
121 Mtbl xa_mtbl (shift_tot.get_mp()->get_mg()) ;
122 xa_mtbl = shift_tot.get_mp()->xa ;
123 Mtbl ya_mtbl (shift_tot.get_mp()->get_mg()) ;
124 ya_mtbl = shift_tot.get_mp()->ya ;
126 Tenseur tbi (shift_tot) ;
128 for (
int i=0 ; i<3 ; i++) {
129 tbi.set(i).va.coef_i() ;
130 tbi.set(i).va.set_etat_c_qcq() ;
133 tbi.set(0) = *shift_tot(0).va.c - indic *omega * ya_mtbl(0,0,0,0) - indic*omega_local* shift_tot.get_mp()->y ;
134 tbi.set(1) = *shift_tot(1).va.c + indic *omega * xa_mtbl(0,0,0,0) + indic*omega_local* shift_tot.get_mp()->x ;
136 tbi.set(0).annule(nz-1) ;
137 tbi.set(1).annule(nz-1) ;
140 Tenseur derive_r (*shift_auto.get_mp(), 1, CON, *shift_auto.get_triad()) ;
141 derive_r.set_etat_qcq() ;
142 for (
int i=0 ; i<3 ; i++) {
143 if (tbi(i).get_etat() != ETATZERO)
144 derive_r.set(i) = tbi(i).dsdr() ;
146 derive_r.set(i).set_etat_zero() ;
151 Valeur val_hor (shift_auto.get_mp()->get_mg()) ;
152 Valeur fonction_radiale (shift_auto.get_mp()->get_mg()) ;
153 Cmp enleve (shift_auto.get_mp()) ;
156 for (
int comp=0 ; comp<3 ; comp++)
158 val_hor.annule_hard() ;
159 for (
int k=0 ; k<np ; k++)
160 for (
int j=0 ; j<nt ; j++)
161 for (
int i=0 ; i<nr ; i++)
162 val_hor.set(1, k, j, i) = derive_r(comp) (1, k, j, 0) ;
164 double r_0 = shift_auto.get_mp()->val_r (1, -1, 0, 0) ;
165 double r_1 = shift_auto.get_mp()->val_r (1, 1, 0, 0) ;
167 fonction_radiale =
pow(r_1-shift_auto.get_mp()->r, 3.)*
168 (shift_auto.get_mp()->r-r_0)/
pow(r_1-r_0, 3.) ;
169 fonction_radiale.
annule(0) ;
170 fonction_radiale.annule(2, nz-1) ;
172 enleve = fonction_radiale * val_hor ;
173 enleve.va.base = shift_auto(comp).va.base ;
175 if (
norme(enleve)(1) != 0)
176 shift_auto.set(comp) = shift_auto(comp) - enleve ;
177 if (
norme(shift_auto(comp))(1) > 1e-5) {
178 Tbl diff (
diffrelmax (shift_auto(comp), shift_old(comp))) ;
179 if (erreur < diff(1))
void annule(int l)
Sets the Cmp to zero in a given domain.
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Cmp pow(const Cmp &, int)
Power .
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).