89 #include "graphique.h" 96 void des_profile(
const Scalar& uu,
double r_min,
double r_max,
97 double theta,
double phi,
const char* nomy,
const char* title,
101 const int npt = 400 ;
105 double hr = (r_max - r_min) /
double(npt-1) ;
107 for (
int i=0; i<npt; i++) {
109 double r = hr * i + r_min ;
111 uutab[i] = float(uu.val_point(r, theta, phi)) ;
115 float xmin = float(r_min) ;
116 float xmax = float(r_max) ;
118 const char* nomx =
"r" ;
130 const Map& mp = uu.get_mp() ;
131 int nz = mp.get_mg()->get_nzone() ;
132 int l_max = (mp.get_mg()->get_type_r(nz-1) == UNSURR) ? nz-2 : nz-1 ;
134 float* xbound =
new float[l_max+1] ;
138 const double xi_max = 1. ;
139 for (
int l=0; l<=l_max; l++) {
141 double rb = mp.val_r(l, xi_max, theta, phi) ;
143 if ((rb >= r_min) && (rb <= r_max)) {
144 xbound[nbound] = float(rb) ;
150 des_profile(uutab, npt, xmin, xmax, nomx, nomy, title, 0x0,
159 void des_profile(
const Scalar& uu,
double r_min,
double r_max,
double scale,
160 double theta,
double phi,
const char* nomx,
const char* nomy,
161 const char* title,
bool draw_bound) {
164 const int npt = 400 ;
168 double hr = (r_max - r_min) /
double(npt-1) ;
170 for (
int i=0; i<npt; i++) {
172 double r = hr * i + r_min ;
174 uutab[i] = float(uu.val_point(r, theta, phi)) ;
178 float xmin = float(r_min * scale) ;
179 float xmax = float(r_max * scale) ;
196 const Map& mp = uu.get_mp() ;
197 int nz = mp.get_mg()->get_nzone() ;
198 int l_max = (mp.get_mg()->get_type_r(nz-1) == UNSURR) ? nz-2 : nz-1 ;
200 float* xbound =
new float[l_max+1] ;
204 const double xi_max = 1. ;
205 for (
int l=0; l<=l_max; l++) {
207 double rb = mp.val_r(l, xi_max, theta, phi) ;
209 if ((rb >= r_min) && (rb <= r_max)) {
210 xbound[nbound] = float(rb) ;
218 des_profile(uutab, npt, xmin, xmax, nomx, nomy, title, 0x0,
228 void des_profile_mult(
const Scalar** uu,
int nprof,
double r_min,
double r_max,
229 const double* theta,
const double* phi,
double radial_scale,
230 bool closeit,
const char* nomy,
const char* title,
int ngraph,
231 const char* nomx,
const int* line_style,
const char* device,
236 if ((device[0] ==
'/') && (device[1] ==
'n')) return ;
239 const int npt = 400 ;
242 float* uutab =
new float[npt*nprof] ;
245 double hr = (r_max - r_min) /
double(npt-1) ;
247 for (
int i=0; i<npt; i++) {
248 rr[i] = hr * i + r_min ;
252 for (
int j=0; j<nprof; j++) {
254 const Scalar& vv = *(uu[j]) ;
256 for (
int i=0; i<npt; i++) {
257 uutab[j*npt+i] = float(vv.val_point(rr[i], theta[j], phi[j])) ;
262 float xmin = float(radial_scale * r_min) ;
263 float xmax = float(radial_scale * r_max) ;
265 if (nomx == 0x0) nomx =
"r" ;
267 if (nomy == 0x0) nomy =
"" ;
269 if (title == 0x0) title =
"" ;
274 int nbound_max = 100 * nprof ;
275 float* xbound =
new float[nbound_max] ;
279 const double xi_max = 1. ;
280 for (
int j=0; j<nprof; j++) {
282 const Map& mp = uu[j]->get_mp() ;
283 int nz = mp.get_mg()->get_nzone() ;
284 int l_max = (mp.get_mg()->get_type_r(nz-1) == UNSURR) ? nz-2 : nz-1 ;
286 for (
int l=0; l<=l_max; l++) {
288 double rb = mp.val_r(l, xi_max, theta[j], phi[j]) ;
290 if ((rb >= r_min) && (rb <= r_max)) {
291 xbound[nbound] = float(rb * radial_scale) ;
293 if (nbound > nbound_max-1) {
294 cout <<
"des_profile_mult : nbound too large !" << endl ;
306 line_style, ngraph, closeit, device, nbound, xbound) ;
316 void des_meridian(
const Scalar& uu,
double r_min,
double r_max,
317 const char* nomy,
int ngraph,
const char* device,
318 bool closeit,
bool draw_bound) {
322 if ((device[0] ==
'/') && (device[1] ==
'n')) return ;
325 const Scalar* des[] = {&uu, &uu, &uu, &uu, &uu} ;
326 double phi1[] = {0., 0., 0., 0.25*M_PI, 0.25*M_PI} ;
327 double theta1[] = {0., 0.25*M_PI, 0.5*M_PI, 0., 0.25*M_PI} ;
331 "phi=0: th=0, pi/4, pi/2, phi=pi/4: th=0, pi/4",
332 ngraph, 0x0, 0x0, device, draw_bound) ;
339 void des_meridian(
const Sym_tensor& hh,
double r_min,
double r_max,
340 const char* name,
int ngraph0,
const char* device,
345 if ((device[0] ==
'/') && (device[1] ==
'n')) return ;
351 for (
int i=1; i<=3; i++) {
352 for (
int j=i; j<=3; j++) {
355 sprintf(nom_i,
"%d", i) ;
357 sprintf(nom_j,
"%d", j) ;
358 strncpy(nomy, name, 40) ;
359 strcat(nomy,
" comp. ") ;
360 strcat(nomy, nom_i) ;
361 strcat(nomy, nom_j) ;
363 des_meridian(hh(i,j), r_min, r_max, nomy, ngraph0+k, device,
377 double theta,
double phi,
const char* nomy,
const char* title,
380 const Map& mp = uu.get_mp() ;
381 int nz = mp.get_mg()->get_nzone() ;
382 int nt = mp.get_mg()->get_nt(nz-1) ;
383 int np = mp.get_mg()->get_np(nz-1) ;
390 for(
int ii = 0; ii<nz; ii++)
391 npt += (uu.get_mp().get_mg())->get_nr(ii) ;
393 float *uutab =
new float[npt] ;
394 float *xtab =
new float[npt] ;
398 for(
int ii = 0; ii<nz; ii++){
399 int nr = (uu.get_mp().get_mg())->get_nr(ii) ;
400 for(
int ij=0; ij<nr; ij++){
401 uutab[ii*nr+ij] = float(uu.val_grid_point(ii,np-1,nt-1,ij)) ;
402 xtab[ii*nr+ij] = float(r(ii,np-1,nt-1,ij)) ;
409 const char* nomx =
"r" ;
421 int l_max = (mp.get_mg()->get_type_r(nz-1) == UNSURR) ? nz-2 : nz-1 ;
423 float* xbound =
new float[l_max+1] ;
427 const double xi_max = 1. ;
428 for (
int l=0; l<=l_max; l++) {
430 double rb = mp.val_r(l, xi_max, theta, phi) ;
432 if ((rb >= xmin) && (rb <= xmax)) {
433 xbound[nbound] = float(rb) ;
439 des_profile(uutab, npt, xtab, nomx, nomy, title, 0x0,
448 void des_points(
const Scalar& uu,
double scale,
449 double theta,
double phi,
const char* nomx,
const char* nomy,
450 const char* title,
bool draw_bound) {
452 const Map& mp = uu.get_mp() ;
453 int nz = mp.get_mg()->get_nzone() ;
454 int nt = mp.get_mg()->get_nt(nz-1) ;
455 int np = mp.get_mg()->get_np(nz-1) ;
462 for(
int ii = 0; ii<nz; ii++)
463 npt += (uu.get_mp().get_mg())->get_nr(ii) ;
465 float *uutab =
new float[npt] ;
466 float *xtab =
new float[npt] ;
470 for(
int ii = 0; ii<nz; ii++){
471 int nr = (uu.get_mp().get_mg())->get_nr(ii) ;
472 for(
int ij=0; ij<nr; ij++){
473 uutab[ii*nr+ij] = float(uu.val_grid_point(ii,np-1,nt-1,ij)) ;
474 xtab[ii*nr+ij] = float(r(ii,np-1,nt-1,ij)) ;
478 float xmin = float(
totalmin(r) * scale) ;
479 float xmax = float(
totalmax(r) * scale) ;
496 int l_max = (mp.get_mg()->get_type_r(nz-1) == UNSURR) ? nz-2 : nz-1 ;
498 float* xbound =
new float[l_max+1] ;
502 const double xi_max = 1. ;
503 for (
int l=0; l<=l_max; l++) {
505 double rb = mp.val_r(l, xi_max, theta, phi) ;
507 if ((rb >= xmin/scale) && (rb <= xmax/scale)) {
508 xbound[nbound] = float(rb) ;
516 des_profile(uutab, npt, xtab, nomx, nomy, title, 0x0,
void des_profile(const float *uutab, int nx, float xmin, float xmax, const char *nomx, const char *nomy, const char *title, const char *device=0x0, int nbound=0, float *xbound=0x0, bool logscale=false)
Basic routine for drawing a single profile with uniform x sampling.
void des_profile_mult(const float *uutab, int nprof, int nx, float xmin, float xmax, const char *nomx, const char *nomy, const char *title, const int *line_style, int ngraph, bool closeit, const char *device=0x0, int nbound=0, float *xbound=0x0, bool logscale=false)
Basic routine for drawing multiple profiles with uniform x sampling.
double totalmax(const Mtbl &)
Maximum value of the Mtbl elements in all domains.
void des_points(const float *uutab, int nx, float xmin, float xmax, const char *nomx=0x0, const char *nomy=0x0, const char *title=0x0, const char *device=0x0, int nbound=0, float *xbound=0x0)
Basic routine for plotting points using grid locations.
double totalmin(const Mtbl &)
Minimum value of the Mtbl elements in all domain.
void des_meridian(const Scalar &uu, double r_min, double r_max, const char *nomy, int ngraph, const char *device=0x0, bool closeit=false, bool draw_bound=true)
Draws 5 profiles of a scalar field along various radial axes in two meridional planes and ...