72#include "utilitaires.h"
78void des_vect_bin_x(
const Tenseur& vv1,
const Tenseur& vv2,
double x0,
79 double scale,
double sizefl,
double y_min,
double y_max,
80 double z_min,
double z_max,
const char* title,
81 const Cmp* defsurf1,
const Cmp* defsurf2,
82 bool draw_bound,
int ny,
int nz) {
84 using namespace Unites ;
86 const Map& mp1 = *(vv1.get_mp()) ;
87 const Map& mp2 = *(vv2.get_mp()) ;
92 if (vv1.get_valence() != 1) {
94 "des_vect_bin_x: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
98 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
100 "des_vect_bin_x: the vector vv1 must be given in Cartesian components !"
105 if (vv2.get_valence() != 1) {
107 "des_vect_bin_x: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
111 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
113 "des_vect_bin_x: the vector vv2 must be given in Cartesian components !"
118 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
120 "des_vect_bin_x: the components of the two vectors are not defined"
121 << endl <<
"on the same triad !" << endl ;
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 ;
143 double r, theta,
phi ;
145 mp1.convert_absolute(x0,
y,
z,
r, theta,
phi) ;
146 double vv1y = vv1(1).val_point(
r, theta,
phi) ;
147 double vv1z = vv1(2).val_point(
r, theta,
phi) ;
149 mp2.convert_absolute(x0,
y,
z,
r, theta,
phi) ;
150 double vv2y = vv2(1).val_point(
r, theta,
phi) ;
151 double vv2z = vv2(2).val_point(
r, theta,
phi) ;
153 vvy[ny*j+i] = float(vv1y + vv2y) ;
154 vvz[ny*j+i] = float(vv1z + vv2z) ;
159 float ymin1 = float(y_min / km) ;
160 float ymax1 = float(y_max / km) ;
161 float zmin1 = float(z_min / km) ;
162 float zmax1 = float(z_max / km) ;
164 const char* nomy =
"y [km]" ;
165 const char* nomz =
"z [km]" ;
171 const char* device = 0x0 ;
172 int newgraph = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
175 des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
176 scale, sizefl, nomy, nomz, title, device, newgraph) ;
184 if (defsurf1 != 0x0) {
186 assert(defsurf1->get_mp() == vv1.get_mp()) ;
187 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
188 des_surface_x(*defsurf1, x0, device, newgraph) ;
191 if (defsurf2 != 0x0) {
193 assert(defsurf2->get_mp() == vv2.get_mp()) ;
194 newgraph = draw_bound ? 0 : 2 ;
195 des_surface_x(*defsurf2, x0, device, newgraph) ;
204 int ndom1 = mp1.get_mg()->get_nzone() ;
205 int ndom2 = mp2.get_mg()->get_nzone() ;
207 for (
int l=0; l<ndom1-1; l++) {
210 des_domaine_x(mp1, l, x0, device, newgraph) ;
213 for (
int l=0; l<ndom2-1; l++) {
216 newgraph = (l == ndom2-2) ? 2 : 0 ;
218 des_domaine_x(mp2, l, x0, device, newgraph) ;
227void des_vect_bin_y(
const Tenseur& vv1,
const Tenseur& vv2,
double y0,
228 double scale,
double sizefl,
double x_min,
double x_max,
229 double z_min,
double z_max,
const char* title,
230 const Cmp* defsurf1,
const Cmp* defsurf2,
231 bool draw_bound,
int nx,
int nz) {
233 using namespace Unites ;
235 const Map& mp1 = *(vv1.get_mp()) ;
236 const Map& mp2 = *(vv2.get_mp()) ;
241 if (vv1.get_valence() != 1) {
243 "des_vect_bin_y: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
247 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
249 "des_vect_bin_y: the vector vv1 must be given in Cartesian components !"
254 if (vv2.get_valence() != 1) {
256 "des_vect_bin_y: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
260 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
262 "des_vect_bin_y: the vector vv2 must be given in Cartesian components !"
267 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
269 "des_vect_bin_y: the components of the two vectors are not defined"
270 << endl <<
"on the same triad !" << endl ;
277 float* vvx =
new float[nx*nz] ;
278 float* vvz =
new float[nx*nz] ;
280 double hx = (x_max - x_min) /
double(nx-1) ;
281 double hza = (z_max - z_min) /
double(nz-1) ;
283 for (
int j=0; j<nz; j++) {
285 double z = z_min + hza * j ;
287 for (
int i=0; i<nx; i++) {
289 double x = x_min + hx * i ;
291 double r, theta,
phi ;
293 mp1.convert_absolute(
x, y0,
z,
r, theta,
phi) ;
294 double vv1x = vv1(0).val_point(
r, theta,
phi) ;
295 double vv1z = vv1(2).val_point(
r, theta,
phi) ;
297 mp2.convert_absolute(
x, y0,
z,
r, theta,
phi) ;
298 double vv2x = vv2(0).val_point(
r, theta,
phi) ;
299 double vv2z = vv2(2).val_point(
r, theta,
phi) ;
301 vvx[nx*j+i] = float(vv1x + vv2x) ;
302 vvz[nx*j+i] = float(vv1z + vv2z) ;
306 float xmin1 = float(x_min / km) ;
307 float xmax1 = float(x_max / km) ;
308 float zmin1 = float(z_min / km) ;
309 float zmax1 = float(z_max / km) ;
311 const char* nomx =
"x [km]" ;
312 const char* nomz =
"z [km]" ;
318 const char* device = 0x0 ;
319 int newgraph = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
322 des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
323 scale, sizefl, nomx, nomz, title, device, newgraph) ;
331 if (defsurf1 != 0x0) {
333 assert(defsurf1->get_mp() == vv1.get_mp()) ;
334 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
335 des_surface_y(*defsurf1, y0, device, newgraph) ;
338 if (defsurf2 != 0x0) {
340 assert(defsurf2->get_mp() == vv2.get_mp()) ;
341 newgraph = draw_bound ? 0 : 2 ;
342 des_surface_y(*defsurf2, y0, device, newgraph) ;
351 int ndom1 = mp1.get_mg()->get_nzone() ;
352 int ndom2 = mp2.get_mg()->get_nzone() ;
354 for (
int l=0; l<ndom1-1; l++) {
357 des_domaine_y(mp1, l, y0, device, newgraph) ;
360 for (
int l=0; l<ndom2-1; l++) {
363 newgraph = (l == ndom2-2) ? 2 : 0 ;
365 des_domaine_y(mp2, l, y0, device, newgraph) ;
374void des_vect_bin_z(
const Tenseur& vv1,
const Tenseur& vv2,
double z0,
375 double scale,
double sizefl,
double x_min,
double x_max,
376 double y_min,
double y_max,
const char* title,
377 const Cmp* defsurf1,
const Cmp* defsurf2,
378 bool draw_bound,
int nx,
int ny) {
380 using namespace Unites ;
382 const Map& mp1 = *(vv1.get_mp()) ;
383 const Map& mp2 = *(vv2.get_mp()) ;
388 if (vv1.get_valence() != 1) {
390 "des_vect_bin_z: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
394 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
396 "des_vect_bin_z: the vector vv1 must be given in Cartesian components !"
401 if (vv2.get_valence() != 1) {
403 "des_vect_bin_z: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
407 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
409 "des_vect_bin_z: the vector vv2 must be given in Cartesian components !"
414 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
416 "des_vect_bin_z: the components of the two vectors are not defined"
417 << endl <<
"on the same triad !" << endl ;
424 float* vvx =
new float[nx*ny] ;
425 float* vvy =
new float[nx*ny] ;
427 double hx = (x_max - x_min) /
double(nx-1) ;
428 double hy = (y_max - y_min) /
double(ny-1) ;
430 for (
int j=0; j<ny; j++) {
432 double y = y_min + hy * j ;
434 for (
int i=0; i<nx; i++) {
436 double x = x_min + hx * i ;
438 double r, theta,
phi ;
440 mp1.convert_absolute(
x,
y, z0,
r, theta,
phi) ;
441 double vv1x = vv1(0).val_point(
r, theta,
phi) ;
442 double vv1y = vv1(1).val_point(
r, theta,
phi) ;
444 mp2.convert_absolute(
x,
y, z0,
r, theta,
phi) ;
445 double vv2x = vv2(0).val_point(
r, theta,
phi) ;
446 double vv2y = vv2(1).val_point(
r, theta,
phi) ;
448 vvx[nx*j+i] = float(vv1x + vv2x) ;
449 vvy[nx*j+i] = float(vv1y + vv2y) ;
453 float xmin1 = float(x_min / km) ;
454 float xmax1 = float(x_max / km) ;
455 float ymin1 = float(y_min / km) ;
456 float ymax1 = float(y_max / km) ;
458 const char* nomx =
"x [km]" ;
459 const char* nomy =
"y [km]" ;
465 const char* device = 0x0 ;
466 int newgraph = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
469 des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
470 scale, sizefl, nomx, nomy, title, device, newgraph) ;
478 if (defsurf1 != 0x0) {
480 assert(defsurf1->get_mp() == vv1.get_mp()) ;
481 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
482 des_surface_z(*defsurf1, z0, device, newgraph) ;
485 if (defsurf2 != 0x0) {
487 assert(defsurf2->get_mp() == vv2.get_mp()) ;
488 newgraph = draw_bound ? 0 : 2 ;
489 des_surface_z(*defsurf2, z0, device, newgraph) ;
498 int ndom1 = mp1.get_mg()->get_nzone() ;
499 int ndom2 = mp2.get_mg()->get_nzone() ;
501 for (
int l=0; l<ndom1-1; l++) {
504 des_domaine_z(mp1, l, z0, device, newgraph) ;
507 for (
int l=0; l<ndom2-1; l++) {
510 newgraph = (l == ndom2-2) ? 2 : 0 ;
512 des_domaine_z(mp2, 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