82 #include "utilitaires.h" 86 double fonc_invr_map_et_noyau(
double,
const Param&) ;
87 double fonc_invr_map_et_coq(
double,
const Param&) ;
88 double fonc_invr_map_et_zec(
double,
const Param&) ;
95 double Map_et::val_r(
int l,
double xi,
double theta,
double pphi)
const {
98 assert( l<mg->get_nzone() ) ;
107 double xi_2 = xi * xi ;
108 double xi_3 = xi * xi_2 ;
109 double a = xi_2 * xi_2 * (3. - 2.*xi_2) ;
110 double b = ( 2.5 - 1.5 * xi_2 ) * xi_3 ;
111 resu =
alpha[l] * ( xi + a * ftp + b * gtp ) +
beta[l] ;
117 double xm1 = xi - 1. ;
118 double xp1 = xi + 1. ;
119 double a = 0.25* xm1 * xm1 * (xi + 2.) ;
120 double b = 0.25* xp1 * xp1 * (2. - xi) ;
121 resu =
alpha[l] * ( xi + a * ftp + b * gtp ) +
beta[l] ;
126 double xm1 = xi - 1. ;
127 double a = 0.25* xm1 * xm1 * (xi + 2.) ;
128 resu = double(1) / (
alpha[l] * ( xi + a * ftp ) +
beta[l] ) ;
133 cout <<
"Map_et::val_r: unknown type_r ! " << endl ;
150 int& lz,
double& xi)
const {
154 double precis = 1e-14 ;
163 val_lx(rr, theta, pphi, par, lz, xi) ;
173 const Param& par,
int& lz,
double& xi)
const {
187 if (rr == __infinity) {
195 cout.setf(ios::showpoint);
196 cout <<
"Map_et::val_lx: the domain containing r = " << rr <<
197 " has not been found ! " 209 double ftp = double(0) ;
210 double gtp = double(0) ;
211 for (
int l=0; l<nz; l++) {
218 rmax =
alpha[l] * ( double(1) + ftp + gtp ) +
beta[l] ;
225 rmax =
alpha[l] * ( double(1) + gtp ) +
beta[l] ;
232 rmax = double(1) / (
alpha[l] +
beta[l] ) ;
237 cout <<
"Map_et::val_lx: unknown type_r ! " << endl ;
243 if ( rr <= rmax + 1.e-14 ) {
245 if (ftp ==
double(0)) ftp =
ff.
val_point(l, 0, theta, pphi) ;
246 if (gtp ==
double(0)) gtp =
gg.
val_point(l, 0, theta, pphi) ;
253 cout.setf(ios::showpoint);
254 cout <<
"Map_et::val_lx: the domain containing r = " << rr <<
255 " has not been found ! " 257 for (
int l=0; l<nz; l++) {
262 rmax =
alpha[l] * ( double(1) + ftp + gtp ) +
beta[l] ;
266 rmax =
alpha[l] * ( double(1) + gtp ) +
beta[l] ;
270 rmax = double(1) / (
alpha[l] +
beta[l] ) ;
274 cout <<
"Map_et::val_lx: unknown type_r ! " << endl ;
279 cout <<
"domain: " << l <<
" theta = " << theta <<
" phi = " 280 << pphi <<
" : rmax = " << rmax << endl ;
288 if ( (rr >= rmax) && ( rr <= rmax + 1.e-14) ) {
313 xi =
zerosec(fonc_invr_map_et_noyau, parzerosec, xmin, xmax,
314 precis, nitermax, niter) ;
326 xi =
zerosec(fonc_invr_map_et_coq, parzerosec, xmin, xmax,
327 precis, nitermax, niter) ;
334 xi = ( double(1)/rr -
beta[lz] ) /
alpha[lz] ;
339 xi = ( double(1) / rr -
beta[lz] ) /
alpha[lz] ;
344 xi =
zerosec(fonc_invr_map_et_zec, parzerosec, xmin, xmax,
345 precis, nitermax, niter) ;
352 cout <<
"Map_et::val_lx: unknown type_r ! " << endl ;
373 assert( l<mg->get_nzone() ) ;
376 double ftp =
ff(l, k, j, 0) ;
381 double gtp =
gg(l, k, j, 0) ;
382 double xi_2 = xi * xi ;
383 double xi_3 = xi * xi_2 ;
384 double a = xi_2 * xi_2 * (3. - 2.*xi_2) ;
385 double b = ( 2.5 - 1.5 * xi_2 ) * xi_3 ;
386 resu =
alpha[l] * ( xi + a * ftp + b * gtp ) +
beta[l] ;
391 double gtp =
gg(l, k, j, 0) ;
392 double xm1 = xi - 1. ;
393 double xp1 = xi + 1. ;
394 double a = 0.25* xm1 * xm1 * (xi + 2.) ;
395 double b = 0.25* xp1 * xp1 * (2. - xi) ;
396 resu =
alpha[l] * ( xi + a * ftp + b * gtp ) +
beta[l] ;
401 double xm1 = xi - 1. ;
402 double a = 0.25* xm1 * xm1 * (xi + 2.) ;
403 resu = double(1) / (
alpha[l] * ( xi + a * ftp ) +
beta[l] ) ;
408 cout <<
"Map_et::val_r_jk: unknown type_r ! " << endl ;
422 int& lz,
double& xi)
const {
436 if (rr == __infinity) {
444 cout.setf(ios::showpoint);
445 cout <<
"Map_et::val_lx_jk: the domain containing r = " << rr <<
446 " has not been found ! " 458 double ftp = double(0) ;
459 double gtp = double(0) ;
460 for (
int l=0; l<nz; l++) {
465 ftp =
ff(l, k, j, 0) ;
466 gtp =
gg(l, k, j, 0) ;
467 rmax =
alpha[l] * ( double(1) + ftp + gtp ) +
beta[l] ;
473 gtp =
gg(l, k, j, 0) ;
474 rmax =
alpha[l] * ( double(1) + gtp ) +
beta[l] ;
481 rmax = double(1) / (
alpha[l] +
beta[l] ) ;
486 cout <<
"Map_et::val_lx_jk: unknown type_r ! " << endl ;
492 if ( rr <= rmax + 1.e-14 ) {
494 if (ftp ==
double(0)) ftp =
ff(l, k, j, 0) ;
495 if (gtp ==
double(0)) gtp =
gg(l, k, j, 0) ;
502 cout.setf(ios::showpoint);
503 cout <<
"Map_et::val_lx_jk: the domain containing r = " << rr <<
504 " has not been found ! " 506 for (
int l=0; l<nz; l++) {
507 ftp =
ff(l, k, j, 0) ;
508 gtp =
gg(l, k, j, 0) ;
511 rmax =
alpha[l] * ( double(1) + ftp + gtp ) +
beta[l] ;
515 rmax =
alpha[l] * ( double(1) + gtp ) +
beta[l] ;
519 rmax = double(1) / (
alpha[l] +
beta[l] ) ;
523 cout <<
"Map_et::val_lx_jk: unknown type_r ! " << endl ;
528 cout <<
"domain: " << l <<
" j = " << j <<
" k = " << k
529 <<
" : rmax = " << rmax << endl ;
537 if ( (rr >= rmax) && ( rr <= rmax + 1.e-14) ) {
562 xi =
zerosec(fonc_invr_map_et_noyau, parzerosec, xmin, xmax,
563 precis, nitermax, niter) ;
575 xi =
zerosec(fonc_invr_map_et_coq, parzerosec, xmin, xmax,
576 precis, nitermax, niter) ;
583 xi = ( double(1)/rr -
beta[lz] ) /
alpha[lz] ;
588 xi = ( double(1) / rr -
beta[lz] ) /
alpha[lz] ;
593 xi =
zerosec(fonc_invr_map_et_zec, parzerosec, xmin, xmax,
594 precis, nitermax, niter) ;
601 cout <<
"Map_et::val_lx_jk: unknown type_r ! " << endl ;
615 double fonc_invr_map_et_noyau(
double x,
const Param& par) {
623 double x_3 = x_2 * x ;
624 double a = x_2 * x_2 * (3. - 2.*x_2) ;
625 double b = ( 2.5 - 1.5 * x_2 ) * x_3 ;
627 return alp * ( x + a * f + b * g ) + bet - r ;
633 double fonc_invr_map_et_coq(
double x,
const Param& par) {
635 double r = par.get_double(0) ;
636 double f = par.get_double(1) ;
637 double g = par.get_double(2) ;
638 double alp = par.get_double(3) ;
639 double bet = par.get_double(4) ;
640 double xm1 = x - 1. ;
641 double xp1 = x + 1. ;
642 double a = 0.25* xm1 * xm1 * (x + 2.) ;
643 double b = 0.25* xp1 * xp1 * (2. - x) ;
645 return alp * ( x + a * f + b * g ) + bet - r ;
651 double fonc_invr_map_et_zec(
double x,
const Param& par) {
653 double r = par.get_double(0) ;
654 double f = par.get_double(1) ;
655 double alp = par.get_double(3) ;
656 double bet = par.get_double(4) ;
657 double xm1 = x - 1. ;
658 double a = 0.25* xm1 * xm1 * (x + 2.) ;
660 return alp * ( x + a * f ) + bet -
double(1) / r ;
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
virtual void val_lx(double rr, double theta, double pphi, int &l, double &xi) const
Computes the domain index l and the value of corresponding to a point given by its physical coordina...
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
virtual void val_lx_jk(double rr, int j, int k, const Param &par, int &l, double &xi) const
Computes the domain index l and the value of corresponding to a point of arbitrary r but collocation...
virtual double val_r(int l, double xi, double theta, double pphi) const
Returns the value of the radial coordinate r for a given in a given domain.
int get_etat() const
Gives the logical state.
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.
int get_etat() const
Returns the logical state.
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
double val_point(int l, double x, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point, by means of the spectral ...
Valeur ff
Values of the function at the nt*np angular collocation points in each domain.
Mtbl * c
Values of the function at the points of the multi-grid.
int get_nzone() const
Returns the number of domains.
int & get_int_mod(int position=0) const
Returns the reference of a modifiable int stored in the list.
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
Valeur gg
Values of the function at the nt*np angular collocation points in each domain.
void add_double(const double &x, int position=0)
Adds the the address of a new double to the list.
double * beta
Array (size: mg->nzone ) of the values of in each domain.
const double & get_double(int position=0) const
Returns the reference of a double stored in the list.
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
void add_int_mod(int &n, int position=0)
Adds the address of a new modifiable int to the list.
virtual double val_r_jk(int l, double xi, int j, int k) const
Returns the value of the radial coordinate r for a given and a given collocation point in in a give...