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