23 char cmp_raccord_externe_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_raccord_externe.C,v 1.4 2014/10/13 08:52:48 j_novak Exp $" ;
68 int cnp (
int n,
int p) {
76 for (
int conte=n ; conte >n-p ; conte --)
80 for (
int conte = 1 ; conte<p+1 ; conte++)
83 return int(fact_un/fact_deux) ;
97 int base_r, m_quant, l_quant ;
108 cout <<
"Le mapping doit etre affine" << endl ;
114 double beta = map->
get_beta()[zone] ;
117 double new_alpha = -alpha/(beta*beta-alpha*alpha) ;
118 double new_beta = beta/(beta*beta-alpha*alpha) ;
121 double alpha_zec = map->
get_alpha()[zone+1] ;
129 tksi.
set(0, 0) =
sqrt(
double(2)) ;
130 for (
int i=1 ; i<nbre ; i++)
135 tksi.
set(1, 1) =
sqrt(
double(2)) ;
136 for (
int i=2 ; i<nbre ; i++)
140 for (
int lig=2 ; lig<nbre ; lig++) {
141 tksi.
set(lig, 0) = -tksi(lig-2, 0) ;
142 for (
int col=1 ; col<nbre ; col++)
143 tksi.
set(lig, col) = 2*tksi(lig-1, col-1)-tksi(lig-2, col) ;
150 for (
int lig=0 ; lig<nbre ; lig++) {
151 for (
int col=0 ; col<=lig ; col++)
152 ksiu.
set(lig, col) = cnp(lig, col)*
153 pow(-new_beta/new_alpha, lig-col) ;
154 for (
int col = lig+1 ; col<nbre ; col++)
155 ksiu.
set(lig, col) = 0 ;
162 for (
int lig=0 ; lig<nbre ; lig++)
163 for (
int col=0 ; col<nbre ; col++) {
165 for (
int m=0 ; m<nbre ; m++)
166 somme += tksi(lig, m)*ksiu(m, col) ;
167 tu.
set(lig, col) = somme ;
171 Tbl coef_u (nbre+lmax, nr) ;
173 int* dege =
new int [3] ;
174 dege[0] = 1 ; dege[1] = 1 ; dege[2] = nr ;
175 double* ti =
new double [nr] ;
177 for (
int puiss=0 ; puiss<nbre+lmax ; puiss++) {
178 for (
int i=0 ; i<nr ; i++)
179 ti[i] =
pow(-
cos(M_PI*i/(nr-1))-1, puiss) ;
180 cfrcheb (dege, dege, ti, dege, ti) ;
181 for (
int i=0 ; i<nr ; i++)
182 coef_u.
set(puiss, i) = ti[i] ;
187 double *coloc =
new double[nbre] ;
188 double *auxi =
new double [1] ;
190 Tbl coef_zec (np+2, nt, nr) ;
195 for (
int k=0 ; k<np+2 ; k++)
196 for (
int j=0 ; j<nt ; j++)
197 if (nullite_plm (j, nt, k, np, base_devel)==1) {
198 donne_lm (zone+2, zone+1, j, k, base_devel, m_quant,
200 if (l_quant <= lmax) {
205 for (
int i=0 ; i<nbre ; i++) {
206 ksi = -
cos(M_PI*i/(nbre-1)) ;
207 air = 1./(new_alpha*ksi+new_beta) ;
208 ksi = (air-beta)/alpha ;
209 for (
int m=0 ; m<nr ; m++)
210 ti[m] = (*
va.
c_cf)(zone, k, j, m) ;
211 som_r_cheb (ti, nr, 1, 1, ksi, auxi) ;
213 pow (-new_alpha*
cos(M_PI*i/(nbre-1))+new_beta, power+l_quant);
216 cfrcheb (dege, dege, coloc, dege, coloc) ;
218 Tbl expansion (nbre) ;
220 for (
int i=0 ; i<nbre ; i++) {
222 for (
int m=0 ; m<nbre ; m++)
223 somme += coloc[m]*tu(m, i) ;
224 expansion.
set(i) = somme ;
227 for (
int i=0 ; i<nr ; i++) {
229 for (
int m=0 ; m<nbre ; m++)
230 somme += coef_u(m+l_quant, i)*expansion(m)*
231 pow(alpha_zec, m+l_quant)/
233 coef_zec.
set(k, j, i) = somme ;
242 for (
int k=0 ; k<np+2 ; k++)
243 for (
int j=0 ; j<nt ; j++)
244 for (
int i=0 ; i<nr ; i++)
245 va.
c_cf->
set(zone+1, k, j, i) = coef_zec(k, j, i) ;
Bases of the spectral expansions.
const Map * mp
Reference mapping.
Valeur va
The numerical value of the Cmp
void set_dzpuis(int)
Set a value to dzpuis.
void raccord_externe(int puis, int nbre, int lmax)
Matching of the external domain with the outermost shell.
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 Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int j, int i)
Read/write of a particuliar element.
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.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
void annule_hard()
Sets the Tbl to zero in a hard way.
double & set(int i)
Read/write of a particular element (index i) (1D case)
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_cf_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl_cf c_c...
void ylm()
Computes the coefficients of *this.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void coef() const
Computes the coeffcients of *this.
void ylm_i()
Inverse of ylm()
Base_val base
Bases on which the spectral expansion is performed.
Cmp sqrt(const Cmp &)
Square root.
Cmp pow(const Cmp &, int)
Power .
Cmp cos(const Cmp &)
Cosine.