28 char scalar_sol_div_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_sol_div.C,v 1.5 2014/10/13 08:53:47 j_novak Exp $" ;
64 void _sx_r_chebp(Tbl* ,
int& ) ;
65 void _sx_r_chebi(Tbl* ,
int& ) ;
70 assert(
etat != ETATNONDEF) ;
72 assert( mpaff != 0x0) ;
76 if (
etat == ETATZERO )
96 for (
int lz = 0; lz<nz; lz++)
97 assert( (mg->
get_nt(lz) == nt) && (mg->
get_np(lz) == np) ) ;
99 int nr, base_r,l_quant, m_quant;
105 Mtbl_cf sol_part(mg, base_resu) ;
106 Mtbl_cf sol_hom(mg, base_resu) ;
119 int nr0 = nr - dege ;
120 Tbl vect1(3, 1, nr) ;
121 Tbl vect2(3, 1, nr) ;
127 for (
int i=dege; i<nr; i++) {
130 vect1.
set(0,0,i) = 1. ; vect2.
set(0,0,i) = 1. ;
131 _dsdx_r_chebp(&vect1, base_pipo) ;
132 _sx_r_chebp(&vect2, base_pipo) ;
133 for (
int j=0; j<nr0; j++)
134 ope_even.
set(j,i-dege) = (vect1(0,0,j) + n_factor*vect2(0,0,j)) / alpha ;
139 for (
int i=0; i<nr0; i++) {
142 vect1.
set(0,0,i) = 1. ; vect2.
set(0,0,i) = 1. ;
143 _dsdx_r_chebi(&vect1, base_pipo) ;
144 _sx_r_chebi(&vect2, base_pipo) ;
145 for (
int j=0; j<nr0; j++)
146 ope_odd.
set(j,i) = (vect1(0,0,j) + n_factor*vect2(0,0,j)) / alpha ;
150 for (
int k=0 ; k<np+1 ; k++)
151 for (
int j=0 ; j<nt ; j++) {
156 ope_even : ope_odd ) ;
160 for (
int i=0 ; i<nr0 ; i++)
161 so->
set(i) = source(lz, k, j, i) ;
167 for (
int i=0 ; i<nr0 ; i++) {
169 resu.
set(lz, k, j, i+dege) = (*s_part)(i) ;
170 somme += ((i+dege)%2 == 0 ? 1 : -1)*(*s_part)(i) ;
173 resu.
set(lz,k,j,i) = (*s_part)(i) ;
176 for (
int i=nr0; i<nr; i++)
177 resu.
set(lz,k,j,i) = 0 ;
179 resu.
set(lz, k, j, 0) -= somme ;
189 int nz0 = (ced ? nz - 1 : nz) ;
190 for (lz=1 ; lz<nz0 ; lz++) {
194 double ech = beta / alpha ;
198 Matrice operateur = mxd + ech*mdx + n_factor*mid ;
201 s_hom =
new Tbl(solh(nr, n_factor-1, ech,
R_CHEB)) ;
203 for (
int k=0 ; k<np+1 ; k++)
204 for (
int j=0 ; j<nt ; j++) {
207 assert (base_r ==
R_CHEB) ;
214 for (
int i=0 ; i<nr ; i++)
215 tmp.
set(i) = source(lz, k, j, i) ;
216 for (
int i=0; i<nr; i++) so->
set(i) = beta*tmp(i) ;
217 multx_1d(nr, &tmp.t,
R_CHEB) ;
218 for (
int i=0; i<nr; i++) so->
set(i) += alpha*tmp(i) ;
223 for (
int i=0 ; i<nr ; i++) {
224 sol_part.
set(lz, k, j, i) = (*s_part)(i) ;
225 sol_hom.
set(lz, k, j, i) = (*s_hom)(1,i) ;
250 for (
int lin=0; lin<nr0; lin++)
251 for (
int col=dege; col<nr; col++)
252 operateur.
set(lin,col-dege) = (-mdx(lin,col)
253 + n_factor*msx(lin, col)) / alpha ;
255 for (
int lin=0; lin<nr0; lin++) {
256 for (
int col=dege; col<nr; col++)
257 operateur.
set(lin,col-dege) = (-mxdx(lin,col)
258 + n_factor*mid(lin, col)) ;
263 s_hom =
new Tbl(solh(nr, n_factor-1, 0.,
R_CHEBU)) ;
264 for (
int k=0 ; k<np+1 ; k++)
265 for (
int j=0 ; j<nt ; j++) {
272 for (
int i=0 ; i<nr0 ; i++)
273 so->
set(i) = source(nz-1, k, j, i) ;
278 for (
int i=0 ; i<nr0 ; i++) {
279 sol_part.
set(nz-1, k, j, i+dege) = (*s_part)(i) ;
280 somme += (*s_part)(i) ;
281 sol_hom.
set(nz-1, k, j, i) = (*s_hom)(i) ;
283 for (
int i=nr0; i<nr; i++)
284 sol_hom.
set(nz-1, k, j, i) = (*s_hom)(i) ;
286 sol_part.
set(nz-1, k, j, 0) = -somme ;
299 for (lz=1; lz<nz; lz++)
303 if (ced) echelles.
set(nz-2) = 1./
pow(-2., n_factor) ;
305 for (
int k=0 ; k<np+1 ; k++)
306 for (
int j=0 ; j<nt ; j++) {
307 for (lz=1; lz<nz; lz++) {
311 int nr_prec = mg->
get_nr(lz-1) ;
313 for (
int i=0; i<nr_prec; i++)
314 val1 += resu(lz-1, k, j, i) ;
315 for (
int i=0; i<nr; i++) {
316 valm1 += ( i%2 == 0 ? 1 : -1)*sol_part(lz, k, j, i) ;
317 valhom1 += ( i%2 == 0 ? 1 : -1)*sol_hom(lz, k, j, i) ;
319 double lambda = (val1 - valm1) * echelles(lz-1) ;
320 for (
int i=0; i<nr; i++)
321 resu.
set(lz, k, j, i) = sol_part(lz, k, j, i)
322 + lambda*sol_hom(lz, k, j, i) ;
const Base_val & get_spectral_base() const
Returns the spectral bases of the Valeur va.
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
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...
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.
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.
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)
virtual const Matrice & get_matrice() const
Returns the matrix associated with the operator.
Tensor field of valence 0 (or component of a tensorial field).
Values and coefficients of a (real-value) function.
Class for the elementary differential operator (see the base class Diff ).
Scalar sol_divergence(int n) const
Resolution of a divergence-like equation.
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
const Mg3d * get_mg() const
Returns the Mg3d on which the Mtbl_cf is defined.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Class for the elementary differential operator Identity (see the base class Diff ).
friend Scalar pow(const Scalar &, int)
Power .
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define R_CHEBP
base de Cheb. paire (rare) seulement
const double * get_beta() const
Returns the pointer on the array beta.
int get_nzone() const
Returns the number of domains.
Valeur va
The numerical value of the Scalar.
double & set(int j, int i)
Read/write of a particuliar element.
void set_spectral_base(const Base_val &)
Sets the spectral bases of the Valeur va.
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 annule_hard()
Sets the Mtbl_cf to zero in a hard way.
Class for the elementary differential operator (see the base class Diff ).
int etat
The logical state ETATNONDEF (undefined), ETATZERO (null), ETATUN (one), or ETATQCQ (ordinary)...
void mult_x()
The basis is transformed as with a multiplication by .
Coefficients storage for the multi-domain spectral method.
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.
Valeur & set_spectral_va()
Returns va (read/write version)
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
Class for the elementary differential operator division by (see the base class Diff )...
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
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 const Matrice & get_matrice() const
Returns the matrix associated with the operator.
#define R_CHEB
base de Chebychev ordinaire (fin)