27char des_surf_scalar_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_surf_scalar.C,v 1.4 2014/10/13 08:53:22 j_novak Exp $" ;
59#include "utilitaires.h"
64double fonc_des_surf_scal_x(
double,
const Param&) ;
65double fonc_des_surf_scal_y(
double,
const Param&) ;
66double fonc_des_surf_scal_z(
double,
const Param&) ;
70void des_surface_x(
const Scalar& defsurf,
double x0,
const char* device,
int newgraph,
71 double y_min,
double y_max,
double z_min,
double z_max,
72 const char* nomy,
const char* nomz,
const char* title,
int nxpage,
int nypage)
76 assert(defsurf.get_etat() == ETATQCQ) ;
79 const Map& mp = defsurf.get_mp();
84 parzerosec.add_double_mod(x0, 0) ;
85 parzerosec.add_double_mod(khi, 1) ;
86 parzerosec.add_scalar(defsurf) ;
90 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
91 double precis = 1.e-8 ;
99 double hkhi = 2 * M_PI / (np-1) ;
101 bool coupe_surface = true ;
103 for (
int i=0; i< np; i++) {
113 if (
zero_premier(fonc_des_surf_scal_x, parzerosec, rhomin, rhomax, 100,
114 rhomin0, rhomax0) == false ) {
116 "des_surface_x : WARNING : no interval containing a zero of defsurf"
118 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
120 coupe_surface = false ;
128 double rho =
zerosec(fonc_des_surf_scal_x, parzerosec, rhomin0, rhomax0,
129 precis, nitermax, niter) ;
131 yg[i] = float(( rho *
cos(khi) + mp.get_ori_y() ) / km) ;
132 zg[i] = float(( rho *
sin(khi) + mp.get_ori_z() ) / km) ;
138 if ( (newgraph == 1) || (newgraph == 3) ) {
140 if (device == 0x0) device =
"?" ;
142 int ier = cpgbeg(0, device, nxpage, nypage) ;
144 cout <<
"des_surface_x: problem in opening PGPLOT display !" << endl ;
148 float size = float(1.3) ;
157 float ymin1 = float(y_min / km) ;
158 float ymax1 = float(y_max / km) ;
159 float zmin1 = float(z_min / km) ;
160 float zmax1 = float(z_max / km) ;
162 cpgenv(ymin1, ymax1, zmin1, zmax1, 1, 0 ) ;
164 if (nomy == 0x0) nomy =
"y [km]" ;
165 if (nomz == 0x0) nomz =
"z [km]" ;
166 if (title == 0x0) title =
" " ;
167 cpglab(nomy,nomz,title) ;
174 cpgline(np, yg, zg) ;
182 if ( (newgraph == 2) || (newgraph == 3) ) {
190void des_surface_y(
const Scalar& defsurf,
double y0,
const char* device,
int newgraph,
191 double x_min,
double x_max,
double z_min,
double z_max,
192 const char* nomx,
const char* nomz,
const char* title,
int nxpage,
int nypage)
196 assert(defsurf.get_etat() == ETATQCQ) ;
199 const Map& mp = defsurf.get_mp();
204 parzerosec.add_double_mod(y0, 0) ;
205 parzerosec.add_double_mod(khi, 1) ;
206 parzerosec.add_scalar(defsurf) ;
210 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
211 double precis = 1.e-8 ;
219 double hkhi = 2 * M_PI / (np-1) ;
221 bool coupe_surface = true ;
223 for (
int i=0; i< np; i++) {
233 if (
zero_premier(fonc_des_surf_scal_y, parzerosec, rhomin, rhomax, 100,
234 rhomin0, rhomax0) == false ) {
236 "des_surface_y : WARNING : no interval containing a zero of defsurf"
238 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
240 coupe_surface = false ;
248 double rho =
zerosec(fonc_des_surf_scal_y, parzerosec, rhomin0, rhomax0,
249 precis, nitermax, niter) ;
251 xg[i] = float(( rho *
cos(khi) + mp.get_ori_x() ) / km) ;
252 zg[i] = float(( rho *
sin(khi) + mp.get_ori_z() ) / km) ;
258 if ( (newgraph == 1) || (newgraph == 3) ) {
260 if (device == 0x0) device =
"?" ;
262 int ier = cpgbeg(0, device, nxpage, nypage) ;
264 cout <<
"des_surface_y: problem in opening PGPLOT display !" << endl ;
268 float size = float(1.3) ;
277 float xmin1 = float(x_min / km) ;
278 float xmax1 = float(x_max / km) ;
279 float zmin1 = float(z_min / km) ;
280 float zmax1 = float(z_max / km) ;
282 cpgenv(xmin1, xmax1, zmin1, zmax1, 1, 0 ) ;
284 if (nomx == 0x0) nomx =
"x [km]" ;
285 if (nomz == 0x0) nomz =
"z [km]" ;
286 if (title == 0x0) title =
" " ;
287 cpglab(nomx,nomz,title) ;
294 cpgline(np, xg, zg) ;
302 if ( (newgraph == 2) || (newgraph == 3) ) {
310void des_surface_z(
const Scalar& defsurf,
double z0,
const char* device,
int newgraph,
311 double x_min,
double x_max,
double y_min,
double y_max,
312 const char* nomx,
const char* nomy,
const char* title,
int nxpage,
int nypage)
316 assert(defsurf.get_etat() == ETATQCQ) ;
319 const Map& mp = defsurf.get_mp();
324 parzerosec.add_double_mod(z0, 0) ;
325 parzerosec.add_double_mod(khi, 1) ;
326 parzerosec.add_scalar(defsurf) ;
330 mp.val_r(mp.get_mg()->get_nzone() - 1, -1., 0., 0.) ;
331 double precis = 1.e-8 ;
339 double hkhi = 2 * M_PI / (np-1) ;
341 bool coupe_surface = true ;
343 for (
int i=0; i< np; i++) {
353 if (
zero_premier(fonc_des_surf_scal_z, parzerosec, rhomin, rhomax, 100,
354 rhomin0, rhomax0) == false ) {
356 "des_surface_z : WARNING : no interval containing a zero of defsurf"
358 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
360 coupe_surface = false ;
368 double rho =
zerosec(fonc_des_surf_scal_z, parzerosec, rhomin0, rhomax0,
369 precis, nitermax, niter) ;
371 xg[i] = float(( rho *
cos(khi) + mp.get_ori_x() ) / km) ;
372 yg[i] = float(( rho *
sin(khi) + mp.get_ori_y() ) / km) ;
378 if ( (newgraph == 1) || (newgraph == 3) ) {
380 if (device == 0x0) device =
"?" ;
382 int ier = cpgbeg(0, device, nxpage, nypage) ;
384 cout <<
"des_surface_z: problem in opening PGPLOT display !" << endl ;
388 float size = float(1.3) ;
397 float xmin1 = float(x_min / km) ;
398 float xmax1 = float(x_max / km) ;
399 float ymin1 = float(y_min / km) ;
400 float ymax1 = float(y_max / km) ;
402 cpgenv(xmin1, xmax1, ymin1, ymax1, 1, 0 ) ;
404 if (nomx == 0x0) nomx =
"x [km]" ;
405 if (nomy == 0x0) nomy =
"y [km]" ;
406 if (title == 0x0) title =
" " ;
407 cpglab(nomx,nomy,title) ;
414 cpgline(np, xg, yg) ;
422 if ( (newgraph == 2) || (newgraph == 3) ) {
439double fonc_des_surf_scal_x(
double vrho,
const Param& par) {
441 double x = par.get_double_mod(0) ;
442 double khi = par.get_double_mod(1) ;
443 const Scalar& defsurf = par.get_scalar() ;
444 const Map& mp = defsurf.get_mp() ;
447 double y = vrho *
cos(khi) + mp.get_ori_y() ;
448 double z = vrho *
sin(khi) + mp.get_ori_z() ;
451 double r, theta, phi ;
452 mp.convert_absolute(x, y, z, r, theta, phi) ;
454 return defsurf.
val_point(r, theta, phi) ;
460double fonc_des_surf_scal_y(
double vrho,
const Param& par) {
462 double y = par.get_double_mod(0) ;
463 double khi = par.get_double_mod(1) ;
464 const Scalar& defsurf = par.get_scalar() ;
465 const Map& mp = defsurf.get_mp() ;
468 double x = vrho *
cos(khi) + mp.get_ori_x() ;
469 double z = vrho *
sin(khi) + mp.get_ori_z() ;
472 double r, theta, phi ;
473 mp.convert_absolute(x, y, z, r, theta, phi) ;
475 return defsurf.
val_point(r, theta, phi) ;
481double fonc_des_surf_scal_z(
double vrho,
const Param& par) {
483 double z = par.get_double_mod(0) ;
484 double khi = par.get_double_mod(1) ;
485 const Scalar& defsurf = par.get_scalar() ;
486 const Map& mp = defsurf.get_mp() ;
489 double x = vrho *
cos(khi) + mp.get_ori_x() ;
490 double y = vrho *
sin(khi) + mp.get_ori_y() ;
493 double r, theta, phi ;
494 mp.convert_absolute(x, y, z, r, theta, phi) ;
496 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.