82#include "utilitaires.h"
86double fonc_invr_map_et_noyau(
double,
const Param&) ;
87double fonc_invr_map_et_coq(
double,
const Param&) ;
88double fonc_invr_map_et_zec(
double,
const Param&) ;
95double Map_et::val_r(
int l,
double xi,
double theta,
double pphi)
const {
98 assert( l<mg->get_nzone() ) ;
101 double ftp =
ff.val_point(l, 0, theta, pphi) ;
103 switch( mg->get_type_r(l) ) {
106 double gtp =
gg.val_point(l, 0, theta, pphi) ;
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] ;
116 double gtp =
gg.val_point(l, 0, theta, pphi) ;
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 {
175 int nz = mg->get_nzone() ;
187 if (rr == __infinity) {
188 if ( (mg->get_type_r(nz-1) == UNSURR) &&
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++) {
213 switch( mg->get_type_r(l) ) {
216 ftp =
ff.val_point(l, 0, theta, pphi) ;
217 gtp =
gg.val_point(l, 0, theta, pphi) ;
218 rmax =
alpha[l] * ( double(1) + ftp + gtp ) +
beta[l] ;
224 gtp =
gg.val_point(l, 0, theta, pphi) ;
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++) {
258 ftp =
ff.val_point(l, 0, theta, pphi) ;
259 gtp =
gg.val_point(l, 0, theta, pphi) ;
260 switch( mg->get_type_r(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) ) {
304 switch( mg->get_type_r(lz) ) {
307 if ( (
ff.get_etat()==ETATZERO) && (
gg.get_etat()==ETATZERO) ) {
313 xi =
zerosec(fonc_invr_map_et_noyau, parzerosec, xmin, xmax,
314 precis, nitermax, niter) ;
320 if ( (
ff.get_etat()==ETATZERO) && (
gg.get_etat()==ETATZERO) ) {
326 xi =
zerosec(fonc_invr_map_et_coq, parzerosec, xmin, xmax,
327 precis, nitermax, niter) ;
333 if ( (
ff.get_etat()==ETATZERO) ) {
334 xi = ( double(1)/rr -
beta[lz] ) /
alpha[lz] ;
337 assert(
ff.get_etat()==ETATQCQ) ;
338 if (
ff.c->t[lz]->get_etat() == ETATZERO) {
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) ;
378 switch( mg->get_type_r(l) ) {
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 {
424 int nz = mg->get_nzone() ;
436 if (rr == __infinity) {
437 if ( (mg->get_type_r(nz-1) == UNSURR) &&
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++) {
462 switch( mg->get_type_r(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) ;
509 switch( mg->get_type_r(l) ) {
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) ) {
553 switch( mg->get_type_r(lz) ) {
556 if ( (
ff.get_etat()==ETATZERO) && (
gg.get_etat()==ETATZERO) ) {
562 xi =
zerosec(fonc_invr_map_et_noyau, parzerosec, xmin, xmax,
563 precis, nitermax, niter) ;
569 if ( (
ff.get_etat()==ETATZERO) && (
gg.get_etat()==ETATZERO) ) {
575 xi =
zerosec(fonc_invr_map_et_coq, parzerosec, xmin, xmax,
576 precis, nitermax, niter) ;
582 if ( (
ff.get_etat()==ETATZERO) ) {
583 xi = ( double(1)/rr -
beta[lz] ) /
alpha[lz] ;
586 assert(
ff.get_etat()==ETATQCQ) ;
587 if (
ff.c->t[lz]->get_etat() == ETATZERO) {
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 ;
615double 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 ;
633double 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 ;
651double 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 ;
double * beta
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.
Valeur ff
Values of the function at the nt*np angular collocation points in each domain.
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.
Valeur gg
Values of the function at the nt*np angular collocation points in each domain.
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...
void add_double(const double &x, int position=0)
Adds the the address of a new double to the list.
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
const double & get_double(int position=0) const
Returns the reference of a double stored in the list.
void add_int_mod(int &n, int position=0)
Adds the address of a new modifiable int to the list.
int & get_int_mod(int position=0) const
Returns the reference of a modifiable int stored in the list.
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
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 x
x coordinate centered on the grid
Coord r
r coordinate centered on the grid