23char des_coupe_vect_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_vect.C,v 1.6 2014/10/13 08:53:22 j_novak Exp $" ;
66#include "utilitaires.h"
72void des_coupe_vect_x(
const Tenseur& vv,
double x0,
double scale,
double sizefl,
73 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
74 bool draw_bound,
int ny,
int nz) {
76 const Map& mp = *(vv.get_mp()) ;
78 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
79 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
80 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
81 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
83 ray = ( a1 > ray ) ? a1 : ray ;
84 ray = ( a2 > ray ) ? a2 : ray ;
85 ray = ( a3 > ray ) ? a3 : ray ;
89 double y_min = mp.get_ori_y() - ray ;
90 double y_max = mp.get_ori_y() + ray ;
91 double z_min = mp.get_ori_z() - ray ;
92 double z_max = mp.get_ori_z() + ray ;
95 defsurf, draw_bound, ny, nz) ;
104 sizefl,
double y_min,
double y_max,
double z_min,
105 double z_max,
const char* title,
const Cmp* defsurf,
106 bool draw_bound,
int ny,
int nz) {
110 const Map& mp = *(vv.get_mp()) ;
112 if (vv.get_valence() != 1) {
114 "des_coupe_vect_x: the Tenseur must be of valence 1 (vector) !" << endl ;
118 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
120 "des_coupe_vect_x: the vector must be given in Cartesian components !"
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 ;
144 double r, theta, phi ;
145 mp.convert_absolute(x0, y, z, r, theta, phi) ;
147 vvy[ny*j+i] = float(vv(1).val_point(r, theta, phi)) ;
148 vvz[ny*j+i] = float(vv(2).val_point(r, theta, phi)) ;
153 float ymin1 = float(y_min / km) ;
154 float ymax1 = float(y_max / km) ;
155 float zmin1 = float(z_min / km) ;
156 float zmax1 = float(z_max / km) ;
158 const char* nomy =
"y [km]" ;
159 const char* nomz =
"z [km]" ;
165 const char* device = 0x0 ;
166 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
168 des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
169 scale, sizefl, nomy, nomz, title, device, newgraph) ;
178 if (defsurf != 0x0) {
180 assert(defsurf->get_mp() == vv.get_mp()) ;
182 newgraph = draw_bound ? 0 : 2 ;
194 int ndom = mp.get_mg()->get_nzone() ;
196 for (
int l=0; l<ndom-1; l++) {
199 newgraph = (l == ndom-2) ? 2 : 0 ;
212void des_coupe_vect_y(
const Tenseur& vv,
double y0,
double scale,
double sizefl,
213 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
214 bool draw_bound,
int nx,
int nz) {
216 const Map& mp = *(vv.get_mp()) ;
218 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
219 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
220 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
221 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
223 ray = ( a1 > ray ) ? a1 : ray ;
224 ray = ( a2 > ray ) ? a2 : ray ;
225 ray = ( a3 > ray ) ? a3 : ray ;
229 double x_min = mp.get_ori_x() - ray ;
230 double x_max = mp.get_ori_x() + ray ;
231 double z_min = mp.get_ori_z() - ray ;
232 double z_max = mp.get_ori_z() + ray ;
236 defsurf, draw_bound, nx, nz) ;
245 sizefl,
double x_min,
double x_max,
double z_min,
246 double z_max,
const char* title,
const Cmp* defsurf,
247 bool draw_bound,
int nx,
int nz) {
251 const Map& mp = *(vv.get_mp()) ;
253 if (vv.get_valence() != 1) {
255 "des_coupe_vect_y: the Tenseur must be of valence 1 (vector) !" << endl ;
259 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
261 "des_coupe_vect_y: the vector must be given in Cartesian components !"
270 float* vvx =
new float[nx*nz] ;
271 float* vvz =
new float[nx*nz] ;
273 double hx = (x_max - x_min) /
double(nx-1) ;
274 double hza = (z_max - z_min) /
double(nz-1) ;
276 for (
int j=0; j<nz; j++) {
278 double z = z_min + hza * j ;
280 for (
int i=0; i<nx; i++) {
282 double x = x_min + hx * i ;
285 double r, theta, phi ;
286 mp.convert_absolute(x, y0, z, r, theta, phi) ;
288 vvx[nx*j+i] = float(vv(0).val_point(r, theta, phi)) ;
289 vvz[nx*j+i] = float(vv(2).val_point(r, theta, phi)) ;
294 float xmin1 = float(x_min / km) ;
295 float xmax1 = float(x_max / km) ;
296 float zmin1 = float(z_min / km) ;
297 float zmax1 = float(z_max / km) ;
299 const char* nomx =
"x [km]" ;
300 const char* nomz =
"z [km]" ;
307 const char* device = 0x0 ;
308 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
310 des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
311 scale, sizefl, nomx, nomz, title, device, newgraph) ;
320 if (defsurf != 0x0) {
322 assert(defsurf->get_mp() == vv.get_mp()) ;
324 newgraph = draw_bound ? 0 : 2 ;
336 int ndom = mp.get_mg()->get_nzone() ;
338 for (
int l=0; l<ndom-1; l++) {
341 newgraph = (l == ndom-2) ? 2 : 0 ;
353void des_coupe_vect_z(
const Tenseur& vv,
double z0,
double scale,
double sizefl,
354 int nzdes,
const char* title,
const Cmp* defsurf,
double zoom,
355 bool draw_bound,
int nx,
int ny) {
357 const Map& mp = *(vv.get_mp()) ;
359 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
360 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
361 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
362 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
364 ray = ( a1 > ray ) ? a1 : ray ;
365 ray = ( a2 > ray ) ? a2 : ray ;
366 ray = ( a3 > ray ) ? a3 : ray ;
370 double x_min = mp.get_ori_x() - ray ;
371 double x_max = mp.get_ori_x() + ray ;
372 double y_min = mp.get_ori_y() - ray ;
373 double y_max = mp.get_ori_y() + ray ;
376 defsurf, draw_bound, nx, ny) ;
385 sizefl,
double x_min,
double x_max,
double y_min,
386 double y_max,
const char* title,
const Cmp* defsurf,
387 bool draw_bound,
int nx,
int ny) {
391 const Map& mp = *(vv.get_mp()) ;
393 if (vv.get_valence() != 1) {
395 "des_coupe_vect_y: the Tenseur must be of valence 1 (vector) !" << endl ;
399 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
401 "des_coupe_vect_y: the vector must be given in Cartesian components !"
410 float* vvx =
new float[nx*ny] ;
411 float* vvy =
new float[nx*ny] ;
413 double hy = (y_max - y_min) /
double(ny-1) ;
414 double hx = (x_max - x_min) /
double(nx-1) ;
416 for (
int j=0; j<ny; j++) {
418 double y = y_min + hy * j ;
420 for (
int i=0; i<nx; i++) {
422 double x = x_min + hx * i ;
425 double r, theta, phi ;
426 mp.convert_absolute(x, y, z0, r, theta, phi) ;
428 vvx[nx*j+i] = float(vv(0).val_point(r, theta, phi)) ;
429 vvy[nx*j+i] = float(vv(1).val_point(r, theta, phi)) ;
434 float ymin1 = float(y_min / km) ;
435 float ymax1 = float(y_max / km) ;
436 float xmin1 = float(x_min / km) ;
437 float xmax1 = float(x_max / km) ;
439 const char* nomy =
"y [km]" ;
440 const char* nomx =
"x [km]" ;
446 const char* device = 0x0 ;
447 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
449 des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
450 scale, sizefl, nomx, nomy, title, device, newgraph) ;
459 if (defsurf != 0x0) {
461 assert(defsurf->get_mp() == vv.get_mp()) ;
463 newgraph = draw_bound ? 0 : 2 ;
474 int ndom = mp.get_mg()->get_nzone() ;
476 for (
int l=0; l<ndom-1; l++) {
479 newgraph = (l == ndom-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_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_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_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.
Standard units of space, time and mass.