57#include "utilitaires.h"
63void des_coupe_vect_x(
const Vector& vv,
double x0,
double scale,
double sizefl,
64 int nzdes,
const char* title,
const Scalar* defsurf,
double zoom,
65 bool draw_bound,
int ny,
int nz) {
67 const Map& mp = vv.get_mp() ;
69 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
70 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
71 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
72 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
74 ray = ( a1 > ray ) ? a1 : ray ;
75 ray = ( a2 > ray ) ? a2 : ray ;
76 ray = ( a3 > ray ) ? a3 : ray ;
80 double y_min = mp.get_ori_y() - ray ;
81 double y_max = mp.get_ori_y() + ray ;
82 double z_min = mp.get_ori_z() - ray ;
83 double z_max = mp.get_ori_z() + ray ;
85 des_coupe_vect_x(vv, x0, scale, sizefl, y_min, y_max, z_min, z_max, title,
86 defsurf, draw_bound, ny, nz) ;
94void des_coupe_vect_x(
const Vector& vv,
double x0,
double scale,
double
95 sizefl,
double y_min,
double y_max,
double z_min,
96 double z_max,
const char* title,
const Scalar* defsurf,
97 bool draw_bound,
int ny,
int nz) {
99 using namespace Unites ;
101 const Map& mp = vv.get_mp() ;
103 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
105 "des_coupe_vect_x: the vector must be given in Cartesian components !"
114 float* vvy =
new float[ny*nz] ;
115 float* vvz =
new float[ny*nz] ;
117 double hy = (y_max - y_min) /
double(ny-1) ;
118 double hza = (z_max - z_min) /
double(nz-1) ;
120 for (
int j=0; j<nz; j++) {
122 double z = z_min + hza * j ;
124 for (
int i=0; i<ny; i++) {
126 double y = y_min + hy * i ;
129 double r, theta,
phi ;
130 mp.convert_absolute(x0,
y,
z,
r, theta,
phi) ;
132 vvy[ny*j+i] = float(vv(2).val_point(
r, theta,
phi)) ;
133 vvz[ny*j+i] = float(vv(3).val_point(
r, theta,
phi)) ;
138 float ymin1 = float(y_min / km) ;
139 float ymax1 = float(y_max / km) ;
140 float zmin1 = float(z_min / km) ;
141 float zmax1 = float(z_max / km) ;
143 const char* nomy =
"y [km]" ;
144 const char* nomz =
"z [km]" ;
150 const char* device = 0x0 ;
151 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
153 des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
154 scale, sizefl, nomy, nomz, title, device, newgraph) ;
163 if (defsurf != 0x0) {
165 assert( &(defsurf->get_mp()) == &mp ) ;
167 newgraph = draw_bound ? 0 : 2 ;
169 des_surface_x(*defsurf, x0, device, newgraph) ;
179 int ndom = mp.get_mg()->get_nzone() ;
181 for (
int l=0; l<ndom-1; l++) {
184 newgraph = (l == ndom-2) ? 2 : 0 ;
186 des_domaine_x(mp, l, x0, device, newgraph) ;
197void des_coupe_vect_y(
const Vector& vv,
double y0,
double scale,
double sizefl,
198 int nzdes,
const char* title,
const Scalar* defsurf,
double zoom,
199 bool draw_bound,
int nx,
int nz) {
201 const Map& mp = vv.get_mp() ;
203 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
204 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
205 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
206 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
208 ray = ( a1 > ray ) ? a1 : ray ;
209 ray = ( a2 > ray ) ? a2 : ray ;
210 ray = ( a3 > ray ) ? a3 : ray ;
214 double x_min = mp.get_ori_x() - ray ;
215 double x_max = mp.get_ori_x() + ray ;
216 double z_min = mp.get_ori_z() - ray ;
217 double z_max = mp.get_ori_z() + ray ;
220 des_coupe_vect_y(vv, y0, scale, sizefl, x_min, x_max, z_min, z_max, title,
221 defsurf, draw_bound, nx, nz) ;
229void des_coupe_vect_y(
const Vector& vv,
double y0,
double scale,
double
230 sizefl,
double x_min,
double x_max,
double z_min,
231 double z_max,
const char* title,
const Scalar* defsurf,
232 bool draw_bound,
int nx,
int nz) {
234 using namespace Unites ;
236 const Map& mp = vv.get_mp() ;
238 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
240 "des_coupe_vect_y: the vector must be given in Cartesian components !"
249 float* vvx =
new float[nx*nz] ;
250 float* vvz =
new float[nx*nz] ;
252 double hx = (x_max - x_min) /
double(nx-1) ;
253 double hza = (z_max - z_min) /
double(nz-1) ;
255 for (
int j=0; j<nz; j++) {
257 double z = z_min + hza * j ;
259 for (
int i=0; i<nx; i++) {
261 double x = x_min + hx * i ;
264 double r, theta,
phi ;
265 mp.convert_absolute(
x, y0,
z,
r, theta,
phi) ;
267 vvx[nx*j+i] = float(vv(1).val_point(
r, theta,
phi)) ;
268 vvz[nx*j+i] = float(vv(3).val_point(
r, theta,
phi)) ;
273 float xmin1 = float(x_min / km) ;
274 float xmax1 = float(x_max / km) ;
275 float zmin1 = float(z_min / km) ;
276 float zmax1 = float(z_max / km) ;
278 const char* nomx =
"x [km]" ;
279 const char* nomz =
"z [km]" ;
286 const char* device = 0x0 ;
287 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
289 des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
290 scale, sizefl, nomx, nomz, title, device, newgraph) ;
299 if (defsurf != 0x0) {
301 assert( &(defsurf->get_mp()) == &mp ) ;
303 newgraph = draw_bound ? 0 : 2 ;
305 des_surface_y(*defsurf, y0, device, newgraph) ;
315 int ndom = mp.get_mg()->get_nzone() ;
317 for (
int l=0; l<ndom-1; l++) {
320 newgraph = (l == ndom-2) ? 2 : 0 ;
322 des_domaine_y(mp, l, y0, device, newgraph) ;
332void des_coupe_vect_z(
const Vector& vv,
double z0,
double scale,
double sizefl,
333 int nzdes,
const char* title,
const Scalar* defsurf,
double zoom,
334 bool draw_bound,
int nx,
int ny) {
336 const Map& mp = vv.get_mp() ;
338 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
339 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
340 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
341 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
343 ray = ( a1 > ray ) ? a1 : ray ;
344 ray = ( a2 > ray ) ? a2 : ray ;
345 ray = ( a3 > ray ) ? a3 : ray ;
349 double x_min = mp.get_ori_x() - ray ;
350 double x_max = mp.get_ori_x() + ray ;
351 double y_min = mp.get_ori_y() - ray ;
352 double y_max = mp.get_ori_y() + ray ;
354 des_coupe_vect_z(vv, z0, scale, sizefl, x_min, x_max, y_min, y_max, title,
355 defsurf, draw_bound, nx, ny) ;
363void des_coupe_vect_z(
const Vector& vv,
double z0,
double scale,
double
364 sizefl,
double x_min,
double x_max,
double y_min,
365 double y_max,
const char* title,
const Scalar* defsurf,
366 bool draw_bound,
int nx,
int ny) {
368 using namespace Unites ;
370 const Map& mp = vv.get_mp() ;
372 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
374 "des_coupe_vect_y: the vector must be given in Cartesian components !"
383 float* vvx =
new float[nx*ny] ;
384 float* vvy =
new float[nx*ny] ;
386 double hy = (y_max - y_min) /
double(ny-1) ;
387 double hx = (x_max - x_min) /
double(nx-1) ;
389 for (
int j=0; j<ny; j++) {
391 double y = y_min + hy * j ;
393 for (
int i=0; i<nx; i++) {
395 double x = x_min + hx * i ;
398 double r, theta,
phi ;
399 mp.convert_absolute(
x,
y, z0,
r, theta,
phi) ;
401 vvx[nx*j+i] = float(vv(1).val_point(
r, theta,
phi)) ;
402 vvy[nx*j+i] = float(vv(2).val_point(
r, theta,
phi)) ;
407 float ymin1 = float(y_min / km) ;
408 float ymax1 = float(y_max / km) ;
409 float xmin1 = float(x_min / km) ;
410 float xmax1 = float(x_max / km) ;
412 const char* nomy =
"y [km]" ;
413 const char* nomx =
"x [km]" ;
419 const char* device = 0x0 ;
420 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
422 des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
423 scale, sizefl, nomx, nomy, title, device, newgraph) ;
432 if (defsurf != 0x0) {
434 assert( &(defsurf->get_mp()) == &mp ) ;
436 newgraph = draw_bound ? 0 : 2 ;
438 des_surface_z(*defsurf, z0, device, newgraph) ;
447 int ndom = mp.get_mg()->get_nzone() ;
449 for (
int l=0; l<ndom-1; l++) {
452 newgraph = (l == ndom-2) ? 2 : 0 ;
454 des_domaine_z(mp, l, z0, device, newgraph) ;
Tensor field of valence 0 (or component of a tensorial field).
Tensor field of valence 1.
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