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_scalar_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_scalar.C,v 1.2 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 #include <math.h>
00042
00043
00044 #include "scalar.h"
00045 #include "graphique.h"
00046 #include "param.h"
00047 #include "utilitaires.h"
00048 #include "unites.h"
00049
00050
00051 void des_coupe_x(const Scalar& uu, double x0, int nzdes, const char* title,
00052 const Scalar* defsurf, double zoom, bool draw_bound,
00053 int ncour, int ny, int nz) {
00054
00055 const Map& mp = uu.get_mp() ;
00056
00057 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
00058 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
00059 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
00060 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
00061
00062 ray = ( a1 > ray ) ? a1 : ray ;
00063 ray = ( a2 > ray ) ? a2 : ray ;
00064 ray = ( a3 > ray ) ? a3 : ray ;
00065
00066 ray *= zoom ;
00067
00068 double y_min = mp.get_ori_y() - ray ;
00069 double y_max = mp.get_ori_y() + ray ;
00070 double z_min = mp.get_ori_z() - ray ;
00071 double z_max = mp.get_ori_z() + ray ;
00072
00073 des_coupe_x(uu, x0, y_min, y_max, z_min, z_max, title, defsurf, draw_bound,
00074 ncour, ny, nz) ;
00075
00076 }
00077
00078
00079
00080 void des_coupe_x(const Scalar& uu, double x0, double y_min, double y_max,
00081 double z_min, double z_max, const char* title, const Scalar* defsurf,
00082 bool draw_bound, int ncour, int ny, int nz) {
00083
00084 using namespace Unites ;
00085
00086 const Map& mp = uu.get_mp() ;
00087
00088
00089
00090
00091 float* uutab = new float[ny*nz] ;
00092
00093 double hy = (y_max - y_min) / double(ny-1) ;
00094 double hza = (z_max - z_min) / double(nz-1) ;
00095
00096 for (int j=0; j<nz; j++) {
00097
00098 double z = z_min + hza * j ;
00099
00100 for (int i=0; i<ny; i++) {
00101
00102 double y = y_min + hy * i ;
00103
00104
00105 double r, theta, phi ;
00106 mp.convert_absolute(x0, y, z, r, theta, phi) ;
00107
00108 uutab[ny*j+i] = float(uu.val_point(r, theta, phi)) ;
00109 }
00110 }
00111
00112 float ymin1 = float(y_min / km) ;
00113 float ymax1 = float(y_max / km) ;
00114 float zmin1 = float(z_min / km) ;
00115 float zmax1 = float(z_max / km) ;
00116
00117 const char* nomy = "y [km]" ;
00118 const char* nomz = "z [km]" ;
00119
00120 if (title == 0x0) {
00121 title = "" ;
00122 }
00123
00124 const char* device = 0x0 ;
00125 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
00126
00127 des_equipot(uutab, ny, nz, ymin1, ymax1, zmin1, zmax1, ncour, nomy, nomz,
00128 title, device, newgraph) ;
00129
00130 delete [] uutab ;
00131
00132
00133
00134
00135 if (defsurf != 0x0) {
00136
00137 assert( &(defsurf->get_mp()) == &mp ) ;
00138
00139 newgraph = draw_bound ? 0 : 2 ;
00140
00141 des_surface_x(*defsurf, x0, device, newgraph) ;
00142
00143 }
00144
00145
00146
00147
00148
00149 if (draw_bound) {
00150
00151 int ndom = mp.get_mg()->get_nzone() ;
00152
00153 for (int l=0; l<ndom-1; l++) {
00154
00155
00156 newgraph = (l == ndom-2) ? 2 : 0 ;
00157
00158 des_domaine_x(mp, l, x0, device, newgraph) ;
00159 }
00160 }
00161
00162
00163 }
00164
00165
00166
00167
00168 void des_coupe_y(const Scalar& uu, double y0, int nzdes, const char* title,
00169 const Scalar* defsurf, double zoom, bool draw_bound,
00170 int ncour, int nx, int nz) {
00171
00172 const Map& mp = uu.get_mp() ;
00173
00174 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
00175 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
00176 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
00177 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
00178
00179 ray = ( a1 > ray ) ? a1 : ray ;
00180 ray = ( a2 > ray ) ? a2 : ray ;
00181 ray = ( a3 > ray ) ? a3 : ray ;
00182
00183 ray *= zoom ;
00184
00185 double x_min = mp.get_ori_x() - ray ;
00186 double x_max = mp.get_ori_x() + ray ;
00187 double z_min = mp.get_ori_z() - ray ;
00188 double z_max = mp.get_ori_z() + ray ;
00189
00190 des_coupe_y(uu, y0, x_min, x_max, z_min, z_max, title, defsurf, draw_bound,
00191 ncour, nx, nz) ;
00192
00193 }
00194
00195
00196
00197 void des_coupe_y(const Scalar& uu, double y0, double x_min, double x_max,
00198 double z_min, double z_max, const char* title, const Scalar* defsurf,
00199 bool draw_bound, int ncour, int nx, int nz) {
00200
00201 using namespace Unites ;
00202
00203 const Map& mp = uu.get_mp() ;
00204
00205
00206
00207
00208 float* uutab = new float[nx*nz] ;
00209
00210 double hx = (x_max - x_min) / double(nx-1) ;
00211 double hza = (z_max - z_min) / double(nz-1) ;
00212
00213
00214
00215 for (int j=0; j<nz; j++) {
00216
00217 double z = z_min + hza * j ;
00218
00219 for (int i=0; i<nx; i++) {
00220
00221 double x = x_min + hx * i ;
00222
00223
00224 double r, theta, phi ;
00225 mp.convert_absolute(x, y0, z, r, theta, phi) ;
00226
00227 uutab[nx*j+i] = float(uu.val_point(r, theta, phi)) ;
00228 }
00229 }
00230
00231 float xmin1 = float(x_min / km) ;
00232 float xmax1 = float(x_max / km) ;
00233 float zmin1 = float(z_min / km) ;
00234 float zmax1 = float(z_max / km) ;
00235
00236 const char* nomx = "x [km]" ;
00237 const char* nomz = "z [km]" ;
00238
00239 if (title == 0x0) {
00240 title = "" ;
00241 }
00242
00243
00244 const char* device = 0x0 ;
00245 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
00246
00247 des_equipot(uutab, nx, nz, xmin1, xmax1, zmin1, zmax1, ncour, nomx, nomz,
00248 title, device, newgraph) ;
00249
00250
00251
00252
00253 if (defsurf != 0x0) {
00254
00255 assert( &(defsurf->get_mp()) == &mp ) ;
00256
00257 newgraph = draw_bound ? 0 : 2 ;
00258
00259 des_surface_y(*defsurf, y0, device, newgraph) ;
00260
00261 }
00262
00263 delete [] uutab ;
00264
00265
00266
00267
00268 if (draw_bound) {
00269
00270 int ndom = mp.get_mg()->get_nzone() ;
00271
00272 for (int l=0; l<ndom-1; l++) {
00273
00274
00275 newgraph = (l == ndom-2) ? 2 : 0 ;
00276
00277 des_domaine_y(mp, l, y0, device, newgraph) ;
00278 }
00279 }
00280
00281
00282 }
00283
00284
00285
00286
00287 void des_coupe_z(const Scalar& uu, double z0, int nzdes, const char* title,
00288 const Scalar* defsurf, double zoom, bool draw_bound,
00289 int ncour, int nx, int ny) {
00290
00291 const Map& mp = uu.get_mp() ;
00292
00293 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
00294 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
00295 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
00296 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
00297
00298 ray = ( a1 > ray ) ? a1 : ray ;
00299 ray = ( a2 > ray ) ? a2 : ray ;
00300 ray = ( a3 > ray ) ? a3 : ray ;
00301
00302 ray *= zoom ;
00303
00304 double x_min = mp.get_ori_x() - ray ;
00305 double x_max = mp.get_ori_x() + ray ;
00306 double y_min = mp.get_ori_y() - ray ;
00307 double y_max = mp.get_ori_y() + ray ;
00308
00309 des_coupe_z(uu, z0, x_min, x_max, y_min, y_max, title, defsurf, draw_bound,
00310 ncour, nx, ny) ;
00311
00312 }
00313
00314
00315
00316
00317 void des_coupe_z(const Scalar& uu, double z0, double x_min, double x_max,
00318 double y_min, double y_max, const char* title, const Scalar* defsurf,
00319 bool draw_bound, int ncour, int nx, int ny) {
00320
00321 using namespace Unites ;
00322
00323 const Map& mp = uu.get_mp() ;
00324
00325
00326
00327
00328 float* uutab = new float[ny*nx] ;
00329
00330 double hy = (y_max - y_min) / double(ny-1) ;
00331 double hx = (x_max - x_min) / double(nx-1) ;
00332
00333 for (int j=0; j<ny; j++) {
00334
00335 double y = y_min + hy * j ;
00336
00337 for (int i=0; i<nx; i++) {
00338
00339 double x = x_min + hx * i ;
00340
00341
00342 double r, theta, phi ;
00343 mp.convert_absolute(x, y, z0, r, theta, phi) ;
00344
00345 uutab[nx*j+i] = float(uu.val_point(r, theta, phi)) ;
00346 }
00347 }
00348
00349 float ymin1 = float(y_min / km) ;
00350 float ymax1 = float(y_max / km) ;
00351 float xmin1 = float(x_min / km) ;
00352 float xmax1 = float(x_max / km) ;
00353
00354 const char* nomy = "y [km]" ;
00355 const char* nomx = "x [km]" ;
00356
00357 if (title == 0x0) {
00358 title = "" ;
00359 }
00360
00361 const char* device = 0x0 ;
00362 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
00363
00364 des_equipot(uutab, nx, ny, xmin1, xmax1, ymin1, ymax1, ncour, nomx, nomy,
00365 title, device, newgraph) ;
00366
00367 delete [] uutab ;
00368
00369
00370
00371
00372
00373 if (defsurf != 0x0) {
00374
00375 assert( &(defsurf->get_mp()) == &mp ) ;
00376
00377 newgraph = draw_bound ? 0 : 2 ;
00378
00379 des_surface_z(*defsurf, z0, device, newgraph) ;
00380
00381 }
00382
00383
00384
00385
00386 if (draw_bound) {
00387
00388 int ndom = mp.get_mg()->get_nzone() ;
00389
00390 for (int l=0; l<ndom-1; l++) {
00391
00392
00393 newgraph = (l == ndom-2) ? 2 : 0 ;
00394
00395 des_domaine_z(mp, l, z0, device, newgraph) ;
00396 }
00397 }
00398
00399
00400 }
00401