00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 char bhole_kij_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_kij.C,v 1.4 2005/08/29 15:10:14 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 #include <stdlib.h>
00070 #include <math.h>
00071
00072
00073 #include "nbr_spx.h"
00074 #include "tenseur.h"
00075 #include "bhole.h"
00076 #include "proto.h"
00077 #include "utilitaires.h"
00078 #include "graphique.h"
00079
00080
00081 void Bhole_binaire::fait_tkij () {
00082
00083 hole1.tkij_tot.set_etat_qcq() ;
00084 hole2.tkij_tot.set_etat_qcq() ;
00085
00086
00087
00088 hole1.fait_taij_auto () ;
00089 hole2.fait_taij_auto () ;
00090
00091
00092 hole1.taij_comp.set_etat_qcq() ;
00093 hole2.taij_comp.set_etat_qcq() ;
00094
00095 Tenseur sans_dz_un (hole1.taij_auto) ;
00096 sans_dz_un.dec2_dzpuis() ;
00097 Tenseur sans_dz_deux (hole2.taij_auto) ;
00098 sans_dz_deux.dec2_dzpuis() ;
00099
00100
00101
00102 double orientation_un = hole1.taij_auto.get_mp()->get_rot_phi() ;
00103 assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00104 double orientation_deux = hole2.taij_auto.get_mp()->get_rot_phi() ;
00105 assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00106 int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00107
00108
00109 if (hole2.taij_auto.get_etat() == ETATZERO)
00110 hole1.taij_comp.set_etat_zero() ;
00111 else {
00112 hole1.taij_comp.set(0, 0).import_asymy(sans_dz_deux(0, 0)) ;
00113 hole1.taij_comp.set(0, 1).import_symy(sans_dz_deux(0, 1)) ;
00114 hole1.taij_comp.set(0, 2).import_asymy(same_orient*sans_dz_deux(0, 2)) ;
00115 hole1.taij_comp.set(1, 1).import_asymy(sans_dz_deux(1, 1)) ;
00116 hole1.taij_comp.set(1, 2).import_symy(same_orient*sans_dz_deux(1, 2)) ;
00117 hole1.taij_comp.set(2, 2).import_asymy(sans_dz_deux(2, 2)) ;
00118 }
00119
00120 if (hole1.taij_auto.get_etat() == ETATZERO)
00121 hole2.taij_comp.set_etat_zero() ;
00122 else {
00123 hole2.taij_comp.set(0, 0).import_asymy(sans_dz_un(0, 0)) ;
00124 hole2.taij_comp.set(0, 1).import_symy(sans_dz_un(0, 1)) ;
00125 hole2.taij_comp.set(0, 2).import_asymy(same_orient*sans_dz_un(0, 2)) ;
00126 hole2.taij_comp.set(1, 1).import_asymy(sans_dz_un(1, 1)) ;
00127 hole2.taij_comp.set(1, 2).import_symy(same_orient*sans_dz_un(1, 2)) ;
00128 hole2.taij_comp.set(2, 2).import_asymy(sans_dz_un(2, 2)) ;
00129 }
00130
00131 hole1.taij_comp.set_std_base() ;
00132 hole2.taij_comp.set_std_base() ;
00133 hole1.taij_comp.inc2_dzpuis() ;
00134 hole2.taij_comp.inc2_dzpuis() ;
00135
00136
00137 hole1.taij_tot = hole1.taij_auto + hole1.taij_comp ;
00138 hole2.taij_tot = hole2.taij_auto + hole2.taij_comp ;
00139
00140 if ((hole1.taij_tot.get_etat() == ETATZERO) &&
00141 (hole2.taij_tot.get_etat() == ETATZERO)) {
00142
00143 hole1.tkij_tot.set_etat_zero() ;
00144 hole1.tkij_auto.set_etat_zero() ;
00145 hole2.tkij_tot.set_etat_zero() ;
00146 hole2.tkij_auto.set_etat_zero() ;
00147 }
00148 else {
00149 int nz_un = hole1.mp.get_mg()->get_nzone() ;
00150 int nz_deux = hole2.mp.get_mg()->get_nzone() ;
00151
00152 Cmp ntot_un (hole1.n_tot()) ;
00153 ntot_un = division_xpun (ntot_un, 0) ;
00154 ntot_un.raccord(1) ;
00155
00156 Cmp ntot_deux (hole2.n_tot()) ;
00157 ntot_deux = division_xpun (ntot_deux, 0) ;
00158 ntot_deux.raccord(1) ;
00159
00160
00161 for (int lig = 0 ; lig<3 ; lig++)
00162 for (int col = lig ; col<3 ; col++) {
00163
00164
00165 int ind = 1 ;
00166 if (lig !=2)
00167 ind *= -1 ;
00168 if (col != 2)
00169 ind *= -1 ;
00170 if (same_orient == 1)
00171 ind = 1 ;
00172
00173
00174 Cmp auxi_un (hole1.taij_tot(lig, col)/2.) ;
00175 auxi_un.dec2_dzpuis() ;
00176 auxi_un = division_xpun (auxi_un, 0) ;
00177 auxi_un = auxi_un / ntot_un ;
00178 auxi_un.raccord(1) ;
00179
00180
00181 Cmp auxi_deux (hole2.taij_tot(lig, col)/2.) ;
00182 auxi_deux.dec2_dzpuis() ;
00183 auxi_deux = division_xpun (auxi_deux, 0) ;
00184 auxi_deux = auxi_deux / ntot_deux ;
00185 auxi_deux.raccord(1) ;
00186
00187
00188 Cmp copie_un (hole1.taij_tot(lig, col)) ;
00189 copie_un.dec2_dzpuis() ;
00190
00191 Cmp copie_deux (hole2.taij_tot(lig, col)) ;
00192 copie_deux.dec2_dzpuis() ;
00193
00194
00195 double lim_un = hole1.mp.get_alpha()[1] + hole1.mp.get_beta()[1] ;
00196 double lim_deux = hole2.mp.get_alpha()[1] + hole2.mp.get_beta()[1] ;
00197
00198 Mtbl xabs_un (hole1.mp.xa) ;
00199 Mtbl yabs_un (hole1.mp.ya) ;
00200 Mtbl zabs_un (hole1.mp.za) ;
00201
00202 Mtbl xabs_deux (hole2.mp.xa) ;
00203 Mtbl yabs_deux (hole2.mp.ya) ;
00204 Mtbl zabs_deux (hole2.mp.za) ;
00205
00206 double xabs, yabs, zabs, air, theta, phi ;
00207
00208
00209 for (int l=2 ; l<nz_un ; l++) {
00210
00211 int nr = hole1.mp.get_mg()->get_nr (l) ;
00212
00213 if (l==nz_un-1)
00214 nr -- ;
00215
00216 int np = hole1.mp.get_mg()->get_np (l) ;
00217 int nt = hole1.mp.get_mg()->get_nt (l) ;
00218
00219 for (int k=0 ; k<np ; k++)
00220 for (int j=0 ; j<nt ; j++)
00221 for (int i=0 ; i<nr ; i++) {
00222
00223 xabs = xabs_un (l, k, j, i) ;
00224 yabs = yabs_un (l, k, j, i) ;
00225 zabs = zabs_un (l, k, j, i) ;
00226
00227
00228 hole2.mp.convert_absolute
00229 (xabs, yabs, zabs, air, theta, phi) ;
00230
00231 if (air >= lim_deux)
00232
00233 auxi_un.set(l, k, j, i) =
00234 copie_un(l, k, j, i) / ntot_un (l, k, j, i)/2. ;
00235 else
00236
00237 auxi_un.set(l, k, j, i) =
00238 ind * auxi_deux.val_point (air, theta, phi) ;
00239 }
00240
00241
00242 if (l==nz_un-1)
00243 for (int k=0 ; k<np ; k++)
00244 for (int j=0 ; j<nt ; j++)
00245 auxi_un.set(nz_un-1, k, j, nr-1) = 0 ;
00246 }
00247
00248
00249 for (int l=2 ; l<nz_deux ; l++) {
00250
00251 int nr = hole2.mp.get_mg()->get_nr (l) ;
00252
00253 if (l==nz_deux-1)
00254 nr -- ;
00255
00256 int np = hole2.mp.get_mg()->get_np (l) ;
00257 int nt = hole2.mp.get_mg()->get_nt (l) ;
00258
00259 for (int k=0 ; k<np ; k++)
00260 for (int j=0 ; j<nt ; j++)
00261 for (int i=0 ; i<nr ; i++) {
00262
00263 xabs = xabs_deux (l, k, j, i) ;
00264 yabs = yabs_deux (l, k, j, i) ;
00265 zabs = zabs_deux (l, k, j, i) ;
00266
00267
00268 hole1.mp.convert_absolute
00269 (xabs, yabs, zabs, air, theta, phi) ;
00270
00271 if (air >= lim_un)
00272
00273 auxi_deux.set(l, k, j, i) =
00274 copie_deux(l, k, j, i) / ntot_deux (l, k, j, i) /2.;
00275 else
00276
00277 auxi_deux.set(l, k, j, i) =
00278 ind * auxi_un.val_point (air, theta, phi) ;
00279 }
00280
00281 if (l==nz_deux-1)
00282 for (int k=0 ; k<np ; k++)
00283 for (int j=0 ; j<nt ; j++)
00284 auxi_deux.set(nz_deux-1, k, j, nr-1) = 0 ;
00285 }
00286
00287 auxi_un.inc2_dzpuis() ;
00288 auxi_deux.inc2_dzpuis() ;
00289
00290 hole1.tkij_tot.set(lig, col) = auxi_un ;
00291 hole2.tkij_tot.set(lig, col) = auxi_deux ;
00292 }
00293
00294 hole1.tkij_auto.set_etat_qcq() ;
00295 hole2.tkij_auto.set_etat_qcq() ;
00296
00297 for (int lig=0 ; lig<3 ; lig++)
00298 for (int col=lig ; col<3 ; col++) {
00299 hole1.tkij_auto.set(lig, col) = hole1.tkij_tot(lig, col)*
00300 hole1.decouple ;
00301 hole2.tkij_auto.set(lig, col) = hole2.tkij_tot(lig, col)*
00302 hole2.decouple ;
00303 }
00304 }
00305 }
00306
00307 void Bhole_binaire::fait_decouple () {
00308
00309 int nz_un = hole1.mp.get_mg()->get_nzone() ;
00310 int nz_deux = hole2.mp.get_mg()->get_nzone() ;
00311
00312
00313 double distance = hole1.mp.get_ori_x() - hole2.mp.get_ori_x() ;
00314 double lim_un = distance/2. ;
00315 double lim_deux = distance/2. ;
00316 double int_un = distance/6. ;
00317 double int_deux = distance/6. ;
00318
00319
00320 Cmp fonction_f_un (hole1.mp) ;
00321 fonction_f_un = 0.5*pow(
00322 cos((hole1.mp.r-int_un)*M_PI/2./(lim_un-int_un)), 2.)+0.5 ;
00323 fonction_f_un.std_base_scal();
00324
00325 Cmp fonction_g_un (hole1.mp) ;
00326 fonction_g_un = 0.5*pow
00327 (sin((hole1.mp.r-int_un)*M_PI/2./(lim_un-int_un)), 2.) ;
00328 fonction_g_un.std_base_scal();
00329
00330 Cmp fonction_f_deux (hole2.mp) ;
00331 fonction_f_deux = 0.5*pow(
00332 cos((hole2.mp.r-int_deux)*M_PI/2./(lim_deux-int_deux)), 2.)+0.5 ;
00333 fonction_f_deux.std_base_scal();
00334
00335 Cmp fonction_g_deux (hole2.mp) ;
00336 fonction_g_deux = 0.5*pow(
00337 sin((hole2.mp.r-int_deux)*M_PI/2./(lim_un-int_deux)), 2.) ;
00338 fonction_g_deux.std_base_scal();
00339
00340
00341 Cmp decouple_un (hole1.mp) ;
00342 decouple_un.allocate_all() ;
00343 Cmp decouple_deux (hole2.mp) ;
00344 decouple_deux.allocate_all() ;
00345
00346 Mtbl xabs_un (hole1.mp.xa) ;
00347 Mtbl yabs_un (hole1.mp.ya) ;
00348 Mtbl zabs_un (hole1.mp.za) ;
00349
00350 Mtbl xabs_deux (hole2.mp.xa) ;
00351 Mtbl yabs_deux (hole2.mp.ya) ;
00352 Mtbl zabs_deux (hole2.mp.za) ;
00353
00354 double xabs, yabs, zabs, air_un, air_deux, theta, phi ;
00355
00356
00357 for (int l=0 ; l<nz_un ; l++) {
00358 int nr = hole1.mp.get_mg()->get_nr (l) ;
00359
00360 if (l==nz_un-1)
00361 nr -- ;
00362
00363 int np = hole1.mp.get_mg()->get_np (l) ;
00364 int nt = hole1.mp.get_mg()->get_nt (l) ;
00365
00366 for (int k=0 ; k<np ; k++)
00367 for (int j=0 ; j<nt ; j++)
00368 for (int i=0 ; i<nr ; i++) {
00369
00370 xabs = xabs_un (l, k, j, i) ;
00371 yabs = yabs_un (l, k, j, i) ;
00372 zabs = zabs_un (l, k, j, i) ;
00373
00374
00375 hole1.mp.convert_absolute
00376 (xabs, yabs, zabs, air_un, theta, phi) ;
00377 hole2.mp.convert_absolute
00378 (xabs, yabs, zabs, air_deux, theta, phi) ;
00379
00380 if (air_un <= lim_un)
00381 if (air_un < int_un)
00382 decouple_un.set(l, k, j, i) = 1 ;
00383 else
00384
00385 decouple_un.set(l, k, j, i) =
00386 fonction_f_un (l, k, j, i) ;
00387 else
00388 if (air_deux <= lim_deux)
00389 if (air_deux < int_deux)
00390 decouple_un.set(l, k, j, i) = 0 ;
00391 else
00392
00393 decouple_un.set(l, k, j, i) =
00394 fonction_g_deux.val_point (air_deux, theta, phi) ;
00395
00396 else
00397
00398 decouple_un.set(l, k, j, i) = 0.5 ;
00399 }
00400
00401
00402 if (l==nz_un-1)
00403 for (int k=0 ; k<np ; k++)
00404 for (int j=0 ; j<nt ; j++)
00405 decouple_un.set(nz_un-1, k, j, nr) = 0.5 ;
00406 }
00407
00408 for (int l=0 ; l<nz_deux ; l++) {
00409
00410 int nr = hole2.mp.get_mg()->get_nr (l) ;
00411
00412 if (l==nz_deux-1)
00413 nr -- ;
00414
00415 int np = hole2.mp.get_mg()->get_np (l) ;
00416 int nt = hole2.mp.get_mg()->get_nt (l) ;
00417
00418 for (int k=0 ; k<np ; k++)
00419 for (int j=0 ; j<nt ; j++)
00420 for (int i=0 ; i<nr ; i++) {
00421
00422 xabs = xabs_deux (l, k, j, i) ;
00423 yabs = yabs_deux (l, k, j, i) ;
00424 zabs = zabs_deux (l, k, j, i) ;
00425
00426
00427 hole1.mp.convert_absolute
00428 (xabs, yabs, zabs, air_un, theta, phi) ;
00429 hole2.mp.convert_absolute
00430 (xabs, yabs, zabs, air_deux, theta, phi) ;
00431
00432 if (air_deux <= lim_deux)
00433 if (air_deux < int_deux)
00434 decouple_deux.set(l, k, j, i) = 1 ;
00435 else
00436
00437 decouple_deux.set(l, k, j, i) =
00438 fonction_f_deux (l, k, j, i) ;
00439 else
00440 if (air_un <= lim_un)
00441 if (air_un < int_un)
00442 decouple_deux.set(l, k, j, i) = 0 ;
00443 else
00444
00445 decouple_deux.set(l, k, j, i) =
00446 fonction_g_un.val_point (air_un, theta, phi) ;
00447
00448 else
00449
00450 decouple_deux.set(l, k, j, i) = 0.5 ;
00451 }
00452
00453
00454 if (l==nz_deux-1)
00455 for (int k=0 ; k<np ; k++)
00456 for (int j=0 ; j<nt ; j++)
00457 decouple_deux.set(nz_deux-1, k, j, nr) = 0.5 ;
00458 }
00459
00460 hole1.decouple = decouple_un ;
00461 hole2.decouple = decouple_deux ;
00462 }