110 #include "utilitaires.h" 119 assert (
etat != ETATNONDEF) ;
120 assert (l_min <= l_max) ;
121 assert (l_min >= 0) ;
122 if (
etat == ETATZERO )
125 if (
etat == ETATUN) {
133 int l_q, m_q, base_r ;
135 if (m_coef(lz).
get_etat() != ETATZERO)
140 if ((l_min <= l_q) && (l_q<= l_max))
141 m_coef.
set(lz, k, j, i) = 0 ;
159 assert (
etat != ETATNONDEF) ;
160 if ( (
etat == ETATZERO) || (
etat == ETATUN) )
174 for (
int k=0 ; k<np+1 ; k++)
176 for (
int j=0 ; j<nt ; j++)
177 for (
int i=nr-1 ; i>nr-1-n ; i--)
187 assert (
etat != ETATNONDEF) ;
188 if ( (
etat == ETATZERO) || (
etat == ETATUN) )
196 int* nr =
new int[nz];
197 int* nt =
new int[nz];
198 int* np =
new int[nz];
199 for (
int l=0; l<=nz-1; l++) {
205 for (
int l=0; l<=nz-1; l++)
206 for (
int k=0 ; k<np[l]+1 ; k++)
208 for (
int j=0 ; j<nt[l] ; j++)
209 for (
int i=nr[l]-1; i>nr[l]-1-nn[l] ; i--)
225 assert (
etat != ETATNONDEF) ;
226 if ( (
etat == ETATZERO) || (
etat == ETATUN) )
237 for (
int k=0 ; k<np+1 ; k++)
239 for (
int j=0 ; j<nt ; j++)
240 for (
int i=nr-1; i>nr-1-n ; i--)
256 assert (
etat != ETATNONDEF) ;
257 if ( (
etat == ETATZERO) || (
etat == ETATUN) )
268 for (
int k=np+1-n ; k<np+1 ; k++)
269 for (
int j=0 ; j<nt ; j++)
270 for (
int i=0 ; i<nr ; i++)
291 assert (
etat != ETATNONDEF) ;
292 if (
etat == ETATZERO) {
293 if (x0 ==
double(0)) return ;
297 if (
etat == ETATUN) {
298 if (x0 ==
double(1)) return ;
299 else etat = ETATQCQ ;
310 for (
int k=0 ; k<np ; k++)
311 for (
int j=0 ; j<nt ; j++)
312 va.
set(l0, k, j, 0) = x0 ;
323 assert (
etat != ETATNONDEF) ;
324 if (
etat == ETATZERO) {
325 if (x0 ==
double(0)) return ;
329 if (
etat == ETATUN) {
330 if (x0 ==
double(1)) return ;
331 else etat = ETATQCQ ;
343 for (
int k=0 ; k<np ; k++)
344 for (
int j=0 ; j<nt ; j++)
345 va.
set(l0, k, j, nrm1) = x0 ;
368 cout <<
"Le mapping doit etre affine" << endl ;
379 for (
int conte=0 ; conte<nbre ; conte++) {
386 double* coloc =
new double [nr] ;
387 int * deg =
new int[3] ;
392 for (
int i=0 ; i<nr ; i++)
393 coloc[i] =
pow(alpha,
double(conte))*
394 pow(-1-
cos(M_PI*i/(nr-1)),
double(conte)) ;
396 cfrcheb(deg, deg, coloc, deg, coloc) ;
398 for (
int k=0 ; k<np+1 ; k++)
400 for (
int j=0 ; j<nt ; j++) {
403 double* coef =
new double [nr] ;
404 double* auxi =
new double[1] ;
405 for (
int i=0 ; i<nr ; i++)
406 coef[i] = (*courant.
va.
c_cf)(nz-1, k, j, i) ;
409 som_r_chebu (coef, nr, 1, 1, 1, auxi) ;
412 som_r_pas_prevu (coef, nr, 1, 1, 1, auxi) ;
419 courant.
va.
c_cf->
set(nz-1, k, j, 0) -= *auxi ;
421 for (
int i=0 ; i<nr ; i++)
422 this->
va.
c_cf->
set(nz-1, k, j, i) -= *auxi * coloc[i] ;
438 if (output_ylm)
va.
ylm() ;
445 assert(
etat == ETATQCQ) ;
447 for (
int k=0; k<np+2; k++)
448 for (
int j=0; j<nt; j++)
457 if (output_ylm)
va.
ylm() ;
464 assert(
etat == ETATQCQ) ;
466 for (
int k=0; k<np+2; k++)
467 for (
int j=0; j<nt; j++)
475 if (output_ylm)
va.
ylm() ;
479 Base_val base = resu.get_spectral_base() ;
481 resu.set_spectral_base(base) ;
482 if (
etat == ETATZERO) resu.set_etat_zero() ;
484 assert(
etat == ETATQCQ) ;
488 for (
int k=0; k<np+2; k++)
489 for (
int j=0; j<nt; j++)
490 resu.set_spectral_va().c_cf->set(0, k, j, 0)
492 delete resu.set_spectral_va().c ;
493 resu.set_spectral_va().c = 0x0 ;
void annule_l(int l_min, int l_max, bool ylm_output=false)
Sets all the multipolar components between l_min and l_max to zero.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void filtre_r(int *nn)
Sets the n lasts coefficients in r to 0 in all domains.
const double * get_alpha() const
Returns the pointer on the array alpha.
virtual const Map_af & mp_angu(int) const =0
Returns the "angular" mapping for the outside of domain l_zone.
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.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void give_quant_numbers(int, int, int, int &, int &, int &) const
Computes the various quantum numbers and 1d radial base.
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
int get_base_t(int l) const
Returns the expansion basis for functions in the domain of index l (e.g.
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).
void coef_i() const
Computes the physical value of *this.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Scalar scalar_out_bound(int n, bool leave_ylm=false)
Returns the Scalar containing the values of angular coefficients at the outer boundary.
int dzpuis
Power of r by which the quantity represented by this must be divided in the compactified external do...
void set_base_t(int base_t)
Sets the expansion basis for functions in all domains.
Tbl tbl_in_bound(int n, bool leave_ylm=false)
Returns the Tbl containing the values of angular coefficients at the inner boundary.
int get_etat() const
Returns the logical state.
double val_out_bound_jk(int l, int j, int k) const
Computes the angular coefficient of index j,k of the field represented by *this at by means of the s...
void annule_hard()
Sets the Scalar to zero in a hard way.
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).
friend Scalar pow(const Scalar &, int)
Power .
double val_in_bound_jk(int l, int j, int k) const
Computes the angular coefficient of index j,k of the field represented by *this at by means of the s...
friend Scalar cos(const Scalar &)
Cosine.
virtual void del_deriv() const
Logical destructor of the derivatives.
Base_val base
Bases on which the spectral expansion is performed.
void set_outer_boundary(int l, double x)
Sets the value of the Scalar at the outer boundary of a given domain.
void filtre_tp(int nn, int nz1, int nz2)
Sets the n lasts coefficients in to 0 in the domain nz1 to nz2 when expressed in spherical harmonics...
void mult_r_ced()
Multiplication by r in the compactified external domain (CED), the dzpuis flag is not changed...
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 filtre(int n)
Sets the n lasts coefficients in r to 0 in the external domain.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void set_inner_boundary(int l, double x)
Sets the value of the Scalar at the inner boundary of a given domain.
void filtre_tp(int nn, int nz1, int nz2)
Sets the n lasts coefficients in to 0 in the domain nz1 to nz2 when expressed in spherical harmonics...
void fixe_decroissance(int puis)
Substracts all the components behaving like in the external domain, with n strictly lower than puis ...
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 filtre_phi(int n, int zone)
Sets the n lasts coefficients in to 0 in the domain zone .
int etat
The logical state ETATNONDEF (undefined), ETATZERO (null), ETATUN (one), or ETATQCQ (ordinary)...
Coefficients storage for the multi-domain spectral method.
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c )...
Tbl tbl_out_bound(int l_dom, bool leave_ylm=false)
Returns the Tbl containing the values of angular coefficients at the outer boundary.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
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.
Tbl & set(int l)
Read/write of the value in a given domain (configuration space).