00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 char des_vect_bin_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_vect_bin.C,v 1.4 2008/08/19 06:42:00 j_novak 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 #include <math.h>
00058
00059
00060 #include "tenseur.h"
00061 #include "graphique.h"
00062 #include "param.h"
00063 #include "utilitaires.h"
00064 #include "unites.h"
00065
00066
00067
00068 void des_vect_bin_x(const Tenseur& vv1, const Tenseur& vv2, double x0,
00069 double scale, double sizefl, double y_min, double y_max,
00070 double z_min, double z_max, const char* title,
00071 const Cmp* defsurf1, const Cmp* defsurf2,
00072 bool draw_bound, int ny, int nz) {
00073
00074 using namespace Unites ;
00075
00076 const Map& mp1 = *(vv1.get_mp()) ;
00077 const Map& mp2 = *(vv2.get_mp()) ;
00078
00079
00080
00081
00082 if (vv1.get_valence() != 1) {
00083 cout <<
00084 "des_vect_bin_x: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
00085 abort() ;
00086 }
00087
00088 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
00089 cout <<
00090 "des_vect_bin_x: the vector vv1 must be given in Cartesian components !"
00091 << endl ;
00092 abort() ;
00093 }
00094
00095 if (vv2.get_valence() != 1) {
00096 cout <<
00097 "des_vect_bin_x: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
00098 abort() ;
00099 }
00100
00101 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
00102 cout <<
00103 "des_vect_bin_x: the vector vv2 must be given in Cartesian components !"
00104 << endl ;
00105 abort() ;
00106 }
00107
00108 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
00109 cout <<
00110 "des_vect_bin_x: the components of the two vectors are not defined"
00111 << endl << "on the same triad !" << endl ;
00112 abort() ;
00113 }
00114
00115
00116
00117
00118
00119 float* vvy = new float[ny*nz] ;
00120 float* vvz = new float[ny*nz] ;
00121
00122 double hy = (y_max - y_min) / double(ny-1) ;
00123 double hza = (z_max - z_min) / double(nz-1) ;
00124
00125 for (int j=0; j<nz; j++) {
00126
00127 double z = z_min + hza * j ;
00128
00129 for (int i=0; i<ny; i++) {
00130
00131 double y = y_min + hy * i ;
00132
00133 double r, theta, phi ;
00134
00135 mp1.convert_absolute(x0, y, z, r, theta, phi) ;
00136 double vv1y = vv1(1).val_point(r, theta, phi) ;
00137 double vv1z = vv1(2).val_point(r, theta, phi) ;
00138
00139 mp2.convert_absolute(x0, y, z, r, theta, phi) ;
00140 double vv2y = vv2(1).val_point(r, theta, phi) ;
00141 double vv2z = vv2(2).val_point(r, theta, phi) ;
00142
00143 vvy[ny*j+i] = float(vv1y + vv2y) ;
00144 vvz[ny*j+i] = float(vv1z + vv2z) ;
00145
00146 }
00147 }
00148
00149 float ymin1 = float(y_min / km) ;
00150 float ymax1 = float(y_max / km) ;
00151 float zmin1 = float(z_min / km) ;
00152 float zmax1 = float(z_max / km) ;
00153
00154 const char* nomy = "y [km]" ;
00155 const char* nomz = "z [km]" ;
00156
00157 if (title == 0x0) {
00158 title = "" ;
00159 }
00160
00161 const char* device = 0x0 ;
00162 int newgraph = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
00163 1 : 3 ;
00164
00165 des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
00166 scale, sizefl, nomy, nomz, title, device, newgraph) ;
00167
00168 delete [] vvy ;
00169 delete [] vvz ;
00170
00171
00172
00173
00174 if (defsurf1 != 0x0) {
00175
00176 assert(defsurf1->get_mp() == vv1.get_mp()) ;
00177 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
00178 des_surface_x(*defsurf1, x0, device, newgraph) ;
00179 }
00180
00181 if (defsurf2 != 0x0) {
00182
00183 assert(defsurf2->get_mp() == vv2.get_mp()) ;
00184 newgraph = draw_bound ? 0 : 2 ;
00185 des_surface_x(*defsurf2, x0, device, newgraph) ;
00186 }
00187
00188
00189
00190
00191
00192 if (draw_bound) {
00193
00194 int ndom1 = mp1.get_mg()->get_nzone() ;
00195 int ndom2 = mp2.get_mg()->get_nzone() ;
00196
00197 for (int l=0; l<ndom1-1; l++) {
00198
00199 newgraph = 0 ;
00200 des_domaine_x(mp1, l, x0, device, newgraph) ;
00201 }
00202
00203 for (int l=0; l<ndom2-1; l++) {
00204
00205
00206 newgraph = (l == ndom2-2) ? 2 : 0 ;
00207
00208 des_domaine_x(mp2, l, x0, device, newgraph) ;
00209 }
00210
00211 }
00212 }
00213
00214
00215
00216
00217 void des_vect_bin_y(const Tenseur& vv1, const Tenseur& vv2, double y0,
00218 double scale, double sizefl, double x_min, double x_max,
00219 double z_min, double z_max, const char* title,
00220 const Cmp* defsurf1, const Cmp* defsurf2,
00221 bool draw_bound, int nx, int nz) {
00222
00223 using namespace Unites ;
00224
00225 const Map& mp1 = *(vv1.get_mp()) ;
00226 const Map& mp2 = *(vv2.get_mp()) ;
00227
00228
00229
00230
00231 if (vv1.get_valence() != 1) {
00232 cout <<
00233 "des_vect_bin_y: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
00234 abort() ;
00235 }
00236
00237 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
00238 cout <<
00239 "des_vect_bin_y: the vector vv1 must be given in Cartesian components !"
00240 << endl ;
00241 abort() ;
00242 }
00243
00244 if (vv2.get_valence() != 1) {
00245 cout <<
00246 "des_vect_bin_y: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
00247 abort() ;
00248 }
00249
00250 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
00251 cout <<
00252 "des_vect_bin_y: the vector vv2 must be given in Cartesian components !"
00253 << endl ;
00254 abort() ;
00255 }
00256
00257 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
00258 cout <<
00259 "des_vect_bin_y: the components of the two vectors are not defined"
00260 << endl << "on the same triad !" << endl ;
00261 abort() ;
00262 }
00263
00264
00265
00266
00267 float* vvx = new float[nx*nz] ;
00268 float* vvz = new float[nx*nz] ;
00269
00270 double hx = (x_max - x_min) / double(nx-1) ;
00271 double hza = (z_max - z_min) / double(nz-1) ;
00272
00273 for (int j=0; j<nz; j++) {
00274
00275 double z = z_min + hza * j ;
00276
00277 for (int i=0; i<nx; i++) {
00278
00279 double x = x_min + hx * i ;
00280
00281 double r, theta, phi ;
00282
00283 mp1.convert_absolute(x, y0, z, r, theta, phi) ;
00284 double vv1x = vv1(0).val_point(r, theta, phi) ;
00285 double vv1z = vv1(2).val_point(r, theta, phi) ;
00286
00287 mp2.convert_absolute(x, y0, z, r, theta, phi) ;
00288 double vv2x = vv2(0).val_point(r, theta, phi) ;
00289 double vv2z = vv2(2).val_point(r, theta, phi) ;
00290
00291 vvx[nx*j+i] = float(vv1x + vv2x) ;
00292 vvz[nx*j+i] = float(vv1z + vv2z) ;
00293 }
00294 }
00295
00296 float xmin1 = float(x_min / km) ;
00297 float xmax1 = float(x_max / km) ;
00298 float zmin1 = float(z_min / km) ;
00299 float zmax1 = float(z_max / km) ;
00300
00301 const char* nomx = "x [km]" ;
00302 const char* nomz = "z [km]" ;
00303
00304 if (title == 0x0) {
00305 title = "" ;
00306 }
00307
00308 const char* device = 0x0 ;
00309 int newgraph = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
00310 1 : 3 ;
00311
00312 des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
00313 scale, sizefl, nomx, nomz, title, device, newgraph) ;
00314
00315 delete [] vvx ;
00316 delete [] vvz ;
00317
00318
00319
00320
00321 if (defsurf1 != 0x0) {
00322
00323 assert(defsurf1->get_mp() == vv1.get_mp()) ;
00324 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
00325 des_surface_y(*defsurf1, y0, device, newgraph) ;
00326 }
00327
00328 if (defsurf2 != 0x0) {
00329
00330 assert(defsurf2->get_mp() == vv2.get_mp()) ;
00331 newgraph = draw_bound ? 0 : 2 ;
00332 des_surface_y(*defsurf2, y0, device, newgraph) ;
00333 }
00334
00335
00336
00337
00338
00339 if (draw_bound) {
00340
00341 int ndom1 = mp1.get_mg()->get_nzone() ;
00342 int ndom2 = mp2.get_mg()->get_nzone() ;
00343
00344 for (int l=0; l<ndom1-1; l++) {
00345
00346 newgraph = 0 ;
00347 des_domaine_y(mp1, l, y0, device, newgraph) ;
00348 }
00349
00350 for (int l=0; l<ndom2-1; l++) {
00351
00352
00353 newgraph = (l == ndom2-2) ? 2 : 0 ;
00354
00355 des_domaine_y(mp2, l, y0, device, newgraph) ;
00356 }
00357
00358 }
00359 }
00360
00361
00362
00363
00364 void des_vect_bin_z(const Tenseur& vv1, const Tenseur& vv2, double z0,
00365 double scale, double sizefl, double x_min, double x_max,
00366 double y_min, double y_max, const char* title,
00367 const Cmp* defsurf1, const Cmp* defsurf2,
00368 bool draw_bound, int nx, int ny) {
00369
00370 using namespace Unites ;
00371
00372 const Map& mp1 = *(vv1.get_mp()) ;
00373 const Map& mp2 = *(vv2.get_mp()) ;
00374
00375
00376
00377
00378 if (vv1.get_valence() != 1) {
00379 cout <<
00380 "des_vect_bin_z: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
00381 abort() ;
00382 }
00383
00384 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
00385 cout <<
00386 "des_vect_bin_z: the vector vv1 must be given in Cartesian components !"
00387 << endl ;
00388 abort() ;
00389 }
00390
00391 if (vv2.get_valence() != 1) {
00392 cout <<
00393 "des_vect_bin_z: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
00394 abort() ;
00395 }
00396
00397 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
00398 cout <<
00399 "des_vect_bin_z: the vector vv2 must be given in Cartesian components !"
00400 << endl ;
00401 abort() ;
00402 }
00403
00404 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
00405 cout <<
00406 "des_vect_bin_z: the components of the two vectors are not defined"
00407 << endl << "on the same triad !" << endl ;
00408 abort() ;
00409 }
00410
00411
00412
00413
00414 float* vvx = new float[nx*ny] ;
00415 float* vvy = new float[nx*ny] ;
00416
00417 double hx = (x_max - x_min) / double(nx-1) ;
00418 double hy = (y_max - y_min) / double(ny-1) ;
00419
00420 for (int j=0; j<ny; j++) {
00421
00422 double y = y_min + hy * j ;
00423
00424 for (int i=0; i<nx; i++) {
00425
00426 double x = x_min + hx * i ;
00427
00428 double r, theta, phi ;
00429
00430 mp1.convert_absolute(x, y, z0, r, theta, phi) ;
00431 double vv1x = vv1(0).val_point(r, theta, phi) ;
00432 double vv1y = vv1(1).val_point(r, theta, phi) ;
00433
00434 mp2.convert_absolute(x, y, z0, r, theta, phi) ;
00435 double vv2x = vv2(0).val_point(r, theta, phi) ;
00436 double vv2y = vv2(1).val_point(r, theta, phi) ;
00437
00438 vvx[nx*j+i] = float(vv1x + vv2x) ;
00439 vvy[nx*j+i] = float(vv1y + vv2y) ;
00440 }
00441 }
00442
00443 float xmin1 = float(x_min / km) ;
00444 float xmax1 = float(x_max / km) ;
00445 float ymin1 = float(y_min / km) ;
00446 float ymax1 = float(y_max / km) ;
00447
00448 const char* nomx = "x [km]" ;
00449 const char* nomy = "y [km]" ;
00450
00451 if (title == 0x0) {
00452 title = "" ;
00453 }
00454
00455 const char* device = 0x0 ;
00456 int newgraph = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
00457 1 : 3 ;
00458
00459 des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
00460 scale, sizefl, nomx, nomy, title, device, newgraph) ;
00461
00462 delete [] vvx ;
00463 delete [] vvy ;
00464
00465
00466
00467
00468 if (defsurf1 != 0x0) {
00469
00470 assert(defsurf1->get_mp() == vv1.get_mp()) ;
00471 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
00472 des_surface_z(*defsurf1, z0, device, newgraph) ;
00473 }
00474
00475 if (defsurf2 != 0x0) {
00476
00477 assert(defsurf2->get_mp() == vv2.get_mp()) ;
00478 newgraph = draw_bound ? 0 : 2 ;
00479 des_surface_z(*defsurf2, z0, device, newgraph) ;
00480 }
00481
00482
00483
00484
00485
00486 if (draw_bound) {
00487
00488 int ndom1 = mp1.get_mg()->get_nzone() ;
00489 int ndom2 = mp2.get_mg()->get_nzone() ;
00490
00491 for (int l=0; l<ndom1-1; l++) {
00492
00493 newgraph = 0 ;
00494 des_domaine_z(mp1, l, z0, device, newgraph) ;
00495 }
00496
00497 for (int l=0; l<ndom2-1; l++) {
00498
00499
00500 newgraph = (l == ndom2-2) ? 2 : 0 ;
00501
00502 des_domaine_z(mp2, l, z0, device, newgraph) ;
00503 }
00504
00505 }
00506 }