73 #include "utilitaires.h" 83 assert (
etat != ETATNONDEF) ;
84 if ((
etat == ETATZERO) || (
etat == ETATUN))
90 cout <<
"Le mapping doit etre affine" << endl ;
100 double r_cont = -1./2./alpha ;
103 Tbl coef (nbre+2*lmax, nr) ;
106 int* deg =
new int[3] ;
107 deg[0] = 1 ; deg[1] = 1 ; deg[2] = nr ;
108 double* auxi =
new double[nr] ;
110 for (
int conte=0 ; conte<nbre+2*lmax ; conte++) {
111 for (
int i=0 ; i<nr ; i++)
112 auxi[i] =
pow(-1-
cos(M_PI*i/(nr-1)), (conte+puis)) ;
114 cfrcheb(deg, deg, auxi, deg, auxi) ;
115 for (
int i=0 ; i<nr ; i++)
116 coef.
set(conte, i) = auxi[i]*
pow (alpha, conte+puis) ;
121 Tbl valeurs (nbre, nt, np+1) ;
125 double* res_val =
new double[1] ;
127 for (
int conte=0 ; conte<nbre ; conte++) {
134 for (
int k=0 ; k<np+1 ; k++)
135 for (
int j=0 ; j<nt ; j++)
136 if (nullite_plm(j, nt, k, np, courant.
va.
base) == 1) {
138 for (
int i=0 ; i<nr ; i++)
139 auxi[i] = (*courant.
va.
c_cf)(nz-2, k, j, i) ;
143 som_r_cheb (auxi, nr, 1, 1, 1, res_val) ;
146 cout <<
"Cas non prevu dans raccord_zec" << endl ;
150 valeurs.
set(conte, k, j) = res_val[0] ;
154 courant = copie.
dsdr() ;
168 int base_r, l_quant, m_quant ;
169 for (
int k=0 ; k<np+1 ; k++)
170 for (
int j=0 ; j<nt ; j++)
171 if (nullite_plm(j, nt, k, np,
va.
base) == 1) {
173 donne_lm (nz, nz-1, j, k, base, m_quant, l_quant, base_r) ;
180 for (
int col=0 ; col<nbre ; col++)
181 for (
int lig=0 ; lig<nbre ; lig++) {
183 int facteur = (lig%2==0) ? 1 : -1 ;
184 for (
int conte=0 ; conte<lig ; conte++)
185 facteur *= puis+col+conte+2*l_quant ;
186 systeme.
set(lig, col) = facteur/
pow(r_cont, puis+col+lig+2*l_quant) ;
192 Tbl sec_membre (nbre) ;
194 for (
int conte=0 ; conte<nbre ; conte++)
195 sec_membre.
set(conte) = valeurs(conte, k, j) ;
199 for (
int conte=0 ; conte<nbre ; conte++)
200 for (
int i=0 ; i<nr ; i++)
202 inv(conte)*coef(conte+2*l_quant, i) ;
204 else for (
int i=0 ; i<nr ; i++)
220 if (
etat == ETATZERO) return ;
227 int np = mgrid.
get_np(nzm1) ;
228 int nt = mgrid.
get_nt(nzm1) ;
229 int nr_ced = mgrid.
get_nr(nzm1) ;
230 int nr_shell = mgrid.
get_nr(nzm1-1) ;
232 assert(mgrid.
get_np(nzm1-1) == np) ;
233 assert(mgrid.
get_nt(nzm1-1) == nt) ;
240 cout <<
"Scalar::smooth_decay: present version supports only \n" 241 <<
" affine mappings !" << endl ;
253 assert(
va.
c_cf->
t[nzm1] != 0x0) ;
259 int nbr1[] = {nr_shell, nr_ced} ;
260 int nbt1[] = {1, 1} ;
261 int nbp1[] = {1, 1} ;
262 int typr1[] = {mgrid.
get_type_r(nzm1-1), UNSURR} ;
263 Mg3d grid1d(2, nbr1, typr1, nbt1, SYM, nbp1, SYM) ;
267 double rbound = mapaf->get_alpha()[nzm1-1]
268 + mapaf->get_beta()[nzm1-1] ;
269 double rmin = - mapaf->get_alpha()[nzm1-1]
270 + mapaf->get_beta()[nzm1-1] ;
271 double bound1[] = {rmin, rbound, __infinity} ;
273 Map_af map1d(grid1d, bound1) ;
287 for (
int k=0; k<=np; k++) {
288 for (
int j=0; j<nt; j++) {
290 if (nullite_plm(j, nt, k, np, base) != 1) {
291 for (
int i=0 ; i<nr_ced ; i++) {
292 coefresu.
set(k, j, i) = 0 ;
296 int base_r_ced, base_r_shell , l_quant, m_quant ;
297 donne_lm(nz, nzm1, j, k, base, m_quant, l_quant, base_r_ced) ;
298 donne_lm(nz, nzm1-1, j, k, base, m_quant, l_quant, base_r_shell) ;
300 int nn0 = l_quant + nn ;
307 for (
int i=0; i<nr_shell; i++) {
309 va.
c_cf->operator()(nzm1-1, k, j, i) ;
326 for (
int p=1; p<=kk; p++) {
338 for (
int im=0; im<=kk; im++) {
340 double fact = (im%2 == 0) ? 1. : -1. ;
341 fact /=
pow(rbound, nn0 + im) ;
343 for (
int jm=0; jm<=kk; jm++) {
346 for (
int ir=0; ir<im; ir++) {
347 prod *= nn0 + jm + ir ;
350 mat.
set(im, jm) = fact * prod /
pow(rbound, jm) ;
365 const Coord& r = map1d.
r ;
366 for (
int p=0; p<=kk; p++) {
367 tmp = aa(p) /
pow(r, nn0 + p) ;
378 for (
int i=0; i<nr_ced; i++) {
379 coefresu.
set(k,j,i) = 0 ;
383 assert( vv.
va.
c_cf != 0x0 ) ;
384 for (
int i=0; i<nr_ced; i++) {
385 coefresu.
set(k,j,i) = vv.
va.
c_cf->operator()(1,0,0,i) ;
407 for (
int p=0; p<=kk; p++) {
410 for (
int k=0; k<np; k++) {
411 for (
int j=0; j<nt; j++) {
414 if (diff > err) err = diff ;
418 "Scalar::smooth_decay: Max error matching of " << p
419 <<
"-th derivative: " << err << endl ;
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
const double * get_alpha() const
Returns the pointer on the array alpha.
void ylm_i()
Inverse of ylm()
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
void set_etat_cf_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl_cf c_c...
void coef() const
Computes the coeffcients of *this.
void set_lu() const
Calculate the LU-representation, assuming the band-storage has been done.
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
void ylm()
Computes the coefficients of *this.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Tensor field of valence 0 (or component of a tensorial field).
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_base(const Base_val &)
Sets the bases for spectral expansions (member base )
void set_dzpuis(int)
Modifies the dzpuis flag.
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
int get_base_r(int l) const
Returns the expansion basis for r ( ) functions in the domain of index l (e.g.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_etat() const
Returns the logical state.
friend Scalar pow(const Scalar &, int)
Power .
void smooth_decay(int k, int n)
Performs a matching of the last non-compactified shell with a decaying function where is the spher...
friend Scalar cos(const Scalar &)
Cosine.
Base_val base
Bases on which the spectral expansion is performed.
int get_dzpuis() const
Returns dzpuis.
Mtbl * c
Values of the function at the points of the multi-grid.
int get_nzone() const
Returns the number of domains.
Valeur va
The numerical value of the Scalar.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int j, int i)
Read/write of a particuliar element.
Active physical coordinates and mapping derivatives.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void set_band(int up, int low) const
Calculate the band storage of *std.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Bases of the spectral expansions.
void set_base_r(int l, int base_r)
Sets the expansion basis for r ( ) functions in a given domain.
void raccord_c1_zec(int puis, int nbre, int lmax)
Performs the matching of the external domain with respect to the last shell using function like wit...
int etat
The logical state ETATNONDEF (undefined), ETATZERO (null), ETATUN (one), or ETATQCQ (ordinary)...
const Scalar & dsdr() const
Returns of *this .
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
void annule_hard()
Sets the Tbl to zero in a hard way.
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values of the Scalar in the co...
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain...
Coord r
r coordinate centered on the grid
const Base_val & get_base() const
Return the bases for spectral expansions (member base )
#define R_CHEB
base de Chebychev ordinaire (fin)