144 #include "utilitaires.h" 157 aasx( mgrille.get_nr(0) ),
158 aasx2( mgrille.get_nr(0) ),
159 zaasx( mgrille.get_nr(mgrille.get_nzone()-1) ),
160 zaasx2( mgrille.get_nr(mgrille.get_nzone()-1) ),
161 bbsx( mgrille.get_nr(0) ),
162 bbsx2( mgrille.get_nr(0) ),
163 ff(mgrille.get_angu()) ,
164 gg(mgrille.get_angu())
178 alpha =
new double[nzone] ;
179 beta =
new double[nzone] ;
181 for (
int l=0 ; l<nzone ; l++) {
184 alpha[l] = bornes[l+1] - bornes[l] ;
185 beta[l] = bornes[l] ;
190 alpha[l] = (bornes[l+1] - bornes[l]) * .5 ;
191 beta[l] = (bornes[l+1] + bornes[l]) * .5 ;
196 double umax = double(1) / bornes[l] ;
197 double umin = double(1) /bornes[l+1] ;
198 alpha[l] = (umin - umax) *
double(0.5) ;
199 beta[l] = (umin + umax) *
double(0.5) ;
204 cout <<
"Map_et::Map_et: unkown type_r ! " << endl ;
231 aasx(grille.get_nr(0) ),
232 aasx2(grille.get_nr(0) ),
233 zaasx(grille.get_nr(grille.get_nzone()-1) ),
234 zaasx2(grille.get_nr(grille.get_nzone()-1) ),
235 bbsx(grille.get_nr(0) ),
236 bbsx2(grille.get_nr(0) ),
237 ff(grille.get_angu()) ,
238 gg(grille.get_angu()) {
244 Map_et mapping (grille, r_lim) ;
250 int np = grille.
get_np(0) ;
251 int nt = grille.
get_nt(0) ;
253 double * cf =
new double [nt*(np+2)] ;
254 for (
int k=0 ; k<np ; k++)
255 for (
int j=0 ; j<nt ; j++)
256 cf[k*nt+j] = S_0(k,j) - S_0(0,0) ;
258 int* deg =
new int [3] ;
263 int* dim =
new int [3] ;
268 Tbl ff_nucleus (np,nt) ;
271 Tbl gg_nucleus (np,nt) ;
280 double * coloc_even ;
284 cfpcossin (deg,dim,cf) ;
287 odd =
new double [nt*(np+2)] ;
288 even =
new double [nt*(np+2)] ;
291 for (
int k=0 ; k<np+2 ; k++)
292 if ((k%4 == 0) || (k%4==1))
293 for (
int j=0 ; j<nt ; j++) {
295 even[k*nt+j] = cf[k*nt+j] ;
298 if ((k%4 == 2) || (k%4 == 3))
299 for (
int j=0 ; j<nt ; j++) {
301 odd[k*nt+j] = cf[k*nt+j] ;
305 cout <<
"Erreur bizzare..." << endl ;
309 coloc_odd =
new double [nt*np] ;
310 coloc_even =
new double [nt*np] ;
312 cipcossin (deg,dim,deg,odd,coloc_odd) ;
313 cipcossin (deg,dim,deg,even,coloc_even) ;
314 for (
int k=0 ; k<np ; k++)
315 for (
int j=0 ; j<nt ; j++) {
316 gg_nucleus.
set(k,j) = coloc_even[k*nt+j] ;
317 ff_nucleus.
set(k,j) = coloc_odd[k*nt+j] ;
322 delete [] coloc_even ;
323 delete [] coloc_odd ;
332 for (
int k=0 ; k<np ; k++)
333 for (
int j=0 ; j<nt ; j++) {
334 gg_nucleus.
set(k,j) = S_0(k,j) - S_0(0,0) ;
335 ff_nucleus.
set(k,j) = 0. ;
346 cout <<
"Base_p != P_COSSIN not implemented in Map_et constructor" <<
352 double mu_nucleus = -
min(gg_nucleus) ;
353 double alpha_nucleus = S_0(0,0)-mu_nucleus ;
355 ff_nucleus /= alpha_nucleus ;
356 gg_nucleus += mu_nucleus ;
357 gg_nucleus /= alpha_nucleus ;
360 Tbl ff_shell (np,nt) ;
362 ff_shell = S_0 - S_0(0,0) ;
364 double lambda_shell = -
max(ff_shell) ;
366 double R_ext = r_lim[2] ;
368 double beta_shell = (R_ext+S_0(0,0)-lambda_shell)/2. ;
369 double alpha_shell = (R_ext-S_0(0,0)+lambda_shell)/2. ;
371 ff_shell += lambda_shell ;
372 ff_shell /= alpha_shell ;
380 for (
int k=0 ; k<np ; k++)
381 for (
int j=0 ; j<nt ; j++) {
382 ff.
set(0,k,j,0) = ff_nucleus(k,j) ;
383 gg.
set(0,k,j,0) = gg_nucleus(k,j) ;
384 ff.
set(1,k,j,0) = ff_shell(k,j) ;
393 alpha =
new double[nz] ;
394 alpha[0] = alpha_nucleus ;
395 alpha[1] = alpha_shell ;
397 beta =
new double[nz] ;
399 beta[1] = beta_shell ;
400 for (
int i=2 ; i<nz ; i++) {
401 alpha[i] = mapping.get_alpha()[i] ;
402 beta[i] = mapping.get_beta()[i] ;
415 zaasx2( mpi.zaasx2 ),
429 alpha =
new double[nzone] ;
430 beta =
new double[nzone] ;
432 for (
int l=0 ; l<nzone ; l++) {
450 assert(l<mg->get_nzone()) ;
461 assert(l<mg->get_nzone()) ;
474 aasx( mgi.get_nr(0) ),
475 aasx2( mgi.get_nr(0) ),
476 zaasx( mgi.get_nr(mgi.get_nzone()-1) ),
477 zaasx2( mgi.get_nr(mgi.get_nzone()-1) ),
478 bbsx( mgi.get_nr(0) ),
479 bbsx2( mgi.get_nr(0) ),
480 ff(*(mgi.get_angu()), fich) ,
481 gg(*(mgi.get_angu()), fich)
489 alpha =
new double[nz] ;
490 beta =
new double[nz] ;
610 r.
set(
this, map_et_fait_r) ;
611 tet.
set(
this, map_et_fait_tet) ;
612 phi.
set(
this, map_et_fait_phi) ;
613 sint.
set(
this, map_et_fait_sint) ;
614 cost.
set(
this, map_et_fait_cost) ;
615 sinp.
set(
this, map_et_fait_sinp) ;
616 cosp.
set(
this, map_et_fait_cosp) ;
618 x.
set(
this, map_et_fait_x) ;
619 y.
set(
this, map_et_fait_y) ;
620 z.
set(
this, map_et_fait_z) ;
622 xa.
set(
this, map_et_fait_xa) ;
623 ya.
set(
this, map_et_fait_ya) ;
624 za.
set(
this, map_et_fait_za) ;
627 xsr.
set(
this, map_et_fait_xsr) ;
628 dxdr.
set(
this, map_et_fait_dxdr) ;
629 drdt.
set(
this, map_et_fait_drdt) ;
672 aa =
new Tbl*[nzone] ;
675 bb =
new Tbl*[nzone] ;
679 for (
int l=0; l<nzone; l++) {
681 aa[l] =
new Tbl(nr) ;
684 bb[l] =
new Tbl(nr) ;
705 for (
int i=0; i<
mg->
get_nr(0); i++) {
708 double x2 = x1 * x1 ;
709 double x3 = x1 * x2 ;
720 aa[0]->
set(i) = x2 * x2 * (3. - 2.*x2) ;
721 daa[0]->
set(i) = 12. * x3 * (1. + x1) * (1. - x1) ;
722 ddaa[0]->
set(i) = 12. *x2 *(3. - 5.* x2) ;
723 aasx.
set(i) = x3 * (3. - 2.*x2) ;
728 bb[0]->
set(i) = 0.5 * x3 * (5. - 3.* x2) ;
729 dbb[0]->
set(i) = 7.5 * x2 * (1. + x1) * (1. - x1) ;
730 ddbb[0]->
set(i) = 15. * x1 * ( 1. - 2.*x2 ) ;
731 bbsx.
set(i) = 0.5 * x2 * (5. - 3.* x2) ;
732 bbsx2.
set(i) = 0.5 * x1 * (5. - 3.* x2) ;
738 for (
int l=1; l<nzone; l++) {
750 for (
int i=0; i<
mg->
get_nr(l); i++) {
753 double xm1 = x1 - 1. ;
754 double xp1 = x1 + 1. ;
758 aa[l]->
set(i) = 0.25* xm1 * xm1 * (x1 + 2.) ;
759 daa[l]->
set(i) = 0.75* xm1 * xp1 ;
764 bb[l]->
set(i) = 0.25* xp1 * xp1 * (2. - x1) ;
765 dbb[l]->
set(i) = - 0.75* xm1 * xp1 ;
774 int nzm1 = nzone - 1 ;
780 for (
int i=0; i<
mg->
get_nr(nzm1); i++) {
783 zaasx.
set(i) = 0.25 * (x1 - 1.) * (2. + x1) ;
826 "Radial mapping of form r = xi + A(xi)F(t,p) + B(xi)G(t,p) (class Map_et)" 829 for (
int l=0; l<nz; l++) {
830 ost <<
" Domain #" << l <<
" : alpha_l = " <<
alpha[l]
831 <<
" , beta_l = " <<
beta[l] << endl ;
833 ost << endl <<
"Function F(theta', phi') : " << endl ;
834 ost <<
"------------------------- " << endl ;
836 ost << endl <<
"Function G(theta', phi') : " << endl ;
837 ost <<
"------------------------- " << endl ;
844 <<
"Values of r at the outer boundary of each domain [km] :" << endl ;
845 ost <<
"------------------------------------------------------" << endl ;
846 ost <<
" 1/ for theta = Pi/2 and phi = 0 : " << endl ;
848 for (
int l=0; l<nz; l++) {
849 ost <<
" " <<
val_r(l, 1., M_PI/2, 0) / km ;
853 if ( type_t == SYM ) {
854 assert( (type_p == SYM) || (type_p == NONSYM) ) ;
855 ost <<
" Coord r : " ;
856 for (
int l=0; l<nz; l++) {
859 ost <<
" " << (+
r)(l, 0, ntm1, nrm1) / km ;
864 ost <<
" 2/ for theta = Pi/2 and phi = Pi/2 : " << endl ;
866 for (
int l=0; l<nz; l++) {
867 ost <<
" " <<
val_r(l, 1., M_PI/2, M_PI/2) / km ;
871 if ( type_t == SYM ) {
872 ost <<
" Coord r : " ;
873 for (
int l=0; l<nz; l++) {
877 if ( (type_p == NONSYM) && (np % 4 == 0) ) {
878 ost <<
" " << (+
r)(l, np/4, ntm1, nrm1) / km ;
880 if ( type_p == SYM ) {
881 ost <<
" " << (+
r)(l, np/2, ntm1, nrm1) / km ;
887 ost <<
" 3/ for theta = Pi/2 and phi = Pi : " << endl ;
889 for (
int l=0; l<nz; l++) {
890 ost <<
" " <<
val_r(l, 1., M_PI/2, M_PI) / km ;
894 if ( (type_t == SYM) && (type_p == NONSYM) ) {
895 ost <<
" Coord r : " ;
896 for (
int l=0; l<nz; l++) {
900 ost <<
" " << (+
r)(l, np/2, ntm1, nrm1) / km ;
905 ost <<
" 4/ for theta = 0 : " << endl ;
907 for (
int l=0; l<nz; l++) {
908 ost <<
" " <<
val_r(l, 1., 0., 0.) / km ;
912 ost <<
" Coord r : " ;
913 for (
int l=0; l<nz; l++) {
915 ost <<
" " << (+
r)(l, 0, 0, nrm1) / km ;
932 for (
int l=0; l<nz; l++) {
956 cout <<
"Map_et::resize can be applied only to a shell !" << endl ;
962 double n_alpha = 0.5 * ( (lambda + 1.) *
alpha[l] +
963 (lambda - 1.) *
beta[l] ) ;
965 double n_beta = 0.5 * ( (lambda - 1.) *
alpha[l] +
966 (lambda + 1.) *
beta[l] ) ;
976 assert(l<mg->get_nzone()-1) ;
981 assert(
ff(lp1).get_etat() == ETATZERO ) ;
982 assert(
gg(lp1).get_etat() == ETATZERO ) ;
997 alpha[lp1] = n_alpha ;
1010 double precis = 1e-10 ;
1014 const Map_et* mp0 =
dynamic_cast<const Map_et*
>(&mpi) ;
1029 for (
int i=0 ; i<nz ; i++) {
1032 if ((i!=0) && (i!=nz-1))
1069 const char* f = __FILE__ ;
Coord xa
Absolute x coordinate.
int get_type_p() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the transformatio...
Coord d2rdx2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Tbl ** bb
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
Coord sr2d2rdt2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord sr2stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Tbl zaasx
Values at the nr collocation points of in the outermost compactified domain.
const double * get_alpha() const
Returns the pointer on the array alpha.
void fait_poly()
Construction of the polynomials and .
void set_gg(const Valeur &)
Assigns a given value to the function .
Radial mapping of rather general form.
const double * get_alpha() const
Returns a pointer on the array alpha (values of in each domain)
#define P_COSSIN
dev. standart
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
const double * get_beta() const
Returns a pointer on the array beta (values of in each domain)
void set_rot_phi(double phi0)
Sets a new rotation angle.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
double get_ori_y() const
Returns the y coordinate of the origin.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
Standard units of space, time and mass.
void annule_hard()
Sets the Valeur to zero in a hard way.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
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.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Coord sr2drdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Tbl bbsx
Values at the nr collocation points of in the nucleus.
Base class for coordinate mappings.
double get_ori_x() const
Returns the x coordinate of the origin.
const Valeur & get_gg() const
Returns a (constant) reference to the function .
int get_type_t() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the equatorial pl...
Values and coefficients of a (real-value) function.
Map_af * p_mp_angu
Pointer on the "angular" mapping.
double get_rot_phi() const
Returns the angle between the x –axis and X –axis.
void annule(int l)
Sets the Valeur to zero in a given domain.
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
void set(const Map *mp, Mtbl *(*construct)(const Map *))
Semi-constructor from a mapping and a method.
Tbl ** ddbb
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
Tbl ** daa
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
Coord srstdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
void std_base_scal()
Sets the bases for spectral expansions (member base ) to the standard ones for a scalar.
Coord tet
coordinate centered on the grid
void set_ori(double xa0, double ya0, double za0)
Sets a new origin.
Coord phi
coordinate centered on the grid
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_ndim() const
Gives the number of dimensions (ie dim.ndim)
const Valeur & get_ff() const
Returns a (constant) reference to the function .
virtual void sauve(FILE *) const
Save in a file.
Tbl aasx2
Values at the nr collocation points of in the nucleus.
Valeur ff
Values of the function at the nt*np angular collocation points in each domain.
Coord stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED)...
void sauve(FILE *) const
Save in a file.
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
double ori_y
Absolute coordinate y of the origin.
const double * get_beta() const
Returns the pointer on the array beta.
double ori_z
Absolute coordinate z of the origin.
void affiche_seuil(ostream &ostr, int type=0, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
virtual void resize(int l, double lambda)
Rescales the outer boundary of one domain.
Coord rsx2drdx
in the nucleus and the shells; \ in the outermost compactified domain.
Base class for pure radial mappings.
Tbl ** aa
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
int get_nzone() const
Returns the number of domains.
void set_alpha(double alpha0, int l)
Modifies the value of in domain no. l.
virtual void homothetie(double lambda)
Sets a new radial scale.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Coord sstd2rdpdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
virtual void sauve(FILE *) const
Save in a file.
int get_base_p(int l) const
Returns the expansion basis for functions in the domain of index l (e.g.
Coord xsr
in the nucleus; \ 1/R in the non-compactified shells; \ in the compactified outer domain...
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i])
Coord drdt
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED)...
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Coord rsxdxdr
in the nucleus; \ in the shells; \ in the outermost compactified domain.
virtual void reset_coord()
Resets all the member Coords.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Coord ya
Absolute y coordinate.
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
Base_val std_base_scal() const
Returns the standard spectral bases for a scalar.
double ori_x
Absolute coordinate x of the origin.
Tbl zaasx2
Values at the nr collocation points of in the outermost compactified domain.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
Valeur gg
Values of the function at the nt*np angular collocation points in each domain.
Coord y
y coordinate centered on the grid
Coord za
Absolute z coordinate.
Coord lapr_tp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
virtual const Map_af & mp_angu(int) const
Returns the "angular" mapping for the outside of domain l_zone.
virtual ~Map_et()
Destructor.
double * beta
Array (size: mg->nzone ) of the values of in each domain.
virtual void operator=(const Map_et &mp)
Assignment to another Map_et.
Coord x
x coordinate centered on the grid
Base_vect_spher bvect_spher
Orthonormal vectorial basis associated with the coordinates of the mapping.
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c )...
Map_et(const Mg3d &mgrille, const double *r_limits)
Standard Constructor.
double get_ori_z() const
Returns the z coordinate of the origin.
virtual void reset_coord()
Resets all the member Coords.
void set_ff(const Valeur &)
Assigns a given value to the function .
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
void set_coord()
Assignement of the building functions to the member Coords.
#define P_COSSIN_P
dev. sur Phi = 2*phi, freq. paires
virtual bool operator==(const Map &) const
Comparison operator (egality)
Tbl bbsx2
Values at the nr collocation points of in the nucleus.
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
void set_beta(double beta0, int l)
Modifies the value of in domain no. l.
virtual ostream & operator>>(ostream &) const
Operator >>
Coord srdrdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord z
z coordinate centered on the grid
Tbl ** dbb
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
Tbl aasx
Values at the nr collocation points of in the nucleus.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Base_vect_cart bvect_cart
Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
void del_t() const
Logical destructor (deletes the Mtbl member *c ).
Tbl ** ddaa
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
Coord r
r coordinate centered on the grid
Coord d2rdtdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Tbl & set(int l)
Read/write of the value in a given domain (configuration space).