69#include "utilitaires.h"
75void des_coupe_vect_x(
const Tenseur& vv,
double x0,
double scale,
double sizefl,
76 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
77 bool draw_bound,
int ny,
int nz) {
79 const Map& mp = *(vv.get_mp()) ;
81 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
82 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
83 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
84 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
86 ray = ( a1 > ray ) ? a1 : ray ;
87 ray = ( a2 > ray ) ? a2 : ray ;
88 ray = ( a3 > ray ) ? a3 : ray ;
92 double y_min = mp.get_ori_y() - ray ;
93 double y_max = mp.get_ori_y() + ray ;
94 double z_min = mp.get_ori_z() - ray ;
95 double z_max = mp.get_ori_z() + ray ;
97 des_coupe_vect_x(vv, x0, scale, sizefl, y_min, y_max, z_min, z_max, title,
98 defsurf, draw_bound, ny, nz) ;
106void des_coupe_vect_x(
const Tenseur& vv,
double x0,
double scale,
double
107 sizefl,
double y_min,
double y_max,
double z_min,
108 double z_max,
const char* title,
const Cmp* defsurf,
109 bool draw_bound,
int ny,
int nz) {
111 using namespace Unites ;
113 const Map& mp = *(vv.get_mp()) ;
115 if (vv.get_valence() != 1) {
117 "des_coupe_vect_x: the Tenseur must be of valence 1 (vector) !" << endl ;
121 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
123 "des_coupe_vect_x: the vector must be given in Cartesian components !"
132 float* vvy =
new float[ny*nz] ;
133 float* vvz =
new float[ny*nz] ;
135 double hy = (y_max - y_min) /
double(ny-1) ;
136 double hza = (z_max - z_min) /
double(nz-1) ;
138 for (
int j=0; j<nz; j++) {
140 double z = z_min + hza * j ;
142 for (
int i=0; i<ny; i++) {
144 double y = y_min + hy * i ;
147 double r, theta,
phi ;
148 mp.convert_absolute(x0,
y,
z,
r, theta,
phi) ;
150 vvy[ny*j+i] = float(vv(1).val_point(
r, theta,
phi)) ;
151 vvz[ny*j+i] = float(vv(2).val_point(
r, theta,
phi)) ;
156 float ymin1 = float(y_min / km) ;
157 float ymax1 = float(y_max / km) ;
158 float zmin1 = float(z_min / km) ;
159 float zmax1 = float(z_max / km) ;
161 const char* nomy =
"y [km]" ;
162 const char* nomz =
"z [km]" ;
168 const char* device = 0x0 ;
169 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
171 des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
172 scale, sizefl, nomy, nomz, title, device, newgraph) ;
181 if (defsurf != 0x0) {
183 assert(defsurf->get_mp() == vv.get_mp()) ;
185 newgraph = draw_bound ? 0 : 2 ;
187 des_surface_x(*defsurf, x0, device, newgraph) ;
197 int ndom = mp.get_mg()->get_nzone() ;
199 for (
int l=0; l<ndom-1; l++) {
202 newgraph = (l == ndom-2) ? 2 : 0 ;
204 des_domaine_x(mp, l, x0, device, newgraph) ;
215void des_coupe_vect_y(
const Tenseur& vv,
double y0,
double scale,
double sizefl,
216 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
217 bool draw_bound,
int nx,
int nz) {
219 const Map& mp = *(vv.get_mp()) ;
221 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
222 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
223 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
224 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
226 ray = ( a1 > ray ) ? a1 : ray ;
227 ray = ( a2 > ray ) ? a2 : ray ;
228 ray = ( a3 > ray ) ? a3 : ray ;
232 double x_min = mp.get_ori_x() - ray ;
233 double x_max = mp.get_ori_x() + ray ;
234 double z_min = mp.get_ori_z() - ray ;
235 double z_max = mp.get_ori_z() + ray ;
238 des_coupe_vect_y(vv, y0, scale, sizefl, x_min, x_max, z_min, z_max, title,
239 defsurf, draw_bound, nx, nz) ;
247void des_coupe_vect_y(
const Tenseur& vv,
double y0,
double scale,
double
248 sizefl,
double x_min,
double x_max,
double z_min,
249 double z_max,
const char* title,
const Cmp* defsurf,
250 bool draw_bound,
int nx,
int nz) {
252 using namespace Unites ;
254 const Map& mp = *(vv.get_mp()) ;
256 if (vv.get_valence() != 1) {
258 "des_coupe_vect_y: the Tenseur must be of valence 1 (vector) !" << endl ;
262 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
264 "des_coupe_vect_y: the vector must be given in Cartesian components !"
273 float* vvx =
new float[nx*nz] ;
274 float* vvz =
new float[nx*nz] ;
276 double hx = (x_max - x_min) /
double(nx-1) ;
277 double hza = (z_max - z_min) /
double(nz-1) ;
279 for (
int j=0; j<nz; j++) {
281 double z = z_min + hza * j ;
283 for (
int i=0; i<nx; i++) {
285 double x = x_min + hx * i ;
288 double r, theta,
phi ;
289 mp.convert_absolute(
x, y0,
z,
r, theta,
phi) ;
291 vvx[nx*j+i] = float(vv(0).val_point(
r, theta,
phi)) ;
292 vvz[nx*j+i] = float(vv(2).val_point(
r, theta,
phi)) ;
297 float xmin1 = float(x_min / km) ;
298 float xmax1 = float(x_max / km) ;
299 float zmin1 = float(z_min / km) ;
300 float zmax1 = float(z_max / km) ;
302 const char* nomx =
"x [km]" ;
303 const char* nomz =
"z [km]" ;
310 const char* device = 0x0 ;
311 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
313 des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
314 scale, sizefl, nomx, nomz, title, device, newgraph) ;
323 if (defsurf != 0x0) {
325 assert(defsurf->get_mp() == vv.get_mp()) ;
327 newgraph = draw_bound ? 0 : 2 ;
329 des_surface_y(*defsurf, y0, device, newgraph) ;
339 int ndom = mp.get_mg()->get_nzone() ;
341 for (
int l=0; l<ndom-1; l++) {
344 newgraph = (l == ndom-2) ? 2 : 0 ;
346 des_domaine_y(mp, l, y0, device, newgraph) ;
356void des_coupe_vect_z(
const Tenseur& vv,
double z0,
double scale,
double sizefl,
357 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
358 bool draw_bound,
int nx,
int ny) {
360 const Map& mp = *(vv.get_mp()) ;
362 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
363 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
364 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
365 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
367 ray = ( a1 > ray ) ? a1 : ray ;
368 ray = ( a2 > ray ) ? a2 : ray ;
369 ray = ( a3 > ray ) ? a3 : ray ;
373 double x_min = mp.get_ori_x() - ray ;
374 double x_max = mp.get_ori_x() + ray ;
375 double y_min = mp.get_ori_y() - ray ;
376 double y_max = mp.get_ori_y() + ray ;
378 des_coupe_vect_z(vv, z0, scale, sizefl, x_min, x_max, y_min, y_max, title,
379 defsurf, draw_bound, nx, ny) ;
387void des_coupe_vect_z(
const Tenseur& vv,
double z0,
double scale,
double
388 sizefl,
double x_min,
double x_max,
double y_min,
389 double y_max,
const char* title,
const Cmp* defsurf,
390 bool draw_bound,
int nx,
int ny) {
392 using namespace Unites ;
394 const Map& mp = *(vv.get_mp()) ;
396 if (vv.get_valence() != 1) {
398 "des_coupe_vect_y: the Tenseur must be of valence 1 (vector) !" << endl ;
402 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
404 "des_coupe_vect_y: the vector must be given in Cartesian components !"
413 float* vvx =
new float[nx*ny] ;
414 float* vvy =
new float[nx*ny] ;
416 double hy = (y_max - y_min) /
double(ny-1) ;
417 double hx = (x_max - x_min) /
double(nx-1) ;
419 for (
int j=0; j<ny; j++) {
421 double y = y_min + hy * j ;
423 for (
int i=0; i<nx; i++) {
425 double x = x_min + hx * i ;
428 double r, theta,
phi ;
429 mp.convert_absolute(
x,
y, z0,
r, theta,
phi) ;
431 vvx[nx*j+i] = float(vv(0).val_point(
r, theta,
phi)) ;
432 vvy[nx*j+i] = float(vv(1).val_point(
r, theta,
phi)) ;
437 float ymin1 = float(y_min / km) ;
438 float ymax1 = float(y_max / km) ;
439 float xmin1 = float(x_min / km) ;
440 float xmax1 = float(x_max / km) ;
442 const char* nomy =
"y [km]" ;
443 const char* nomx =
"x [km]" ;
449 const char* device = 0x0 ;
450 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
452 des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
453 scale, sizefl, nomx, nomy, title, device, newgraph) ;
462 if (defsurf != 0x0) {
464 assert(defsurf->get_mp() == vv.get_mp()) ;
466 newgraph = draw_bound ? 0 : 2 ;
468 des_surface_z(*defsurf, z0, device, newgraph) ;
477 int ndom = mp.get_mg()->get_nzone() ;
479 for (
int l=0; l<ndom-1; l++) {
482 newgraph = (l == ndom-2) ? 2 : 0 ;
484 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