23char des_vect_bin_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_vect_bin.C,v 1.6 2014/10/13 08:53:23 j_novak Exp $" ;
69#include "utilitaires.h"
75void des_vect_bin_x(
const Tenseur& vv1,
const Tenseur& vv2,
double x0,
76 double scale,
double sizefl,
double y_min,
double y_max,
77 double z_min,
double z_max,
const char* title,
78 const Cmp* defsurf1,
const Cmp* defsurf2,
79 bool draw_bound,
int ny,
int nz) {
83 const Map& mp1 = *(vv1.get_mp()) ;
84 const Map& mp2 = *(vv2.get_mp()) ;
89 if (vv1.get_valence() != 1) {
91 "des_vect_bin_x: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
95 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
97 "des_vect_bin_x: the vector vv1 must be given in Cartesian components !"
102 if (vv2.get_valence() != 1) {
104 "des_vect_bin_x: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
108 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
110 "des_vect_bin_x: the vector vv2 must be given in Cartesian components !"
115 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
117 "des_vect_bin_x: the components of the two vectors are not defined"
118 << endl <<
"on the same triad !" << endl ;
126 float* vvy =
new float[ny*nz] ;
127 float* vvz =
new float[ny*nz] ;
129 double hy = (y_max - y_min) /
double(ny-1) ;
130 double hza = (z_max - z_min) /
double(nz-1) ;
132 for (
int j=0; j<nz; j++) {
134 double z = z_min + hza * j ;
136 for (
int i=0; i<ny; i++) {
138 double y = y_min + hy * i ;
140 double r, theta, phi ;
142 mp1.convert_absolute(x0, y, z, r, theta, phi) ;
143 double vv1y = vv1(1).val_point(r, theta, phi) ;
144 double vv1z = vv1(2).val_point(r, theta, phi) ;
146 mp2.convert_absolute(x0, y, z, r, theta, phi) ;
147 double vv2y = vv2(1).val_point(r, theta, phi) ;
148 double vv2z = vv2(2).val_point(r, theta, phi) ;
150 vvy[ny*j+i] = float(vv1y + vv2y) ;
151 vvz[ny*j+i] = float(vv1z + vv2z) ;
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 = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
172 des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
173 scale, sizefl, nomy, nomz, title, device, newgraph) ;
181 if (defsurf1 != 0x0) {
183 assert(defsurf1->get_mp() == vv1.get_mp()) ;
184 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
188 if (defsurf2 != 0x0) {
190 assert(defsurf2->get_mp() == vv2.get_mp()) ;
191 newgraph = draw_bound ? 0 : 2 ;
201 int ndom1 = mp1.get_mg()->get_nzone() ;
202 int ndom2 = mp2.get_mg()->get_nzone() ;
204 for (
int l=0; l<ndom1-1; l++) {
210 for (
int l=0; l<ndom2-1; l++) {
213 newgraph = (l == ndom2-2) ? 2 : 0 ;
224void des_vect_bin_y(
const Tenseur& vv1,
const Tenseur& vv2,
double y0,
225 double scale,
double sizefl,
double x_min,
double x_max,
226 double z_min,
double z_max,
const char* title,
227 const Cmp* defsurf1,
const Cmp* defsurf2,
228 bool draw_bound,
int nx,
int nz) {
232 const Map& mp1 = *(vv1.get_mp()) ;
233 const Map& mp2 = *(vv2.get_mp()) ;
238 if (vv1.get_valence() != 1) {
240 "des_vect_bin_y: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
244 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
246 "des_vect_bin_y: the vector vv1 must be given in Cartesian components !"
251 if (vv2.get_valence() != 1) {
253 "des_vect_bin_y: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
257 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
259 "des_vect_bin_y: the vector vv2 must be given in Cartesian components !"
264 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
266 "des_vect_bin_y: the components of the two vectors are not defined"
267 << endl <<
"on the same triad !" << endl ;
274 float* vvx =
new float[nx*nz] ;
275 float* vvz =
new float[nx*nz] ;
277 double hx = (x_max - x_min) /
double(nx-1) ;
278 double hza = (z_max - z_min) /
double(nz-1) ;
280 for (
int j=0; j<nz; j++) {
282 double z = z_min + hza * j ;
284 for (
int i=0; i<nx; i++) {
286 double x = x_min + hx * i ;
288 double r, theta, phi ;
290 mp1.convert_absolute(x, y0, z, r, theta, phi) ;
291 double vv1x = vv1(0).val_point(r, theta, phi) ;
292 double vv1z = vv1(2).val_point(r, theta, phi) ;
294 mp2.convert_absolute(x, y0, z, r, theta, phi) ;
295 double vv2x = vv2(0).val_point(r, theta, phi) ;
296 double vv2z = vv2(2).val_point(r, theta, phi) ;
298 vvx[nx*j+i] = float(vv1x + vv2x) ;
299 vvz[nx*j+i] = float(vv1z + vv2z) ;
303 float xmin1 = float(x_min / km) ;
304 float xmax1 = float(x_max / km) ;
305 float zmin1 = float(z_min / km) ;
306 float zmax1 = float(z_max / km) ;
308 const char* nomx =
"x [km]" ;
309 const char* nomz =
"z [km]" ;
315 const char* device = 0x0 ;
316 int newgraph = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
319 des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
320 scale, sizefl, nomx, nomz, title, device, newgraph) ;
328 if (defsurf1 != 0x0) {
330 assert(defsurf1->get_mp() == vv1.get_mp()) ;
331 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
335 if (defsurf2 != 0x0) {
337 assert(defsurf2->get_mp() == vv2.get_mp()) ;
338 newgraph = draw_bound ? 0 : 2 ;
348 int ndom1 = mp1.get_mg()->get_nzone() ;
349 int ndom2 = mp2.get_mg()->get_nzone() ;
351 for (
int l=0; l<ndom1-1; l++) {
357 for (
int l=0; l<ndom2-1; l++) {
360 newgraph = (l == ndom2-2) ? 2 : 0 ;
371void des_vect_bin_z(
const Tenseur& vv1,
const Tenseur& vv2,
double z0,
372 double scale,
double sizefl,
double x_min,
double x_max,
373 double y_min,
double y_max,
const char* title,
374 const Cmp* defsurf1,
const Cmp* defsurf2,
375 bool draw_bound,
int nx,
int ny) {
379 const Map& mp1 = *(vv1.get_mp()) ;
380 const Map& mp2 = *(vv2.get_mp()) ;
385 if (vv1.get_valence() != 1) {
387 "des_vect_bin_z: the Tenseur vv1 must be of valence 1 (vector) !" << endl ;
391 if ( vv1.get_triad()->identify() != mp1.get_bvect_cart().identify() ) {
393 "des_vect_bin_z: the vector vv1 must be given in Cartesian components !"
398 if (vv2.get_valence() != 1) {
400 "des_vect_bin_z: the Tenseur vv2 must be of valence 1 (vector) !" << endl ;
404 if ( vv2.get_triad()->identify() != mp2.get_bvect_cart().identify() ) {
406 "des_vect_bin_z: the vector vv2 must be given in Cartesian components !"
411 if ( *(vv1.get_triad()) != *(vv2.get_triad()) ) {
413 "des_vect_bin_z: the components of the two vectors are not defined"
414 << endl <<
"on the same triad !" << endl ;
421 float* vvx =
new float[nx*ny] ;
422 float* vvy =
new float[nx*ny] ;
424 double hx = (x_max - x_min) /
double(nx-1) ;
425 double hy = (y_max - y_min) /
double(ny-1) ;
427 for (
int j=0; j<ny; j++) {
429 double y = y_min + hy * j ;
431 for (
int i=0; i<nx; i++) {
433 double x = x_min + hx * i ;
435 double r, theta, phi ;
437 mp1.convert_absolute(x, y, z0, r, theta, phi) ;
438 double vv1x = vv1(0).val_point(r, theta, phi) ;
439 double vv1y = vv1(1).val_point(r, theta, phi) ;
441 mp2.convert_absolute(x, y, z0, r, theta, phi) ;
442 double vv2x = vv2(0).val_point(r, theta, phi) ;
443 double vv2y = vv2(1).val_point(r, theta, phi) ;
445 vvx[nx*j+i] = float(vv1x + vv2x) ;
446 vvy[nx*j+i] = float(vv1y + vv2y) ;
450 float xmin1 = float(x_min / km) ;
451 float xmax1 = float(x_max / km) ;
452 float ymin1 = float(y_min / km) ;
453 float ymax1 = float(y_max / km) ;
455 const char* nomx =
"x [km]" ;
456 const char* nomy =
"y [km]" ;
462 const char* device = 0x0 ;
463 int newgraph = ( (defsurf1 != 0x0) || (defsurf2 != 0x0) || draw_bound ) ?
466 des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
467 scale, sizefl, nomx, nomy, title, device, newgraph) ;
475 if (defsurf1 != 0x0) {
477 assert(defsurf1->get_mp() == vv1.get_mp()) ;
478 newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ;
482 if (defsurf2 != 0x0) {
484 assert(defsurf2->get_mp() == vv2.get_mp()) ;
485 newgraph = draw_bound ? 0 : 2 ;
495 int ndom1 = mp1.get_mg()->get_nzone() ;
496 int ndom2 = mp2.get_mg()->get_nzone() ;
498 for (
int l=0; l<ndom1-1; l++) {
504 for (
int l=0; l<ndom2-1; l++) {
507 newgraph = (l == ndom2-2) ? 2 : 0 ;
void des_domaine_x(const Map &mp, int l0, double x0, const char *device=0x0, int newgraph=3, double y_min=-1, double y_max=1, double z_min=-1, double z_max=1, const char *nomy=0x0, const char *nomz=0x0, const char *title=0x0, int nxpage=1, int nypage=1)
Basic routine for drawing the outer boundary of a given domain in a plane X=constant.
void des_domaine_y(const Map &mp, int l0, double y0, const char *device=0x0, int newgraph=3, double x_min=-1, double x_max=1, double z_min=-1, double z_max=1, const char *nomx=0x0, const char *nomz=0x0, const char *title=0x0, int nxpage=1, int nypage=1)
Basic routine for drawing the outer boundary of a given domain in a plane Y=constant.
void des_domaine_z(const Map &mp, int l0, double z0, const char *device=0x0, int newgraph=3, double x_min=-1, double x_max=1, double y_min=-1, double y_max=1, const char *nomx=0x0, const char *nomz=0x0, const char *title=0x0, int nxpage=1, int nypage=1)
Basic routine for drawing the outer boundary of a given domain in a plane Z=constant.
void des_vect(float *vvx, float *vvy, int nx, int ny, float xmin, float xmax, float ymin, float ymax, double scale, double sizefl, const char *nomx, const char *nomy, const char *title, const char *device=0x0, int newgraph=3, int nxpage=1, int nypage=1)
Basic routine for plotting vector field.
void des_surface_x(const Scalar &defsurf, double x0, const char *device=0x0, int newgraph=3, double y_min=-1, double y_max=1, double z_min=-1, double z_max=1, const char *nomy=0x0, const char *nomz=0x0, const char *title=0x0, int nxpage=1, int nypage=1)
Basic routine for drawing a stellar surface in a plane X=constant.
void des_surface_y(const Scalar &defsurf, double y0, const char *device=0x0, int newgraph=3, double x_min=-1, double x_max=1, double z_min=-1, double z_max=1, const char *nomx=0x0, const char *nomz=0x0, const char *title=0x0, int nxpage=1, int nypage=1)
Basic routine for drawing a stellar surface in a plane Y=constant.
void des_surface_z(const Scalar &defsurf, double z0, const char *device=0x0, int newgraph=3, double x_min=-1, double x_max=1, double y_min=-1, double y_max=1, const char *nomx=0x0, const char *nomz=0x0, const char *title=0x0, int nxpage=1, int nypage=1)
Basic routine for drawing a stellar surface in a plane Z=constant.
void des_vect_bin_x(const Tenseur &vv1, const Tenseur &vv2, double x0, double scale, double sizefl, double y_min, double y_max, double z_min, double z_max, const char *title, const Cmp *defsurf1=0x0, const Cmp *defsurf2=0x0, bool draw_bound=true, int ny=20, int nz=20)
Plots the sum of two vectors in a plane X=constant.
void des_vect_bin_y(const Tenseur &vv1, const Tenseur &vv2, double x0, double scale, double sizefl, double x_min, double x_max, double z_min, double z_max, const char *title, const Cmp *defsurf1=0x0, const Cmp *defsurf2=0x0, bool draw_bound=true, int nx=20, int nz=20)
Plots the sum of two vectors in a plane Y=constant.
void des_vect_bin_z(const Tenseur &vv1, const Tenseur &vv2, double x0, double scale, double sizefl, double x_min, double x_max, double y_min, double y_max, const char *title, const Cmp *defsurf1=0x0, const Cmp *defsurf2=0x0, bool draw_bound=true, int nx=20, int ny=20)
Plots the sum of two vectors in a plane Z=constant.
Standard units of space, time and mass.