55 #include "graphique.h"    57 #include "utilitaires.h"    63 void des_coupe_vect_x(
const Vector& vv, 
double x0, 
double scale, 
double sizefl,
    64               int nzdes, 
const char* title, 
const Scalar* defsurf, 
double zoom, 
    65               bool draw_bound, 
int ny, 
int nz) {
    67     const Map& mp = vv.get_mp() ; 
    69     double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;         
    70     double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;        
    71     double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;       
    72     double ray = mp.val_r(nzdes-1, 1., 0., 0.) ; 
    74     ray = ( a1 > ray ) ? a1 : ray ; 
    75     ray = ( a2 > ray ) ? a2 : ray ; 
    76     ray = ( a3 > ray ) ? a3 : ray ; 
    80     double y_min = mp.get_ori_y() - ray ; 
    81     double y_max = mp.get_ori_y() + ray ; 
    82     double z_min = mp.get_ori_z() - ray ; 
    83     double z_max = mp.get_ori_z() + ray ; 
    86             defsurf, draw_bound, ny, nz) ;
    95               sizefl, 
double y_min, 
double y_max, 
double z_min, 
    96               double z_max, 
const char* title, 
const Scalar* defsurf, 
    97               bool draw_bound, 
int ny, 
int nz) {
   101     const Map& mp = vv.get_mp() ; 
   103     if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
   105     "des_coupe_vect_x: the vector must be given in Cartesian components !"    114     float* vvy = 
new float[ny*nz] ; 
   115     float* vvz = 
new float[ny*nz] ; 
   117     double hy = (y_max - y_min) / 
double(ny-1) ; 
   118     double hza = (z_max - z_min) / 
double(nz-1) ; 
   120     for (
int j=0; j<nz; j++) {
   122     double z = z_min + hza * j ; 
   124     for (
int i=0; i<ny; i++) {
   126         double y = y_min + hy * i ; 
   129         double r, theta, phi ; 
   130         mp.convert_absolute(x0, y, z, r, theta, phi) ; 
   132         vvy[ny*j+i] = float(vv(2).val_point(r, theta, phi)) ; 
   133         vvz[ny*j+i] = float(vv(3).val_point(r, theta, phi)) ; 
   138     float ymin1 = float(y_min / km) ;
   139     float ymax1 = float(y_max / km) ;
   140     float zmin1 = float(z_min / km) ;
   141     float zmax1 = float(z_max / km) ;
   143     const char* nomy = 
"y [km]" ; 
   144     const char* nomz = 
"z [km]" ; 
   150     const char* device = 0x0 ; 
   151     int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ; 
   153     des_vect(vvy, vvz, ny, nz, ymin1, ymax1, zmin1, zmax1,
   154          scale,  sizefl, nomy, nomz, title, device, newgraph) ; 
   163     if (defsurf != 0x0) {
   165     assert( &(defsurf->get_mp()) == &mp ) ; 
   167     newgraph = draw_bound ? 0 : 2 ;  
   179     int ndom = mp.get_mg()->get_nzone() ;  
   181     for (
int l=0; l<ndom-1; l++) {  
   184         newgraph = (l == ndom-2) ? 2 : 0 ; 
   197 void des_coupe_vect_y(
const Vector& vv, 
double y0, 
double scale, 
double sizefl,
   198               int nzdes, 
const char* title, 
const Scalar* defsurf, 
double zoom, 
   199               bool draw_bound, 
int nx, 
int nz) {
   201     const Map& mp = vv.get_mp() ; 
   203     double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;         
   204     double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;        
   205     double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;       
   206     double ray = mp.val_r(nzdes-1, 1., 0., 0.) ; 
   208     ray = ( a1 > ray ) ? a1 : ray ; 
   209     ray = ( a2 > ray ) ? a2 : ray ; 
   210     ray = ( a3 > ray ) ? a3 : ray ; 
   214     double x_min = mp.get_ori_x() - ray ; 
   215     double x_max = mp.get_ori_x() + ray ; 
   216     double z_min = mp.get_ori_z() - ray ; 
   217     double z_max = mp.get_ori_z() + ray ; 
   221             defsurf, draw_bound, nx, nz) ;
   230               sizefl, 
double x_min, 
double x_max, 
double z_min, 
   231               double z_max, 
const char* title, 
const Scalar* defsurf, 
   232               bool draw_bound, 
int nx, 
int nz) {
   236     const Map& mp = vv.get_mp() ; 
   238     if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
   240     "des_coupe_vect_y: the vector must be given in Cartesian components !"    249     float* vvx = 
new float[nx*nz] ; 
   250     float* vvz = 
new float[nx*nz] ; 
   252     double hx = (x_max - x_min) / 
double(nx-1) ; 
   253     double hza = (z_max - z_min) / 
double(nz-1) ; 
   255     for (
int j=0; j<nz; j++) {
   257     double z = z_min + hza * j ; 
   259     for (
int i=0; i<nx; i++) {
   261         double x = x_min + hx * i ; 
   264         double r, theta, phi ; 
   265         mp.convert_absolute(x, y0, z, r, theta, phi) ; 
   267         vvx[nx*j+i] = float(vv(1).val_point(r, theta, phi)) ; 
   268         vvz[nx*j+i] = float(vv(3).val_point(r, theta, phi)) ; 
   273     float xmin1 = float(x_min / km) ;
   274     float xmax1 = float(x_max / km) ;
   275     float zmin1 = float(z_min / km) ;
   276     float zmax1 = float(z_max / km) ;
   278     const char* nomx = 
"x [km]" ; 
   279     const char* nomz = 
"z [km]" ; 
   286     const char* device = 0x0 ; 
   287     int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ; 
   289     des_vect(vvx, vvz, nx, nz, xmin1, xmax1, zmin1, zmax1,
   290          scale,  sizefl, nomx, nomz, title, device, newgraph) ; 
   299     if (defsurf != 0x0) {
   301     assert( &(defsurf->get_mp()) == &mp ) ; 
   303     newgraph = draw_bound ? 0 : 2 ;  
   315     int ndom = mp.get_mg()->get_nzone() ;  
   317     for (
int l=0; l<ndom-1; l++) {  
   320         newgraph = (l == ndom-2) ? 2 : 0 ; 
   332 void des_coupe_vect_z(
const Vector& vv, 
double z0, 
double scale, 
double sizefl,
   333               int nzdes, 
const char* title, 
const Scalar* defsurf, 
double zoom, 
   334               bool draw_bound, 
int nx, 
int ny) {
   336     const Map& mp = vv.get_mp() ; 
   338     double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;         
   339     double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;        
   340     double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;       
   341     double ray = mp.val_r(nzdes-1, 1., 0., 0.) ; 
   343     ray = ( a1 > ray ) ? a1 : ray ; 
   344     ray = ( a2 > ray ) ? a2 : ray ; 
   345     ray = ( a3 > ray ) ? a3 : ray ; 
   349     double x_min = mp.get_ori_x() - ray ; 
   350     double x_max = mp.get_ori_x() + ray ; 
   351     double y_min = mp.get_ori_y() - ray ; 
   352     double y_max = mp.get_ori_y() + ray ; 
   355             defsurf, draw_bound, nx, ny) ;
   364               sizefl, 
double x_min, 
double x_max, 
double y_min, 
   365               double y_max, 
const char* title, 
const Scalar* defsurf, 
   366               bool draw_bound, 
int nx, 
int ny) {
   370     const Map& mp = vv.get_mp() ; 
   372     if ( vv.get_triad()->identify() != mp.get_bvect_cart().identify() ) {
   374     "des_coupe_vect_y: the vector must be given in Cartesian components !"    383     float* vvx = 
new float[nx*ny] ; 
   384     float* vvy = 
new float[nx*ny] ; 
   386     double hy = (y_max - y_min) / 
double(ny-1) ; 
   387     double hx = (x_max - x_min) / 
double(nx-1) ; 
   389     for (
int j=0; j<ny; j++) {
   391     double y = y_min + hy * j ; 
   393     for (
int i=0; i<nx; i++) {
   395         double x = x_min + hx * i ; 
   398         double r, theta, phi ; 
   399         mp.convert_absolute(x, y, z0, r, theta, phi) ; 
   401         vvx[nx*j+i] = float(vv(1).val_point(r, theta, phi)) ; 
   402         vvy[nx*j+i] = float(vv(2).val_point(r, theta, phi)) ; 
   407     float ymin1 = float(y_min / km) ;
   408     float ymax1 = float(y_max / km) ;
   409     float xmin1 = float(x_min / km) ;
   410     float xmax1 = float(x_max / km) ;
   412     const char* nomy = 
"y [km]" ; 
   413     const char* nomx = 
"x [km]" ; 
   419     const char* device = 0x0 ; 
   420     int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ; 
   422     des_vect(vvx, vvy, nx, ny, xmin1, xmax1, ymin1, ymax1,
   423          scale,  sizefl, nomx, nomy, title, device, newgraph) ; 
   432     if (defsurf != 0x0) {
   434     assert( &(defsurf->get_mp()) == &mp ) ; 
   436     newgraph = draw_bound ? 0 : 2 ;  
   447     int ndom = mp.get_mg()->get_nzone() ;  
   449     for (
int l=0; l<ndom-1; l++) {  
   452         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.