70 #include "graphique.h" 72 #include "utilitaires.h" 78 void 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) {
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 ;
191 if (defsurf2 != 0x0) {
193 assert(defsurf2->get_mp() == vv2.get_mp()) ;
194 newgraph = draw_bound ? 0 : 2 ;
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++) {
213 for (
int l=0; l<ndom2-1; l++) {
216 newgraph = (l == ndom2-2) ? 2 : 0 ;
227 void 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) {
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 ;
338 if (defsurf2 != 0x0) {
340 assert(defsurf2->get_mp() == vv2.get_mp()) ;
341 newgraph = draw_bound ? 0 : 2 ;
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++) {
360 for (
int l=0; l<ndom2-1; l++) {
363 newgraph = (l == ndom2-2) ? 2 : 0 ;
374 void 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) {
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 ;
485 if (defsurf2 != 0x0) {
487 assert(defsurf2->get_mp() == vv2.get_mp()) ;
488 newgraph = draw_bound ? 0 : 2 ;
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++) {
507 for (
int l=0; l<ndom2-1; l++) {
510 newgraph = (l == ndom2-2) ? 2 : 0 ;
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_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_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_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.
Standard units of space, time and mass.
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_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_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, int newgraph, int nxpage, int nypage)
Basic routine for plotting vector field.
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_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.
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.