27char des_surface_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_surface.C,v 1.5 2014/10/13 08:53:23 j_novak Exp $" ;
72#include "utilitaires.h"
77double fonc_des_surface_x(
double,
const Param&) ;
78double fonc_des_surface_y(
double,
const Param&) ;
79double fonc_des_surface_z(
double,
const Param&) ;
83void des_surface_x(
const Cmp& defsurf,
double x0,
const char* device,
int newgraph,
84 double y_min,
double y_max,
double z_min,
double z_max,
85 const char* nomy,
const char* nomz,
const char* title,
int nxpage,
int nypage)
89 assert(defsurf.get_etat() == ETATQCQ) ;
92 const Map* mp = defsurf.get_mp();
97 parzerosec.add_double_mod(x0, 0) ;
98 parzerosec.add_double_mod(khi, 1) ;
99 parzerosec.add_cmp(defsurf) ;
103 mp->val_r(mp->get_mg()->get_nzone() - 1, -1., 0., 0.) ;
104 double precis = 1.e-8 ;
112 double hkhi = 2 * M_PI / (np-1) ;
114 bool coupe_surface = true ;
116 for (
int i=0; i< np; i++) {
126 if (
zero_premier(fonc_des_surface_x, parzerosec, rhomin, rhomax, 100,
127 rhomin0, rhomax0) == false ) {
129 "des_surface_x : WARNING : no interval containing a zero of defsurf"
131 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
133 coupe_surface = false ;
141 double rho =
zerosec(fonc_des_surface_x, parzerosec, rhomin0, rhomax0,
142 precis, nitermax, niter) ;
144 yg[i] = float(( rho *
cos(khi) + mp->get_ori_y() ) / km) ;
145 zg[i] = float(( rho *
sin(khi) + mp->get_ori_z() ) / km) ;
151 if ( (newgraph == 1) || (newgraph == 3) ) {
153 if (device == 0x0) device =
"?" ;
155 int ier = cpgbeg(0, device, nxpage, nypage) ;
157 cout <<
"des_surface_x: problem in opening PGPLOT display !" << endl ;
161 float size = float(1.3) ;
170 float ymin1 = float(y_min / km) ;
171 float ymax1 = float(y_max / km) ;
172 float zmin1 = float(z_min / km) ;
173 float zmax1 = float(z_max / km) ;
175 cpgenv(ymin1, ymax1, zmin1, zmax1, 1, 0 ) ;
177 if (nomy == 0x0) nomy =
"y [km]" ;
178 if (nomz == 0x0) nomz =
"z [km]" ;
179 if (title == 0x0) title =
" " ;
180 cpglab(nomy,nomz,title) ;
187 cpgline(np, yg, zg) ;
195 if ( (newgraph == 2) || (newgraph == 3) ) {
203void des_surface_y(
const Cmp& defsurf,
double y0,
const char* device,
int newgraph,
204 double x_min,
double x_max,
double z_min,
double z_max,
205 const char* nomx,
const char* nomz,
const char* title,
int nxpage,
int nypage)
209 assert(defsurf.get_etat() == ETATQCQ) ;
212 const Map* mp = defsurf.get_mp();
217 parzerosec.add_double_mod(y0, 0) ;
218 parzerosec.add_double_mod(khi, 1) ;
219 parzerosec.add_cmp(defsurf) ;
223 mp->val_r(mp->get_mg()->get_nzone() - 1, -1., 0., 0.) ;
224 double precis = 1.e-8 ;
232 double hkhi = 2 * M_PI / (np-1) ;
234 bool coupe_surface = true ;
236 for (
int i=0; i< np; i++) {
246 if (
zero_premier(fonc_des_surface_y, parzerosec, rhomin, rhomax, 100,
247 rhomin0, rhomax0) == false ) {
249 "des_surface_y : WARNING : no interval containing a zero of defsurf"
251 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
253 coupe_surface = false ;
261 double rho =
zerosec(fonc_des_surface_y, parzerosec, rhomin0, rhomax0,
262 precis, nitermax, niter) ;
264 xg[i] = float(( rho *
cos(khi) + mp->get_ori_x() ) / km) ;
265 zg[i] = float(( rho *
sin(khi) + mp->get_ori_z() ) / km) ;
271 if ( (newgraph == 1) || (newgraph == 3) ) {
273 if (device == 0x0) device =
"?" ;
275 int ier = cpgbeg(0, device, nxpage, nypage) ;
277 cout <<
"des_surface_y: problem in opening PGPLOT display !" << endl ;
281 float size = float(1.3) ;
290 float xmin1 = float(x_min / km) ;
291 float xmax1 = float(x_max / km) ;
292 float zmin1 = float(z_min / km) ;
293 float zmax1 = float(z_max / km) ;
295 cpgenv(xmin1, xmax1, zmin1, zmax1, 1, 0 ) ;
297 if (nomx == 0x0) nomx =
"x [km]" ;
298 if (nomz == 0x0) nomz =
"z [km]" ;
299 if (title == 0x0) title =
" " ;
300 cpglab(nomx,nomz,title) ;
307 cpgline(np, xg, zg) ;
315 if ( (newgraph == 2) || (newgraph == 3) ) {
323void des_surface_z(
const Cmp& defsurf,
double z0,
const char* device,
int newgraph,
324 double x_min,
double x_max,
double y_min,
double y_max,
325 const char* nomx,
const char* nomy,
const char* title,
int nxpage,
int nypage)
329 assert(defsurf.get_etat() == ETATQCQ) ;
332 const Map* mp = defsurf.get_mp();
337 parzerosec.add_double_mod(z0, 0) ;
338 parzerosec.add_double_mod(khi, 1) ;
339 parzerosec.add_cmp(defsurf) ;
343 mp->val_r(mp->get_mg()->get_nzone() - 1, -1., 0., 0.) ;
344 double precis = 1.e-8 ;
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_surface_z, parzerosec, rhomin, rhomax, 100,
367 rhomin0, rhomax0) == false ) {
369 "des_surface_z : WARNING : no interval containing a zero of defsurf"
371 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
373 coupe_surface = false ;
381 double rho =
zerosec(fonc_des_surface_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) ;
391 if ( (newgraph == 1) || (newgraph == 3) ) {
393 if (device == 0x0) device =
"?" ;
395 int ier = cpgbeg(0, device, nxpage, nypage) ;
397 cout <<
"des_surface_z: problem in opening PGPLOT display !" << endl ;
401 float size = float(1.3) ;
410 float xmin1 = float(x_min / km) ;
411 float xmax1 = float(x_max / km) ;
412 float ymin1 = float(y_min / km) ;
413 float ymax1 = float(y_max / km) ;
415 cpgenv(xmin1, xmax1, ymin1, ymax1, 1, 0 ) ;
417 if (nomx == 0x0) nomx =
"x [km]" ;
418 if (nomy == 0x0) nomy =
"y [km]" ;
419 if (title == 0x0) title =
" " ;
420 cpglab(nomx,nomy,title) ;
427 cpgline(np, xg, yg) ;
435 if ( (newgraph == 2) || (newgraph == 3) ) {
452double fonc_des_surface_x(
double vrho,
const Param& par) {
454 double x = par.get_double_mod(0) ;
455 double khi = par.get_double_mod(1) ;
456 const Cmp& defsurf = par.get_cmp() ;
457 const Map& mp = *(defsurf.get_mp()) ;
460 double y = vrho *
cos(khi) + mp.get_ori_y() ;
461 double z = vrho *
sin(khi) + mp.get_ori_z() ;
464 double r, theta, phi ;
465 mp.convert_absolute(x, y, z, r, theta, phi) ;
467 return defsurf.
val_point(r, theta, phi) ;
473double fonc_des_surface_y(
double vrho,
const Param& par) {
475 double y = par.get_double_mod(0) ;
476 double khi = par.get_double_mod(1) ;
477 const Cmp& defsurf = par.get_cmp() ;
478 const Map& mp = *(defsurf.get_mp()) ;
481 double x = vrho *
cos(khi) + mp.get_ori_x() ;
482 double z = vrho *
sin(khi) + mp.get_ori_z() ;
485 double r, theta, phi ;
486 mp.convert_absolute(x, y, z, r, theta, phi) ;
488 return defsurf.
val_point(r, theta, phi) ;
494double fonc_des_surface_z(
double vrho,
const Param& par) {
496 double z = par.get_double_mod(0) ;
497 double khi = par.get_double_mod(1) ;
498 const Cmp& defsurf = par.get_cmp() ;
499 const Map& mp = *(defsurf.get_mp()) ;
502 double x = vrho *
cos(khi) + mp.get_ori_x() ;
503 double y = vrho *
sin(khi) + mp.get_ori_y() ;
506 double r, theta, phi ;
507 mp.convert_absolute(x, y, z, r, theta, phi) ;
509 return defsurf.
val_point(r, theta, phi) ;
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...
Cmp sin(const Cmp &)
Sine.
Cmp cos(const Cmp &)
Cosine.
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.
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_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.
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.