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())
176 int nzone = mg->get_nzone() ;
178 alpha =
new double[nzone] ;
179 beta =
new double[nzone] ;
181 for (
int l=0 ; l<nzone ; l++) {
182 switch (mg->get_type_r(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 ;
377 ff.set_etat_c_qcq() ;
378 gg.set_etat_c_qcq() ;
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++) {
427 int nzone = mg->get_nzone() ;
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)
488 int nz = mg->get_nzone() ;
489 alpha =
new double[nz] ;
490 beta =
new double[nz] ;
514 for (
int l=0 ; l<mg->get_nzone(); l++) {
538 assert(mpi.get_mg() == mg) ;
540 set_ori( mpi.get_ori_x(), mpi.get_ori_y(), mpi.get_ori_z() ) ;
547 for (
int l=0; l<mg->get_nzone(); l++){
564 assert(mpi.get_mg() == mg) ;
566 set_ori( mpi.get_ori_x(), mpi.get_ori_y(), mpi.get_ori_z() ) ;
573 for (
int l=0; l<mg->get_nzone(); l++){
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) ;
630 stdrdp.set(
this, map_et_fait_stdrdp) ;
631 srdrdt.set(
this, map_et_fait_srdrdt) ;
632 srstdrdp.set(
this, map_et_fait_srstdrdp) ;
633 sr2drdt.set(
this, map_et_fait_sr2drdt) ;
634 sr2stdrdp.set(
this, map_et_fait_sr2stdrdp) ;
635 d2rdx2.set(
this, map_et_fait_d2rdx2) ;
636 lapr_tp.set(
this, map_et_fait_lapr_tp) ;
637 d2rdtdx.set(
this, map_et_fait_d2rdtdx) ;
638 sstd2rdpdx.set(
this, map_et_fait_sstd2rdpdx) ;
639 sr2d2rdt2.set(
this, map_et_fait_sr2d2rdt2) ;
642 rsxdxdr.set(
this, map_et_fait_rsxdxdr) ;
643 rsx2drdx.set(
this, map_et_fait_rsx2drdx) ;
670 int nzone = mg->get_nzone() ;
672 aa =
new Tbl*[nzone] ;
675 bb =
new Tbl*[nzone] ;
679 for (
int l=0; l<nzone; l++) {
680 int nr = mg->get_nr(l) ;
681 aa[l] =
new Tbl(nr) ;
684 bb[l] =
new Tbl(nr) ;
691 assert( mg->get_type_r(0) == RARE || mg->get_type_r(0) == FIN ) ;
693 aa[0]->set_etat_qcq() ;
694 daa[0]->set_etat_qcq() ;
695 ddaa[0]->set_etat_qcq() ;
696 aasx.set_etat_qcq() ;
697 aasx2.set_etat_qcq() ;
699 bb[0]->set_etat_qcq() ;
700 dbb[0]->set_etat_qcq() ;
701 ddbb[0]->set_etat_qcq() ;
702 bbsx.set_etat_qcq() ;
703 bbsx2.set_etat_qcq() ;
705 for (
int i=0; i<mg->get_nr(0); i++) {
707 double x1 = (mg->get_grille3d(0))->x[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) ;
724 aasx2.set(i) = x2 * (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++) {
740 assert( (mg->get_type_r(l) == FIN)|| (mg->get_type_r(l) == UNSURR) ) ;
742 aa[l]->set_etat_qcq() ;
743 daa[l]->set_etat_qcq() ;
744 ddaa[l]->set_etat_qcq() ;
746 bb[l]->set_etat_qcq() ;
747 dbb[l]->set_etat_qcq() ;
748 ddbb[l]->set_etat_qcq() ;
750 for (
int i=0; i<mg->get_nr(l); i++) {
752 double x1 = (mg->get_grille3d(l))->x[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 ;
760 ddaa[l]->set(i) = 1.5* x1 ;
764 bb[l]->set(i) = 0.25* xp1 * xp1 * (2. - x1) ;
765 dbb[l]->set(i) = - 0.75* xm1 * xp1 ;
766 ddbb[l]->set(i) = - 1.5* x1 ;
774 int nzm1 = nzone - 1 ;
775 if ( mg->get_type_r(nzm1) == UNSURR ) {
777 zaasx.set_etat_qcq() ;
780 for (
int i=0; i<mg->get_nr(nzm1); i++) {
782 double x1 = (mg->get_grille3d(nzm1))->x[i] ;
783 zaasx.set(i) = 0.25 * (x1 - 1.) * (2. + x1) ;
784 zaasx2.set(i) = 0.25 * (2. + x1) ;
788 bb[nzm1]->set_etat_zero() ;
789 dbb[nzm1]->set_etat_zero() ;
790 ddbb[nzm1]->set_etat_zero() ;
811 int nz = mg->get_nzone() ;
826 "Radial mapping of form r = xi + A(xi)F(t,p) + B(xi)G(t,p) (class Map_et)"
828 int nz = mg->get_nzone() ;
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 ;
835 ff.affiche_seuil(ost) ;
836 ost << endl <<
"Function G(theta', phi') : " << endl ;
837 ost <<
"------------------------- " << endl ;
838 gg.affiche_seuil(ost) ;
840 int type_t = mg->get_type_t() ;
841 int type_p = mg->get_type_p() ;
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++) {
857 int nrm1 = mg->get_nr(l) - 1 ;
858 int ntm1 = mg->get_nt(l) - 1 ;
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++) {
874 int nrm1 = mg->get_nr(l) - 1 ;
875 int ntm1 = mg->get_nt(l) - 1 ;
876 int np = mg->get_np(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++) {
897 int nrm1 = mg->get_nr(l) - 1 ;
898 int ntm1 = mg->get_nt(l) - 1 ;
899 int np = mg->get_np(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++) {
914 int nrm1 = mg->get_nr(l) - 1 ;
915 ost <<
" " << (+
r)(l, 0, 0, nrm1) / km ;
930 int nz = mg->get_nzone() ;
932 for (
int l=0; l<nz; l++) {
933 if (mg->get_type_r(l) == UNSURR) {
955 if (mg->get_type_r(l) != FIN) {
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] ) ;
969 gg.set(l) = lambda *
alpha[l] / n_alpha *
gg(l) ;
976 assert(l<mg->get_nzone()-1) ;
979 if (mg->get_type_r(lp1) == UNSURR) {
981 assert(
ff(lp1).get_etat() == ETATZERO ) ;
982 assert(
gg(lp1).get_etat() == ETATZERO ) ;
990 assert( mg->get_type_r(lp1) == FIN ) ;
994 ff.set(lp1) =
alpha[l] / n_alpha *
gg(l) ;
995 gg.set(lp1) =
alpha[lp1] / n_alpha *
gg(lp1) ;
997 alpha[lp1] = n_alpha ;
1010 double precis = 1e-10 ;
1014 const Map_et* mp0 =
dynamic_cast<const Map_et*
>(&mpi) ;
1018 if (*mg != *(mpi.get_mg()))
1021 if (fabs(ori_x-mpi.get_ori_x()) > precis) resu = false ;
1022 if (fabs(ori_y-mpi.get_ori_y()) > precis) resu = false ;
1023 if (fabs(ori_z-mpi.get_ori_z()) > precis) resu = false ;
1025 if (
bvect_spher != mpi.get_bvect_spher()) resu = false ;
1026 if (
bvect_cart != mpi.get_bvect_cart()) resu = false ;
1028 int nz = mg->get_nzone() ;
1029 for (
int i=0 ; i<nz ; i++) {
1032 if ((i!=0) && (i!=nz-1))
1069 const char* f = __FILE__ ;
int get_base_p(int l) const
Returns the expansion basis for functions in the domain of index l (e.g.
const double * get_beta() const
Returns the pointer on the array beta.
const double * get_alpha() const
Returns the pointer on the array alpha.
const Valeur & get_ff() const
Returns a (constant) reference to the function .
const double * get_alpha() const
Returns a pointer on the array alpha (values of in each domain).
double * beta
Array (size: mg->nzone ) of the values of in each domain.
Tbl ** ddaa
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
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.
virtual void operator=(const Map_et &mp)
Assignment to another Map_et.
virtual const Map_af & mp_angu(int) const
Returns the "angular" mapping for the outside of domain l_zone.
virtual ostream & operator>>(ostream &) const
Operator >>.
Tbl ** ddbb
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
Tbl zaasx2
Values at the nr collocation points of in the outermost compactified domain.
Coord rsx2drdx
in the nucleus and the shells; \ in the outermost compactified domain.
virtual bool operator==(const Map &) const
Comparison operator (egality).
Tbl bbsx
Values at the nr collocation points of in the nucleus.
void set_gg(const Valeur &)
Assigns a given value to the function .
const Valeur & get_gg() const
Returns a (constant) reference to the function .
Map_et(const Mg3d &mgrille, const double *r_limits)
Standard Constructor.
Tbl ** dbb
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
void fait_poly()
Construction of the polynomials and .
virtual void homothetie(double lambda)
Sets a new radial scale.
Tbl aasx
Values at the nr collocation points of in the nucleus.
const double * get_beta() const
Returns a pointer on the array beta (values of in each domain).
Tbl aasx2
Values at the nr collocation points of in the nucleus.
Tbl zaasx
Values at the nr collocation points of in the outermost compactified domain.
Tbl ** daa
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
void set_coord()
Assignement of the building functions to the member Coords.
Coord rsxdxdr
in the nucleus; \ in the shells; \ in the outermost compactified domain.
void set_beta(double beta0, int l)
Modifies the value of in domain no. l.
Tbl ** aa
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
Valeur ff
Values of the function at the nt*np angular collocation points in each domain.
void set_alpha(double alpha0, int l)
Modifies the value of in domain no. l.
Tbl ** bb
Array (size: mg->nzone ) of Tbl which stores the values of in each domain.
virtual ~Map_et()
Destructor.
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
Tbl bbsx2
Values at the nr collocation points of in the nucleus.
Valeur gg
Values of the function at the nt*np angular collocation points in each domain.
virtual void sauve(FILE *) const
Save in a file.
void set_ff(const Valeur &)
Assigns a given value to the function .
virtual void resize(int l, double lambda)
Rescales the outer boundary of one domain.
virtual void reset_coord()
Resets all the member Coords.
Coord d2rdx2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord sr2drdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord srstdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord d2rdtdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord sstd2rdpdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
virtual void reset_coord()
Resets all the member Coords.
Coord lapr_tp
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.
Coord drdt
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED).
Coord srdrdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Map_radial(const Mg3d &mgrid)
Constructor from a grid (protected to make Map_radial an abstract class).
Coord xsr
in the nucleus; \ 1/R in the non-compactified shells; \ in the compactified outer domain.
virtual void sauve(FILE *) const
Save in a file.
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord sr2d2rdt2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Coord stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED).
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
int get_nzone() const
Returns the number of domains.
Base_val std_base_scal() const
Returns the standard spectral bases for a scalar.
int get_ndim() const
Gives the number of dimensions (ie dim.ndim).
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int i)
Read/write of a particular element (index i) (1D case).
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i]).
Values and coefficients of a (real-value) function.
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
#define P_COSSIN_P
dev. sur Phi = 2*phi, freq. paires
#define P_COSSIN
dev. standart
Base_vect_spher bvect_spher
Base class for coordinate mappings.
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
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 fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Map_af * p_mp_angu
Pointer on the "angular" mapping.
Coord z
z coordinate centered on the grid
Base_vect_cart bvect_cart
Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
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 tet
coordinate centered on the grid
void set_rot_phi(double phi0)
Sets a new rotation angle.
Coord x
x coordinate centered on the grid
Coord xa
Absolute x coordinate.
Coord za
Absolute z coordinate.
void set_ori(double xa0, double ya0, double za0)
Sets a new origin.
Coord r
r coordinate centered on the grid
Coord ya
Absolute y coordinate.
Standard units of space, time and mass.