67 #include "graphique.h" 69 #include "utilitaires.h" 75 void 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 ;
98 defsurf, draw_bound, ny, nz) ;
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) {
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 ;
197 int ndom = mp.get_mg()->get_nzone() ;
199 for (
int l=0; l<ndom-1; l++) {
202 newgraph = (l == ndom-2) ? 2 : 0 ;
215 void 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 ;
239 defsurf, draw_bound, nx, nz) ;
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) {
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 ;
339 int ndom = mp.get_mg()->get_nzone() ;
341 for (
int l=0; l<ndom-1; l++) {
344 newgraph = (l == ndom-2) ? 2 : 0 ;
356 void 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 ;
379 defsurf, draw_bound, nx, ny) ;
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) {
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 ;
477 int ndom = mp.get_mg()->get_nzone() ;
479 for (
int l=0; l<ndom-1; l++) {
482 newgraph = (l == ndom-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_coupe_vect_x(const Vector &vv, double x0, double scale, double sizefl, int nzdes, const char *title=0x0, const Scalar *defsurf=0x0, double zoom=1.2, bool draw_bound=true, int ny=20, int nz=20)
Plots a vector field in a plane X=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_coupe_vect_y(const Vector &vv, double y0, double scale, double sizefl, int nzdes, const char *title=0x0, const Scalar *defsurf=0x0, double zoom=1.2, bool draw_bound=true, int nx=20, int nz=20)
Plots a vector field in a plane Y=constant.
void des_coupe_vect_z(const Vector &vv, double z0, double scale, double sizefl, int nzdes, const char *title=0x0, const Scalar *defsurf=0x0, double zoom=1.2, bool draw_bound=true, int nx=20, int ny=20)
Plots a vector field 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_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.