62 #include "utilitaires.h" 67 double fonc_des_surf_scal_x(
double,
const Param&) ;
68 double fonc_des_surf_scal_y(
double,
const Param&) ;
69 double fonc_des_surf_scal_z(
double,
const Param&) ;
73 void des_surface_x(
const Scalar& defsurf,
double x0,
const char* device,
int newgraph,
74 double y_min,
double y_max,
double z_min,
double z_max,
75 const char* nomy,
const char* nomz,
const char* title,
int nxpage,
int nypage)
79 assert(defsurf.get_etat() == ETATQCQ) ;
82 const Map& mp = defsurf.get_mp();
87 parzerosec.add_double_mod(x0, 0) ;
88 parzerosec.add_double_mod(khi, 1) ;
89 parzerosec.add_scalar(defsurf) ;
93 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
94 double precis = 1.e-8 ;
102 double hkhi = 2 * M_PI / (np-1) ;
104 bool coupe_surface = true ;
106 for (
int i=0; i< np; i++) {
116 if (
zero_premier(fonc_des_surf_scal_x, parzerosec, rhomin, rhomax, 100,
117 rhomin0, rhomax0) == false ) {
119 "des_surface_x : WARNING : no interval containing a zero of defsurf" 121 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
123 coupe_surface = false ;
131 double rho =
zerosec(fonc_des_surf_scal_x, parzerosec, rhomin0, rhomax0,
132 precis, nitermax, niter) ;
134 yg[i] = float(( rho *
cos(khi) + mp.get_ori_y() ) / km) ;
135 zg[i] = float(( rho *
sin(khi) + mp.get_ori_z() ) / km) ;
141 if ( (newgraph == 1) || (newgraph == 3) ) {
143 if (device == 0x0) device =
"?" ;
145 int ier = cpgbeg(0, device, nxpage, nypage) ;
147 cout <<
"des_surface_x: problem in opening PGPLOT display !" << endl ;
151 float size = float(1.3) ;
160 float ymin1 = float(y_min / km) ;
161 float ymax1 = float(y_max / km) ;
162 float zmin1 = float(z_min / km) ;
163 float zmax1 = float(z_max / km) ;
165 cpgenv(ymin1, ymax1, zmin1, zmax1, 1, 0 ) ;
167 if (nomy == 0x0) nomy =
"y [km]" ;
168 if (nomz == 0x0) nomz =
"z [km]" ;
169 if (title == 0x0) title =
" " ;
170 cpglab(nomy,nomz,title) ;
177 cpgline(np, yg, zg) ;
185 if ( (newgraph == 2) || (newgraph == 3) ) {
193 void des_surface_y(
const Scalar& defsurf,
double y0,
const char* device,
int newgraph,
194 double x_min,
double x_max,
double z_min,
double z_max,
195 const char* nomx,
const char* nomz,
const char* title,
int nxpage,
int nypage)
199 assert(defsurf.get_etat() == ETATQCQ) ;
202 const Map& mp = defsurf.get_mp();
207 parzerosec.add_double_mod(y0, 0) ;
208 parzerosec.add_double_mod(khi, 1) ;
209 parzerosec.add_scalar(defsurf) ;
213 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
214 double precis = 1.e-8 ;
222 double hkhi = 2 * M_PI / (np-1) ;
224 bool coupe_surface = true ;
226 for (
int i=0; i< np; i++) {
236 if (
zero_premier(fonc_des_surf_scal_y, parzerosec, rhomin, rhomax, 100,
237 rhomin0, rhomax0) == false ) {
239 "des_surface_y : WARNING : no interval containing a zero of defsurf" 241 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
243 coupe_surface = false ;
251 double rho =
zerosec(fonc_des_surf_scal_y, parzerosec, rhomin0, rhomax0,
252 precis, nitermax, niter) ;
254 xg[i] = float(( rho *
cos(khi) + mp.get_ori_x() ) / km) ;
255 zg[i] = float(( rho *
sin(khi) + mp.get_ori_z() ) / km) ;
261 if ( (newgraph == 1) || (newgraph == 3) ) {
263 if (device == 0x0) device =
"?" ;
265 int ier = cpgbeg(0, device, nxpage, nypage) ;
267 cout <<
"des_surface_y: problem in opening PGPLOT display !" << endl ;
271 float size = float(1.3) ;
280 float xmin1 = float(x_min / km) ;
281 float xmax1 = float(x_max / km) ;
282 float zmin1 = float(z_min / km) ;
283 float zmax1 = float(z_max / km) ;
285 cpgenv(xmin1, xmax1, zmin1, zmax1, 1, 0 ) ;
287 if (nomx == 0x0) nomx =
"x [km]" ;
288 if (nomz == 0x0) nomz =
"z [km]" ;
289 if (title == 0x0) title =
" " ;
290 cpglab(nomx,nomz,title) ;
297 cpgline(np, xg, zg) ;
305 if ( (newgraph == 2) || (newgraph == 3) ) {
313 void des_surface_z(
const Scalar& defsurf,
double z0,
const char* device,
int newgraph,
314 double x_min,
double x_max,
double y_min,
double y_max,
315 const char* nomx,
const char* nomy,
const char* title,
int nxpage,
int nypage)
319 assert(defsurf.get_etat() == ETATQCQ) ;
322 const Map& mp = defsurf.get_mp();
327 parzerosec.add_double_mod(z0, 0) ;
328 parzerosec.add_double_mod(khi, 1) ;
329 parzerosec.add_scalar(defsurf) ;
333 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
334 double precis = 1.e-8 ;
342 double hkhi = 2 * M_PI / (np-1) ;
344 bool coupe_surface = true ;
346 for (
int i=0; i< np; i++) {
356 if (
zero_premier(fonc_des_surf_scal_z, parzerosec, rhomin, rhomax, 100,
357 rhomin0, rhomax0) == false ) {
359 "des_surface_z : WARNING : no interval containing a zero of defsurf" 361 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
363 coupe_surface = false ;
371 double rho =
zerosec(fonc_des_surf_scal_z, parzerosec, rhomin0, rhomax0,
372 precis, nitermax, niter) ;
374 xg[i] = float(( rho *
cos(khi) + mp.get_ori_x() ) / km) ;
375 yg[i] = float(( rho *
sin(khi) + mp.get_ori_y() ) / km) ;
381 if ( (newgraph == 1) || (newgraph == 3) ) {
383 if (device == 0x0) device =
"?" ;
385 int ier = cpgbeg(0, device, nxpage, nypage) ;
387 cout <<
"des_surface_z: problem in opening PGPLOT display !" << endl ;
391 float size = float(1.3) ;
400 float xmin1 = float(x_min / km) ;
401 float xmax1 = float(x_max / km) ;
402 float ymin1 = float(y_min / km) ;
403 float ymax1 = float(y_max / km) ;
405 cpgenv(xmin1, xmax1, ymin1, ymax1, 1, 0 ) ;
407 if (nomx == 0x0) nomx =
"x [km]" ;
408 if (nomy == 0x0) nomy =
"y [km]" ;
409 if (title == 0x0) title =
" " ;
410 cpglab(nomx,nomy,title) ;
417 cpgline(np, xg, yg) ;
425 if ( (newgraph == 2) || (newgraph == 3) ) {
442 double fonc_des_surf_scal_x(
double vrho,
const Param& par) {
444 double x = par.get_double_mod(0) ;
445 double khi = par.get_double_mod(1) ;
446 const Scalar& defsurf = par.get_scalar() ;
447 const Map& mp = defsurf.get_mp() ;
450 double y = vrho *
cos(khi) + mp.get_ori_y() ;
451 double z = vrho *
sin(khi) + mp.get_ori_z() ;
454 double r, theta, phi ;
455 mp.convert_absolute(x, y, z, r, theta, phi) ;
457 return defsurf.
val_point(r, theta, phi) ;
463 double fonc_des_surf_scal_y(
double vrho,
const Param& par) {
465 double y = par.get_double_mod(0) ;
466 double khi = par.get_double_mod(1) ;
467 const Scalar& defsurf = par.get_scalar() ;
468 const Map& mp = defsurf.get_mp() ;
471 double x = vrho *
cos(khi) + mp.get_ori_x() ;
472 double z = vrho *
sin(khi) + mp.get_ori_z() ;
475 double r, theta, phi ;
476 mp.convert_absolute(x, y, z, r, theta, phi) ;
478 return defsurf.
val_point(r, theta, phi) ;
484 double fonc_des_surf_scal_z(
double vrho,
const Param& par) {
486 double z = par.get_double_mod(0) ;
487 double khi = par.get_double_mod(1) ;
488 const Scalar& defsurf = par.get_scalar() ;
489 const Map& mp = defsurf.get_mp() ;
492 double x = vrho *
cos(khi) + mp.get_ori_x() ;
493 double y = vrho *
sin(khi) + mp.get_ori_y() ;
496 double r, theta, phi ;
497 mp.convert_absolute(x, y, z, r, theta, phi) ;
499 return defsurf.
val_point(r, theta, phi) ;
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.
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.
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.
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.
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.
double val_point(double r, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point , by means of the spectral...