23char des_coupe_vector_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_vector.C,v 1.4 2014/10/13 08:53:22 j_novak Exp $" ;
54#include "utilitaires.h"
60void des_coupe_vect_x(
const Vector& vv,
double x0,
double scale,
double sizefl,
61 int nzdes,
const char* title,
const Scalar* defsurf,
double zoom,
62 bool draw_bound,
int ny,
int nz) {
64 const Map& mp = vv.get_mp() ;
66 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
67 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
68 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
69 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
71 ray = ( a1 > ray ) ? a1 : ray ;
72 ray = ( a2 > ray ) ? a2 : ray ;
73 ray = ( a3 > ray ) ? a3 : ray ;
77 double y_min = mp.get_ori_y() - ray ;
78 double y_max = mp.get_ori_y() + ray ;
79 double z_min = mp.get_ori_z() - ray ;
80 double z_max = mp.get_ori_z() + ray ;
83 defsurf, draw_bound, ny, nz) ;
92 sizefl,
double y_min,
double y_max,
double z_min,
93 double z_max,
const char* title,
const Scalar* defsurf,
94 bool draw_bound,
int ny,
int nz) {
98 const Map& mp = vv.get_mp() ;
100 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
102 "des_coupe_vect_x: the vector must be given in Cartesian components !"
111 float* vvy =
new float[ny*nz] ;
112 float* vvz =
new float[ny*nz] ;
114 double hy = (y_max - y_min) /
double(ny-1) ;
115 double hza = (z_max - z_min) /
double(nz-1) ;
117 for (
int j=0; j<nz; j++) {
119 double z = z_min + hza * j ;
121 for (
int i=0; i<ny; i++) {
123 double y = y_min + hy * i ;
126 double r, theta, phi ;
127 mp.convert_absolute(x0, y, z, r, theta, phi) ;
129 vvy[ny*j+i] = float(vv(2).val_point(r, theta, phi)) ;
130 vvz[ny*j+i] = float(vv(3).val_point(r, theta, phi)) ;
135 float ymin1 = float(y_min / km) ;
136 float ymax1 = float(y_max / km) ;
137 float zmin1 = float(z_min / km) ;
138 float zmax1 = float(z_max / km) ;
140 const char* nomy =
"y [km]" ;
141 const char* nomz =
"z [km]" ;
147 const char* device = 0x0 ;
148 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
150 des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
151 scale, sizefl, nomy, nomz, title, device, newgraph) ;
160 if (defsurf != 0x0) {
162 assert( &(defsurf->get_mp()) == &mp ) ;
164 newgraph = draw_bound ? 0 : 2 ;
176 int ndom = mp.get_mg()->get_nzone() ;
178 for (
int l=0; l<ndom-1; l++) {
181 newgraph = (l == ndom-2) ? 2 : 0 ;
194void des_coupe_vect_y(
const Vector& vv,
double y0,
double scale,
double sizefl,
195 int nzdes,
const char* title,
const Scalar* defsurf,
double zoom,
196 bool draw_bound,
int nx,
int nz) {
198 const Map& mp = vv.get_mp() ;
200 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
201 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
202 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
203 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
205 ray = ( a1 > ray ) ? a1 : ray ;
206 ray = ( a2 > ray ) ? a2 : ray ;
207 ray = ( a3 > ray ) ? a3 : ray ;
211 double x_min = mp.get_ori_x() - ray ;
212 double x_max = mp.get_ori_x() + ray ;
213 double z_min = mp.get_ori_z() - ray ;
214 double z_max = mp.get_ori_z() + ray ;
218 defsurf, draw_bound, nx, nz) ;
227 sizefl,
double x_min,
double x_max,
double z_min,
228 double z_max,
const char* title,
const Scalar* defsurf,
229 bool draw_bound,
int nx,
int nz) {
233 const Map& mp = vv.get_mp() ;
235 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
237 "des_coupe_vect_y: the vector must be given in Cartesian components !"
246 float* vvx =
new float[nx*nz] ;
247 float* vvz =
new float[nx*nz] ;
249 double hx = (x_max - x_min) /
double(nx-1) ;
250 double hza = (z_max - z_min) /
double(nz-1) ;
252 for (
int j=0; j<nz; j++) {
254 double z = z_min + hza * j ;
256 for (
int i=0; i<nx; i++) {
258 double x = x_min + hx * i ;
261 double r, theta, phi ;
262 mp.convert_absolute(x, y0, z, r, theta, phi) ;
264 vvx[nx*j+i] = float(vv(1).val_point(r, theta, phi)) ;
265 vvz[nx*j+i] = float(vv(3).val_point(r, theta, phi)) ;
270 float xmin1 = float(x_min / km) ;
271 float xmax1 = float(x_max / km) ;
272 float zmin1 = float(z_min / km) ;
273 float zmax1 = float(z_max / km) ;
275 const char* nomx =
"x [km]" ;
276 const char* nomz =
"z [km]" ;
283 const char* device = 0x0 ;
284 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
286 des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
287 scale, sizefl, nomx, nomz, title, device, newgraph) ;
296 if (defsurf != 0x0) {
298 assert( &(defsurf->get_mp()) == &mp ) ;
300 newgraph = draw_bound ? 0 : 2 ;
312 int ndom = mp.get_mg()->get_nzone() ;
314 for (
int l=0; l<ndom-1; l++) {
317 newgraph = (l == ndom-2) ? 2 : 0 ;
329void des_coupe_vect_z(
const Vector& vv,
double z0,
double scale,
double sizefl,
330 int nzdes,
const char* title,
const Scalar* defsurf,
double zoom,
331 bool draw_bound,
int nx,
int ny) {
333 const Map& mp = vv.get_mp() ;
335 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
336 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
337 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
338 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
340 ray = ( a1 > ray ) ? a1 : ray ;
341 ray = ( a2 > ray ) ? a2 : ray ;
342 ray = ( a3 > ray ) ? a3 : ray ;
346 double x_min = mp.get_ori_x() - ray ;
347 double x_max = mp.get_ori_x() + ray ;
348 double y_min = mp.get_ori_y() - ray ;
349 double y_max = mp.get_ori_y() + ray ;
352 defsurf, draw_bound, nx, ny) ;
361 sizefl,
double x_min,
double x_max,
double y_min,
362 double y_max,
const char* title,
const Scalar* defsurf,
363 bool draw_bound,
int nx,
int ny) {
367 const Map& mp = vv.get_mp() ;
369 if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
371 "des_coupe_vect_y: the vector must be given in Cartesian components !"
380 float* vvx =
new float[nx*ny] ;
381 float* vvy =
new float[nx*ny] ;
383 double hy = (y_max - y_min) /
double(ny-1) ;
384 double hx = (x_max - x_min) /
double(nx-1) ;
386 for (
int j=0; j<ny; j++) {
388 double y = y_min + hy * j ;
390 for (
int i=0; i<nx; i++) {
392 double x = x_min + hx * i ;
395 double r, theta, phi ;
396 mp.convert_absolute(x, y, z0, r, theta, phi) ;
398 vvx[nx*j+i] = float(vv(1).val_point(r, theta, phi)) ;
399 vvy[nx*j+i] = float(vv(2).val_point(r, theta, phi)) ;
404 float ymin1 = float(y_min / km) ;
405 float ymax1 = float(y_max / km) ;
406 float xmin1 = float(x_min / km) ;
407 float xmax1 = float(x_max / km) ;
409 const char* nomy =
"y [km]" ;
410 const char* nomx =
"x [km]" ;
416 const char* device = 0x0 ;
417 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
419 des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
420 scale, sizefl, nomx, nomy, title, device, newgraph) ;
429 if (defsurf != 0x0) {
431 assert( &(defsurf->get_mp()) == &mp ) ;
433 newgraph = draw_bound ? 0 : 2 ;
444 int ndom = mp.get_mg()->get_nzone() ;
446 for (
int l=0; l<ndom-1; l++) {
449 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.