27char des_domaine_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_domaine.C,v 1.6 2014/10/13 08:53:22 j_novak Exp $" ;
79#include "utilitaires.h"
84double fonc_des_domaine_x(
double,
const Param&) ;
85double fonc_des_domaine_y(
double,
const Param&) ;
86double fonc_des_domaine_z(
double,
const Param&) ;
90void des_domaine_x(
const Map& mp,
int l0,
double x0,
const char* device,
int newgraph,
91 double y_min,
double y_max,
double z_min,
double z_max,
92 const char* nomy,
const char* nomz,
const char* title,
int nxpage,
int nypage)
99 parzerosec.add_int(l0, 0) ;
100 parzerosec.add_double_mod(x0, 0) ;
101 parzerosec.add_double_mod(khi, 1) ;
102 parzerosec.add_map(mp, 0) ;
106 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
107 double precis = 1.e-14 * (rhomax - rhomin) ;
115 double hkhi = 2 * M_PI / (np-1) ;
117 bool coupe_surface = true ;
119 for (
int i=0; i< np; i++) {
129 if (
zero_premier(fonc_des_domaine_x, parzerosec, rhomin, rhomax, 100,
130 rhomin0, rhomax0) == false ) {
132 "des_domaine_x : WARNING : no crossing with the domain boundary"
134 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
136 coupe_surface = false ;
144 double rho =
zerosec(fonc_des_domaine_x, parzerosec, rhomin0, rhomax0,
145 precis, nitermax, niter) ;
147 yg[i] = float(( rho *
cos(khi) + mp.get_ori_y() ) / km) ;
148 zg[i] = float(( rho *
sin(khi) + mp.get_ori_z() ) / km) ;
155 if ( (newgraph == 1) || (newgraph == 3) ) {
157 if (device == 0x0) device =
"?" ;
159 int ier = cpgbeg(0, device, nxpage, nypage) ;
161 cout <<
"des_domaine_x: problem in opening PGPLOT display !" << endl ;
165 float size = float(1.3) ;
174 float ymin1 = float(y_min / km) ;
175 float ymax1 = float(y_max / km) ;
176 float zmin1 = float(z_min / km) ;
177 float zmax1 = float(z_max / km) ;
179 cpgenv(ymin1, ymax1, zmin1, zmax1, 1, 0 ) ;
181 if (nomy == 0x0) nomy =
"y [km]" ;
182 if (nomz == 0x0) nomz =
"z [km]" ;
183 if (title == 0x0) title =
" " ;
184 cpglab(nomy,nomz,title) ;
191 cpgline(np, yg, zg) ;
200 if ( (newgraph == 2) || (newgraph == 3) ) {
209void des_domaine_y(
const Map& mp,
int l0,
double y0,
const char* device,
int newgraph,
210 double x_min,
double x_max,
double z_min,
double z_max,
211 const char* nomx,
const char* nomz,
const char* title,
int nxpage,
int nypage)
218 parzerosec.add_int(l0, 0) ;
219 parzerosec.add_double_mod(y0, 0) ;
220 parzerosec.add_double_mod(khi, 1) ;
221 parzerosec.add_map(mp, 0) ;
225 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
226 double precis = 1.e-14 * (rhomax - rhomin) ;
234 double hkhi = 2 * M_PI / (np-1) ;
236 bool coupe_surface = true ;
238 for (
int i=0; i< np; i++) {
248 if (
zero_premier(fonc_des_domaine_y, parzerosec, rhomin, rhomax, 100,
249 rhomin0, rhomax0) == false ) {
251 "des_domaine_y : WARNING : no crossing with the domain boundary"
253 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
255 coupe_surface = false ;
263 double rho =
zerosec(fonc_des_domaine_y, parzerosec, rhomin0, rhomax0,
264 precis, nitermax, niter) ;
266 xg[i] = float(( rho *
cos(khi) + mp.get_ori_x() ) / km) ;
267 zg[i] = float(( rho *
sin(khi) + mp.get_ori_z() ) / km) ;
274 if ( (newgraph == 1) || (newgraph == 3) ) {
276 if (device == 0x0) device =
"?" ;
278 int ier = cpgbeg(0, device, nxpage, nypage) ;
280 cout <<
"des_domaine_y: problem in opening PGPLOT display !" << endl ;
284 float size = float(1.3) ;
293 float xmin1 = float(x_min / km) ;
294 float xmax1 = float(x_max / km) ;
295 float zmin1 = float(z_min / km) ;
296 float zmax1 = float(z_max / km) ;
298 cpgenv(xmin1, xmax1, zmin1, zmax1, 1, 0 ) ;
300 if (nomx == 0x0) nomx =
"x [km]" ;
301 if (nomz == 0x0) nomz =
"z [km]" ;
302 if (title == 0x0) title =
" " ;
303 cpglab(nomx,nomz,title) ;
310 cpgline(np, xg, zg) ;
319 if ( (newgraph == 2) || (newgraph == 3) ) {
327void des_domaine_z(
const Map& mp,
int l0,
double z0,
const char* device,
int newgraph,
328 double x_min,
double x_max,
double y_min,
double y_max,
329 const char* nomx,
const char* nomy,
const char* title,
int nxpage,
int nypage)
336 parzerosec.add_int(l0, 0) ;
337 parzerosec.add_double_mod(z0, 0) ;
338 parzerosec.add_double_mod(khi, 1) ;
339 parzerosec.add_map(mp, 0) ;
343 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
344 double precis = 1.e-14 * (rhomax - rhomin) ;
352 double hkhi = 2 * M_PI / (np-1) ;
354 bool coupe_surface = true ;
356 for (
int i=0; i< np; i++) {
366 if (
zero_premier(fonc_des_domaine_z, parzerosec, rhomin, rhomax, 100,
367 rhomin0, rhomax0) == false ) {
369 "des_domaine_z : WARNING : no crossing with the domain boundary"
371 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
373 coupe_surface = false ;
381 double rho =
zerosec(fonc_des_domaine_z, parzerosec, rhomin0, rhomax0,
382 precis, nitermax, niter) ;
384 xg[i] = float(( rho *
cos(khi) + mp.get_ori_x() ) / km) ;
385 yg[i] = float(( rho *
sin(khi) + mp.get_ori_y() ) / km) ;
392 if ( (newgraph == 1) || (newgraph == 3) ) {
394 if (device == 0x0) device =
"?" ;
396 int ier = cpgbeg(0, device, nxpage, nypage) ;
398 cout <<
"des_domaine_z: problem in opening PGPLOT display !" << endl ;
402 float size = float(1.3) ;
411 float xmin1 = float(x_min / km) ;
412 float xmax1 = float(x_max / km) ;
413 float ymin1 = float(y_min / km) ;
414 float ymax1 = float(y_max / km) ;
416 cpgenv(xmin1, xmax1, ymin1, ymax1, 1, 0 ) ;
418 if (nomx == 0x0) nomx =
"x [km]" ;
419 if (nomy == 0x0) nomy =
"y [km]" ;
420 if (title == 0x0) title =
" " ;
421 cpglab(nomx,nomy,title) ;
428 cpgline(np, xg, yg) ;
437 if ( (newgraph == 2) || (newgraph == 3) ) {
448double fonc_des_domaine_x(
double vrho,
const Param& par) {
450 int l = par.get_int(0) ;
451 double x = par.get_double_mod(0) ;
452 double khi = par.get_double_mod(1) ;
453 const Map& mp = par.get_map(0) ;
456 double y = vrho *
cos(khi) + mp.get_ori_y() ;
457 double z = vrho *
sin(khi) + mp.get_ori_z() ;
460 double r, theta, phi ;
461 mp.convert_absolute(x, y, z, r, theta, phi) ;
463 return r - mp.val_r(l, 1., theta, phi) ;
469double fonc_des_domaine_y(
double vrho,
const Param& par) {
471 int l = par.get_int(0) ;
472 double y = par.get_double_mod(0) ;
473 double khi = par.get_double_mod(1) ;
474 const Map& mp = par.get_map(0) ;
477 double x = vrho *
cos(khi) + mp.get_ori_x() ;
478 double z = vrho *
sin(khi) + mp.get_ori_z() ;
481 double r, theta, phi ;
482 mp.convert_absolute(x, y, z, r, theta, phi) ;
484 return r - mp.val_r(l, 1., theta, phi) ;
490double fonc_des_domaine_z(
double vrho,
const Param& par) {
492 int l = par.get_int(0) ;
493 double z = par.get_double_mod(0) ;
494 double khi = par.get_double_mod(1) ;
495 const Map& mp = par.get_map(0) ;
498 double x = vrho *
cos(khi) + mp.get_ori_x() ;
499 double y = vrho *
sin(khi) + mp.get_ori_y() ;
502 double r, theta, phi ;
503 mp.convert_absolute(x, y, z, r, theta, phi) ;
505 return r - mp.val_r(l, 1., theta, phi) ;
Cmp sin(const Cmp &)
Sine.
Cmp cos(const Cmp &)
Cosine.
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.
bool zero_premier(double(*f)(double, const Param &), const Param &par, double a, double b, int n, double &a0, double &b0)
Locates the sub-interval containing the first zero of a function in a given interval.
double zerosec(double(*f)(double, const Param &), const Param &par, double a, double b, double precis, int nitermax, int &niter, bool abort=true)
Finding the zero a function.
Standard units of space, time and mass.