82 #include "utilitaires.h" 87 double fonc_des_domaine_x(
double,
const Param&) ;
88 double fonc_des_domaine_y(
double,
const Param&) ;
89 double fonc_des_domaine_z(
double,
const Param&) ;
93 void des_domaine_x(
const Map& mp,
int l0,
double x0,
const char* device,
int newgraph,
94 double y_min,
double y_max,
double z_min,
double z_max,
95 const char* nomy,
const char* nomz,
const char* title,
int nxpage,
int nypage)
102 parzerosec.add_int(l0, 0) ;
103 parzerosec.add_double_mod(x0, 0) ;
104 parzerosec.add_double_mod(khi, 1) ;
105 parzerosec.add_map(mp, 0) ;
109 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
110 double precis = 1.e-14 * (rhomax - rhomin) ;
118 double hkhi = 2 * M_PI / (np-1) ;
120 bool coupe_surface = true ;
122 for (
int i=0; i< np; i++) {
132 if (
zero_premier(fonc_des_domaine_x, parzerosec, rhomin, rhomax, 100,
133 rhomin0, rhomax0) == false ) {
135 "des_domaine_x : WARNING : no crossing with the domain boundary" 137 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
139 coupe_surface = false ;
147 double rho =
zerosec(fonc_des_domaine_x, parzerosec, rhomin0, rhomax0,
148 precis, nitermax, niter) ;
150 yg[i] = float(( rho *
cos(khi) + mp.get_ori_y() ) / km) ;
151 zg[i] = float(( rho *
sin(khi) + mp.get_ori_z() ) / km) ;
158 if ( (newgraph == 1) || (newgraph == 3) ) {
160 if (device == 0x0) device =
"?" ;
162 int ier = cpgbeg(0, device, nxpage, nypage) ;
164 cout <<
"des_domaine_x: problem in opening PGPLOT display !" << endl ;
168 float size = float(1.3) ;
177 float ymin1 = float(y_min / km) ;
178 float ymax1 = float(y_max / km) ;
179 float zmin1 = float(z_min / km) ;
180 float zmax1 = float(z_max / km) ;
182 cpgenv(ymin1, ymax1, zmin1, zmax1, 1, 0 ) ;
184 if (nomy == 0x0) nomy =
"y [km]" ;
185 if (nomz == 0x0) nomz =
"z [km]" ;
186 if (title == 0x0) title =
" " ;
187 cpglab(nomy,nomz,title) ;
194 cpgline(np, yg, zg) ;
203 if ( (newgraph == 2) || (newgraph == 3) ) {
212 void des_domaine_y(
const Map& mp,
int l0,
double y0,
const char* device,
int newgraph,
213 double x_min,
double x_max,
double z_min,
double z_max,
214 const char* nomx,
const char* nomz,
const char* title,
int nxpage,
int nypage)
221 parzerosec.add_int(l0, 0) ;
222 parzerosec.add_double_mod(y0, 0) ;
223 parzerosec.add_double_mod(khi, 1) ;
224 parzerosec.add_map(mp, 0) ;
228 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
229 double precis = 1.e-14 * (rhomax - rhomin) ;
237 double hkhi = 2 * M_PI / (np-1) ;
239 bool coupe_surface = true ;
241 for (
int i=0; i< np; i++) {
251 if (
zero_premier(fonc_des_domaine_y, parzerosec, rhomin, rhomax, 100,
252 rhomin0, rhomax0) == false ) {
254 "des_domaine_y : WARNING : no crossing with the domain boundary" 256 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
258 coupe_surface = false ;
266 double rho =
zerosec(fonc_des_domaine_y, parzerosec, rhomin0, rhomax0,
267 precis, nitermax, niter) ;
269 xg[i] = float(( rho *
cos(khi) + mp.get_ori_x() ) / km) ;
270 zg[i] = float(( rho *
sin(khi) + mp.get_ori_z() ) / km) ;
277 if ( (newgraph == 1) || (newgraph == 3) ) {
279 if (device == 0x0) device =
"?" ;
281 int ier = cpgbeg(0, device, nxpage, nypage) ;
283 cout <<
"des_domaine_y: problem in opening PGPLOT display !" << endl ;
287 float size = float(1.3) ;
296 float xmin1 = float(x_min / km) ;
297 float xmax1 = float(x_max / km) ;
298 float zmin1 = float(z_min / km) ;
299 float zmax1 = float(z_max / km) ;
301 cpgenv(xmin1, xmax1, zmin1, zmax1, 1, 0 ) ;
303 if (nomx == 0x0) nomx =
"x [km]" ;
304 if (nomz == 0x0) nomz =
"z [km]" ;
305 if (title == 0x0) title =
" " ;
306 cpglab(nomx,nomz,title) ;
313 cpgline(np, xg, zg) ;
322 if ( (newgraph == 2) || (newgraph == 3) ) {
330 void des_domaine_z(
const Map& mp,
int l0,
double z0,
const char* device,
int newgraph,
331 double x_min,
double x_max,
double y_min,
double y_max,
332 const char* nomx,
const char* nomy,
const char* title,
int nxpage,
int nypage)
339 parzerosec.add_int(l0, 0) ;
340 parzerosec.add_double_mod(z0, 0) ;
341 parzerosec.add_double_mod(khi, 1) ;
342 parzerosec.add_map(mp, 0) ;
346 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
347 double precis = 1.e-14 * (rhomax - rhomin) ;
355 double hkhi = 2 * M_PI / (np-1) ;
357 bool coupe_surface = true ;
359 for (
int i=0; i< np; i++) {
369 if (
zero_premier(fonc_des_domaine_z, parzerosec, rhomin, rhomax, 100,
370 rhomin0, rhomax0) == false ) {
372 "des_domaine_z : WARNING : no crossing with the domain boundary" 374 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
376 coupe_surface = false ;
384 double rho =
zerosec(fonc_des_domaine_z, parzerosec, rhomin0, rhomax0,
385 precis, nitermax, niter) ;
387 xg[i] = float(( rho *
cos(khi) + mp.get_ori_x() ) / km) ;
388 yg[i] = float(( rho *
sin(khi) + mp.get_ori_y() ) / km) ;
395 if ( (newgraph == 1) || (newgraph == 3) ) {
397 if (device == 0x0) device =
"?" ;
399 int ier = cpgbeg(0, device, nxpage, nypage) ;
401 cout <<
"des_domaine_z: problem in opening PGPLOT display !" << endl ;
405 float size = float(1.3) ;
414 float xmin1 = float(x_min / km) ;
415 float xmax1 = float(x_max / km) ;
416 float ymin1 = float(y_min / km) ;
417 float ymax1 = float(y_max / km) ;
419 cpgenv(xmin1, xmax1, ymin1, ymax1, 1, 0 ) ;
421 if (nomx == 0x0) nomx =
"x [km]" ;
422 if (nomy == 0x0) nomy =
"y [km]" ;
423 if (title == 0x0) title =
" " ;
424 cpglab(nomx,nomy,title) ;
431 cpgline(np, xg, yg) ;
440 if ( (newgraph == 2) || (newgraph == 3) ) {
451 double fonc_des_domaine_x(
double vrho,
const Param& par) {
453 int l = par.get_int(0) ;
454 double x = par.get_double_mod(0) ;
455 double khi = par.get_double_mod(1) ;
456 const Map& mp = par.get_map(0) ;
459 double y = vrho *
cos(khi) + mp.get_ori_y() ;
460 double z = vrho *
sin(khi) + mp.get_ori_z() ;
463 double r, theta, phi ;
464 mp.convert_absolute(x, y, z, r, theta, phi) ;
466 return r - mp.val_r(l, 1., theta, phi) ;
472 double fonc_des_domaine_y(
double vrho,
const Param& par) {
474 int l = par.get_int(0) ;
475 double y = par.get_double_mod(0) ;
476 double khi = par.get_double_mod(1) ;
477 const Map& mp = par.get_map(0) ;
480 double x = vrho *
cos(khi) + mp.get_ori_x() ;
481 double z = vrho *
sin(khi) + mp.get_ori_z() ;
484 double r, theta, phi ;
485 mp.convert_absolute(x, y, z, r, theta, phi) ;
487 return r - mp.val_r(l, 1., theta, phi) ;
493 double fonc_des_domaine_z(
double vrho,
const Param& par) {
495 int l = par.get_int(0) ;
496 double z = par.get_double_mod(0) ;
497 double khi = par.get_double_mod(1) ;
498 const Map& mp = par.get_map(0) ;
501 double x = vrho *
cos(khi) + mp.get_ori_x() ;
502 double y = vrho *
sin(khi) + mp.get_ori_y() ;
505 double r, theta, phi ;
506 mp.convert_absolute(x, y, z, r, theta, phi) ;
508 return r - mp.val_r(l, 1., theta, phi) ;
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_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.
Cmp cos(const Cmp &)
Cosine.
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.
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.
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.
Cmp sin(const Cmp &)
Sine.