75#include "utilitaires.h"
80double fonc_des_surface_x(
double,
const Param&) ;
81double fonc_des_surface_y(
double,
const Param&) ;
82double fonc_des_surface_z(
double,
const Param&) ;
86void des_surface_x(
const Cmp& defsurf,
double x0,
const char* device,
int newgraph,
87 double y_min,
double y_max,
double z_min,
double z_max,
88 const char* nomy,
const char* nomz,
const char* title,
int nxpage,
int nypage)
90 using namespace Unites ;
92 assert(defsurf.get_etat() == ETATQCQ) ;
95 const Map* mp = defsurf.get_mp();
101 parzerosec.add_double_mod(khi, 1) ;
102 parzerosec.add_cmp(defsurf) ;
106 mp->val_r(mp->get_mg()->get_nzone() - 1, -1., 0., 0.) ;
107 double precis = 1.e-8 ;
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_surface_x, parzerosec, rhomin, rhomax, 100,
130 rhomin0, rhomax0) ==
false ) {
132 "des_surface_x : WARNING : no interval containing a zero of defsurf"
134 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
136 coupe_surface = false ;
144 double rho =
zerosec(fonc_des_surface_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) ;
154 if ( (newgraph == 1) || (newgraph == 3) ) {
156 if (device == 0x0) device =
"?" ;
158 int ier = cpgbeg(0, device, nxpage, nypage) ;
160 cout <<
"des_surface_x: problem in opening PGPLOT display !" << endl ;
164 float size = float(1.3) ;
173 float ymin1 = float(y_min / km) ;
174 float ymax1 = float(y_max / km) ;
175 float zmin1 = float(z_min / km) ;
176 float zmax1 = float(z_max / km) ;
178 cpgenv(ymin1, ymax1, zmin1, zmax1, 1, 0 ) ;
180 if (nomy == 0x0) nomy =
"y [km]" ;
181 if (nomz == 0x0) nomz =
"z [km]" ;
182 if (title == 0x0) title =
" " ;
183 cpglab(nomy,nomz,title) ;
190 cpgline(np, yg, zg) ;
198 if ( (newgraph == 2) || (newgraph == 3) ) {
206void des_surface_y(
const Cmp& defsurf,
double y0,
const char* device,
int newgraph,
207 double x_min,
double x_max,
double z_min,
double z_max,
208 const char* nomx,
const char* nomz,
const char* title,
int nxpage,
int nypage)
210 using namespace Unites ;
212 assert(defsurf.get_etat() == ETATQCQ) ;
215 const Map* mp = defsurf.get_mp();
221 parzerosec.add_double_mod(khi, 1) ;
222 parzerosec.add_cmp(defsurf) ;
226 mp->val_r(mp->get_mg()->get_nzone() - 1, -1., 0., 0.) ;
227 double precis = 1.e-8 ;
235 double hkhi = 2 * M_PI / (np-1) ;
237 bool coupe_surface = true ;
239 for (
int i=0; i< np; i++) {
249 if (
zero_premier(fonc_des_surface_y, parzerosec, rhomin, rhomax, 100,
250 rhomin0, rhomax0) ==
false ) {
252 "des_surface_y : WARNING : no interval containing a zero of defsurf"
254 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
256 coupe_surface = false ;
264 double rho =
zerosec(fonc_des_surface_y, parzerosec, rhomin0, rhomax0,
265 precis, nitermax, niter) ;
267 xg[i] = float(( rho *
cos(khi) + mp->get_ori_x() ) / km) ;
268 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_surface_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) ;
318 if ( (newgraph == 2) || (newgraph == 3) ) {
326void des_surface_z(
const Cmp& defsurf,
double z0,
const char* device,
int newgraph,
327 double x_min,
double x_max,
double y_min,
double y_max,
328 const char* nomx,
const char* nomy,
const char* title,
int nxpage,
int nypage)
330 using namespace Unites ;
332 assert(defsurf.get_etat() == ETATQCQ) ;
335 const Map* mp = defsurf.get_mp();
341 parzerosec.add_double_mod(khi, 1) ;
342 parzerosec.add_cmp(defsurf) ;
346 mp->val_r(mp->get_mg()->get_nzone() - 1, -1., 0., 0.) ;
347 double precis = 1.e-8 ;
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_surface_z, parzerosec, rhomin, rhomax, 100,
370 rhomin0, rhomax0) ==
false ) {
372 "des_surface_z : WARNING : no interval containing a zero of defsurf"
374 cout <<
" has been found for khi = " << khi <<
" !" << endl ;
376 coupe_surface = false ;
384 double rho =
zerosec(fonc_des_surface_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) ;
394 if ( (newgraph == 1) || (newgraph == 3) ) {
396 if (device == 0x0) device =
"?" ;
398 int ier = cpgbeg(0, device, nxpage, nypage) ;
400 cout <<
"des_surface_z: problem in opening PGPLOT display !" << endl ;
404 float size = float(1.3) ;
413 float xmin1 = float(x_min / km) ;
414 float xmax1 = float(x_max / km) ;
415 float ymin1 = float(y_min / km) ;
416 float ymax1 = float(y_max / km) ;
418 cpgenv(xmin1, xmax1, ymin1, ymax1, 1, 0 ) ;
420 if (nomx == 0x0) nomx =
"x [km]" ;
421 if (nomy == 0x0) nomy =
"y [km]" ;
422 if (title == 0x0) title =
" " ;
423 cpglab(nomx,nomy,title) ;
430 cpgline(np, xg, yg) ;
438 if ( (newgraph == 2) || (newgraph == 3) ) {
455double fonc_des_surface_x(
double vrho,
const Param& par) {
457 double x = par.get_double_mod(0) ;
458 double khi = par.get_double_mod(1) ;
459 const Cmp& defsurf = par.get_cmp() ;
460 const Map& mp = *(defsurf.get_mp()) ;
463 double y = vrho *
cos(khi) + mp.get_ori_y() ;
464 double z = vrho *
sin(khi) + mp.get_ori_z() ;
467 double r, theta,
phi ;
468 mp.convert_absolute(
x,
y,
z,
r, theta,
phi) ;
470 return defsurf.val_point(
r, theta,
phi) ;
476double fonc_des_surface_y(
double vrho,
const Param& par) {
478 double y = par.get_double_mod(0) ;
479 double khi = par.get_double_mod(1) ;
480 const Cmp& defsurf = par.get_cmp() ;
481 const Map& mp = *(defsurf.get_mp()) ;
484 double x = vrho *
cos(khi) + mp.get_ori_x() ;
485 double z = vrho *
sin(khi) + mp.get_ori_z() ;
488 double r, theta,
phi ;
489 mp.convert_absolute(
x,
y,
z,
r, theta,
phi) ;
491 return defsurf.val_point(
r, theta,
phi) ;
497double fonc_des_surface_z(
double vrho,
const Param& par) {
499 double z = par.get_double_mod(0) ;
500 double khi = par.get_double_mod(1) ;
501 const Cmp& defsurf = par.get_cmp() ;
502 const Map& mp = *(defsurf.get_mp()) ;
505 double x = vrho *
cos(khi) + mp.get_ori_x() ;
506 double y = vrho *
sin(khi) + mp.get_ori_y() ;
509 double r, theta,
phi ;
510 mp.convert_absolute(
x,
y,
z,
r, theta,
phi) ;
512 return defsurf.val_point(
r, theta,
phi) ;
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
void add_double_mod(double &x, int position=0)
Adds the address of a new modifiable double to the list.
Cmp sin(const Cmp &)
Sine.
Cmp cos(const Cmp &)
Cosine.
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.
Coord z
z coordinate centered on the grid
Coord y
y coordinate centered on the grid
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord phi
coordinate centered on the grid
Coord x
x coordinate centered on the grid
Coord r
r coordinate centered on the grid