23char des_coupe_vect_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_vect.C,v 1.6 2014/10/13 08:53:22 j_novak Exp $" ;
66#include "utilitaires.h"
72void des_coupe_vect_x(
const Tenseur& vv,
double x0,
double scale,
double sizefl,
73 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
74 bool draw_bound,
int ny,
int nz) {
76 const Map& mp = *(vv.get_mp()) ;
78 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
79 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
80 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
81 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
83 ray = ( a1 > ray ) ? a1 : ray ;
84 ray = ( a2 > ray ) ? a2 : ray ;
85 ray = ( a3 > ray ) ? a3 : ray ;
89 double y_min = mp.get_ori_y() - ray ;
90 double y_max = mp.get_ori_y() + ray ;
91 double z_min = mp.get_ori_z() - ray ;
92 double z_max = mp.get_ori_z() + ray ;
94 des_coupe_vect_x(vv, x0, scale, sizefl, y_min, y_max, z_min, z_max, title,
95 defsurf, draw_bound, ny, nz) ;
103void des_coupe_vect_x(
const Tenseur& vv,
double x0,
double scale,
double
104 sizefl,
double y_min,
double y_max,
double z_min,
105 double z_max,
const char* title,
const Cmp* defsurf,
106 bool draw_bound,
int ny,
int nz) {
108 using namespace Unites ;
110 const Map& mp = *(vv.get_mp()) ;
112 if (vv.get_valence() != 1) {
114 "des_coupe_vect_x: the Tenseur must be of valence 1 (vector) !" << endl ;
118 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
120 "des_coupe_vect_x: the vector must be given in Cartesian components !"
129 float* vvy =
new float[ny*nz] ;
130 float* vvz =
new float[ny*nz] ;
132 double hy = (y_max - y_min) /
double(ny-1) ;
133 double hza = (z_max - z_min) /
double(nz-1) ;
135 for (
int j=0; j<nz; j++) {
137 double z = z_min + hza * j ;
139 for (
int i=0; i<ny; i++) {
141 double y = y_min + hy * i ;
144 double r, theta,
phi ;
145 mp.convert_absolute(x0,
y,
z,
r, theta,
phi) ;
147 vvy[ny*j+i] = float(vv(1).val_point(
r, theta,
phi)) ;
148 vvz[ny*j+i] = float(vv(2).val_point(
r, theta,
phi)) ;
153 float ymin1 = float(y_min / km) ;
154 float ymax1 = float(y_max / km) ;
155 float zmin1 = float(z_min / km) ;
156 float zmax1 = float(z_max / km) ;
158 const char* nomy =
"y [km]" ;
159 const char* nomz =
"z [km]" ;
165 const char* device = 0x0 ;
166 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
168 des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
169 scale, sizefl, nomy, nomz, title, device, newgraph) ;
178 if (defsurf != 0x0) {
180 assert(defsurf->get_mp() == vv.get_mp()) ;
182 newgraph = draw_bound ? 0 : 2 ;
184 des_surface_x(*defsurf, x0, device, newgraph) ;
194 int ndom = mp.get_mg()->get_nzone() ;
196 for (
int l=0; l<ndom-1; l++) {
199 newgraph = (l == ndom-2) ? 2 : 0 ;
201 des_domaine_x(mp, l, x0, device, newgraph) ;
212void des_coupe_vect_y(
const Tenseur& vv,
double y0,
double scale,
double sizefl,
213 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
214 bool draw_bound,
int nx,
int nz) {
216 const Map& mp = *(vv.get_mp()) ;
218 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
219 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
220 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
221 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
223 ray = ( a1 > ray ) ? a1 : ray ;
224 ray = ( a2 > ray ) ? a2 : ray ;
225 ray = ( a3 > ray ) ? a3 : ray ;
229 double x_min = mp.get_ori_x() - ray ;
230 double x_max = mp.get_ori_x() + ray ;
231 double z_min = mp.get_ori_z() - ray ;
232 double z_max = mp.get_ori_z() + ray ;
235 des_coupe_vect_y(vv, y0, scale, sizefl, x_min, x_max, z_min, z_max, title,
236 defsurf, draw_bound, nx, nz) ;
244void des_coupe_vect_y(
const Tenseur& vv,
double y0,
double scale,
double
245 sizefl,
double x_min,
double x_max,
double z_min,
246 double z_max,
const char* title,
const Cmp* defsurf,
247 bool draw_bound,
int nx,
int nz) {
249 using namespace Unites ;
251 const Map& mp = *(vv.get_mp()) ;
253 if (vv.get_valence() != 1) {
255 "des_coupe_vect_y: the Tenseur must be of valence 1 (vector) !" << endl ;
259 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
261 "des_coupe_vect_y: the vector must be given in Cartesian components !"
270 float* vvx =
new float[nx*nz] ;
271 float* vvz =
new float[nx*nz] ;
273 double hx = (x_max - x_min) /
double(nx-1) ;
274 double hza = (z_max - z_min) /
double(nz-1) ;
276 for (
int j=0; j<nz; j++) {
278 double z = z_min + hza * j ;
280 for (
int i=0; i<nx; i++) {
282 double x = x_min + hx * i ;
285 double r, theta,
phi ;
286 mp.convert_absolute(
x, y0,
z,
r, theta,
phi) ;
288 vvx[nx*j+i] = float(vv(0).val_point(
r, theta,
phi)) ;
289 vvz[nx*j+i] = float(vv(2).val_point(
r, theta,
phi)) ;
294 float xmin1 = float(x_min / km) ;
295 float xmax1 = float(x_max / km) ;
296 float zmin1 = float(z_min / km) ;
297 float zmax1 = float(z_max / km) ;
299 const char* nomx =
"x [km]" ;
300 const char* nomz =
"z [km]" ;
307 const char* device = 0x0 ;
308 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
310 des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
311 scale, sizefl, nomx, nomz, title, device, newgraph) ;
320 if (defsurf != 0x0) {
322 assert(defsurf->get_mp() == vv.get_mp()) ;
324 newgraph = draw_bound ? 0 : 2 ;
326 des_surface_y(*defsurf, y0, device, newgraph) ;
336 int ndom = mp.get_mg()->get_nzone() ;
338 for (
int l=0; l<ndom-1; l++) {
341 newgraph = (l == ndom-2) ? 2 : 0 ;
343 des_domaine_y(mp, l, y0, device, newgraph) ;
353void des_coupe_vect_z(
const Tenseur& vv,
double z0,
double scale,
double sizefl,
354 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
355 bool draw_bound,
int nx,
int ny) {
357 const Map& mp = *(vv.get_mp()) ;
359 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
360 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
361 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
362 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
364 ray = ( a1 > ray ) ? a1 : ray ;
365 ray = ( a2 > ray ) ? a2 : ray ;
366 ray = ( a3 > ray ) ? a3 : ray ;
370 double x_min = mp.get_ori_x() - ray ;
371 double x_max = mp.get_ori_x() + ray ;
372 double y_min = mp.get_ori_y() - ray ;
373 double y_max = mp.get_ori_y() + ray ;
375 des_coupe_vect_z(vv, z0, scale, sizefl, x_min, x_max, y_min, y_max, title,
376 defsurf, draw_bound, nx, ny) ;
384void des_coupe_vect_z(
const Tenseur& vv,
double z0,
double scale,
double
385 sizefl,
double x_min,
double x_max,
double y_min,
386 double y_max,
const char* title,
const Cmp* defsurf,
387 bool draw_bound,
int nx,
int ny) {
389 using namespace Unites ;
391 const Map& mp = *(vv.get_mp()) ;
393 if (vv.get_valence() != 1) {
395 "des_coupe_vect_y: the Tenseur must be of valence 1 (vector) !" << endl ;
399 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
401 "des_coupe_vect_y: the vector must be given in Cartesian components !"
410 float* vvx =
new float[nx*ny] ;
411 float* vvy =
new float[nx*ny] ;
413 double hy = (y_max - y_min) /
double(ny-1) ;
414 double hx = (x_max - x_min) /
double(nx-1) ;
416 for (
int j=0; j<ny; j++) {
418 double y = y_min + hy * j ;
420 for (
int i=0; i<nx; i++) {
422 double x = x_min + hx * i ;
425 double r, theta,
phi ;
426 mp.convert_absolute(
x,
y, z0,
r, theta,
phi) ;
428 vvx[nx*j+i] = float(vv(0).val_point(
r, theta,
phi)) ;
429 vvy[nx*j+i] = float(vv(1).val_point(
r, theta,
phi)) ;
434 float ymin1 = float(y_min / km) ;
435 float ymax1 = float(y_max / km) ;
436 float xmin1 = float(x_min / km) ;
437 float xmax1 = float(x_max / km) ;
439 const char* nomy =
"y [km]" ;
440 const char* nomx =
"x [km]" ;
446 const char* device = 0x0 ;
447 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
449 des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
450 scale, sizefl, nomx, nomy, title, device, newgraph) ;
459 if (defsurf != 0x0) {
461 assert(defsurf->get_mp() == vv.get_mp()) ;
463 newgraph = draw_bound ? 0 : 2 ;
465 des_surface_z(*defsurf, z0, device, newgraph) ;
474 int ndom = mp.get_mg()->get_nzone() ;
476 for (
int l=0; l<ndom-1; l++) {
479 newgraph = (l == ndom-2) ? 2 : 0 ;
481 des_domaine_z(mp, l, z0, device, newgraph) ;
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Coord z
z coordinate centered on the grid
Coord y
y coordinate centered on the grid
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord phi
coordinate centered on the grid
Coord x
x coordinate centered on the grid
Coord r
r coordinate centered on the grid