72 assert(mp_aff != 0x0) ;
78 if (
etat == ETATZERO) {
79 if (mu.get_etat() == ETATZERO)
87 bool ced = (mgrid.
get_type_r(nzm1) == UNSURR) ;
89 int domain_bc = par_bc.
get_int(0) ;
90 bool bc_ced = ((ced) && (domain_bc == nzm1)) ;
92 int n_conditions = par_bc.
get_int(1) ;
93 assert ((n_conditions==1)||(n_conditions==2)) ;
94 bool derivative = (n_conditions == 2) ;
95 int dl = 0 ;
int l_min = 0 ;
int excised_i =0;
103 bool isexcised = (excised_i==1);
105 int nt = mgrid.
get_nt(0) ;
106 int np = mgrid.
get_np(0) ;
115 if (mu.get_etat() == ETATZERO)
117 int system01_size =0;
119 if (isexcised ==
false){
127 for (
int lz=1; lz<=domain_bc; lz++) {
128 system01_size += n_conditions ;
129 system_size += n_conditions ;
131 assert (
etat != ETATNONDEF) ;
133 bool need_matrices = true ;
136 need_matrices =
false ;
138 Matrice system_l0(system01_size, system01_size) ;
139 Matrice system_l1(system01_size, system01_size) ;
140 Matrice system_even(system_size, system_size) ;
141 Matrice system_odd(system_size, system_size) ;
148 int index = 0 ;
int index01 = 0 ;
151 if (isexcised ==
false){
152 system_even.
set(index, index) = 1. ;
153 system_even.
set(index, index + 1) = -1. ;
154 system_odd.
set(index, index) = -(2.*nr - 5.)/alpha ;
155 system_odd.
set(index, index+1) = (2.*nr - 3.)/alpha ;
157 if (domain_bc == 0) {
158 system_l0.
set(index01, index01) = c_val + c_der*4.*(nr-1)*(nr-1)/alpha ;
159 system_l1.
set(index01, index01) = c_val + c_der*(2*nr-3)*(2*nr-3)/alpha ;
161 system_even.
set(index, index-1) = c_val + c_der*4.*(nr-2)*(nr-2)/alpha ;
162 system_even.
set(index, index) = c_val + c_der*4.*(nr-1)*(nr-1)/alpha ;
163 system_odd.
set(index, index-1) = c_val + c_der*(2*nr-5)*(2*nr-5)/alpha ;
164 system_odd.
set(index, index) = c_val + c_der*(2*nr-3)*(2*nr-3)/alpha ;
168 system_l0.
set(index01, index01) = 1. ;
169 system_l1.
set(index01, index01) = 1. ;
170 system_even.
set(index, index-1) = 1. ;
171 system_even.
set(index, index) = 1. ;
172 system_odd.
set(index, index-1) = 1. ;
173 system_odd.
set(index, index) = 1. ;
175 system_l0.
set(index01+1, index01) = 4*(nr-1)*(nr-1)/alpha ;
176 system_l1.
set(index01+1, index01) = (2*nr-3)*(2*nr-3)/alpha ;
177 system_even.
set(index+1, index-1) = 4*(nr-2)*(nr-2)/alpha ;
178 system_even.
set(index+1, index) = 4*(nr-1)*(nr-1)/alpha ;
179 system_odd.
set(index+1, index-1) = (2*nr-5)*(2*nr-5)/alpha ;
180 system_odd.
set(index+1, index) = (2*nr-3)*(2*nr-3)/alpha ;
187 if ((1 == domain_bc)&&(bc_ced))
188 alpha = -0.25/alpha ;
189 system_l0.
set(index01, index01+1) = 1. ;
190 system_l0.
set(index01, index01+2) = -1. ;
191 system_l1.
set(index01, index01+1) = 1. ;
192 system_l1.
set(index01, index01+2) = -1. ;
194 system_even.
set(index, index+1) = 1. ;
195 system_even.
set(index, index+2) = -1. ;
196 system_odd.
set(index, index+1) = 1. ;
197 system_odd.
set(index, index+2) = -1. ;
200 system_l0.
set(index01, index01) = -(nr-2)*(nr-2)/alpha ;
201 system_l0.
set(index01, index01+1) = (nr-1)*(nr-1)/alpha ;
202 system_l1.
set(index01, index01) = -(nr-2)*(nr-2)/alpha ;
203 system_l1.
set(index01, index01+1) = (nr-1)*(nr-1)/alpha ;
205 system_even.
set(index, index) = -(nr-2)*(nr-2)/alpha ;
206 system_even.
set(index, index+1) = (nr-1)*(nr-1)/alpha ;
207 system_odd.
set(index, index) = -(nr-2)*(nr-2)/alpha ;
208 system_odd.
set(index, index+1) = (nr-1)*(nr-1)/alpha ;
212 if (1 == domain_bc) {
213 system_l0.
set(index01, index01-1) = c_val + c_der*(nr-2)*(nr-2)/alpha ;
214 system_l0.
set(index01, index01) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
215 system_l1.
set(index01, index01-1) = c_val + c_der*(nr-2)*(nr-2)/alpha ;
216 system_l1.
set(index01, index01) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
218 system_even.
set(index, index-1) = c_val + c_der*(nr-2)*(nr-2)/alpha ;
219 system_even.
set(index, index) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
220 system_odd.
set(index, index-1) = c_val + c_der*(nr-2)*(nr-2)/alpha ;
221 system_odd.
set(index, index) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
225 system_l0.
set(index01, index01-1) = 1. ;
226 system_l0.
set(index01, index01) = 1. ;
227 system_l1.
set(index01, index01-1) = 1. ;
228 system_l1.
set(index01, index01) = 1. ;
229 system_even.
set(index, index-1) = 1. ;
230 system_even.
set(index, index) = 1. ;
231 system_odd.
set(index, index-1) = 1. ;
232 system_odd.
set(index, index) = 1. ;
234 system_l0.
set(index01+1, index01-1) = (nr-2)*(nr-2)/alpha ;
235 system_l0.
set(index01+1, index01) = (nr-1)*(nr-1)/alpha ;
236 system_l1.
set(index01+1, index01-1) = (nr-2)*(nr-2)/alpha ;
237 system_l1.
set(index01+1, index01) = (nr-1)*(nr-1)/alpha ;
238 system_even.
set(index+1, index-1) = (nr-2)*(nr-2)/alpha ;
239 system_even.
set(index+1, index) = (nr-1)*(nr-1)/alpha ;
240 system_odd.
set(index+1, index-1) = (nr-2)*(nr-2)/alpha ;
241 system_odd.
set(index+1, index) = (nr-1)*(nr-1)/alpha ;
249 if ((1 == domain_bc)&&(bc_ced))
250 alpha = -0.25/alpha ;
251 if (1 == domain_bc) {
252 system_l0.
set(index01, index01) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
253 system_l1.
set(index01, index01) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
255 system_even.
set(index, index) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
256 system_odd.
set(index, index) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
260 system_l0.
set(index01, index01) = 1. ;
261 system_l1.
set(index01, index01) = 1. ;
262 system_even.
set(index, index) = 1. ;
263 system_odd.
set(index, index) = 1. ;
265 system_l0.
set(index01+1, index01) = (nr-1)*(nr-1)/alpha ;
266 system_l1.
set(index01+1, index01) = (nr-1)*(nr-1)/alpha ;
267 system_even.
set(index+1, index) = (nr-1)*(nr-1)/alpha ;
268 system_odd.
set(index+1, index) = (nr-1)*(nr-1)/alpha ;
273 for (
int lz=2; lz<=domain_bc; lz++) {
276 if ((lz == domain_bc)&&(bc_ced))
277 alpha = -0.25/alpha ;
278 system_l0.
set(index01, index01+1) = 1. ;
279 system_l0.
set(index01, index01+2) = -1. ;
280 system_l1.
set(index01, index01+1) = 1. ;
281 system_l1.
set(index01, index01+2) = -1. ;
283 system_even.
set(index, index+1) = 1. ;
284 system_even.
set(index, index+2) = -1. ;
285 system_odd.
set(index, index+1) = 1. ;
286 system_odd.
set(index, index+2) = -1. ;
289 system_l0.
set(index01, index01) = -(nr-2)*(nr-2)/alpha ;
290 system_l0.
set(index01, index01+1) = (nr-1)*(nr-1)/alpha ;
291 system_l1.
set(index01, index01) = -(nr-2)*(nr-2)/alpha ;
292 system_l1.
set(index01, index01+1) = (nr-1)*(nr-1)/alpha ;
294 system_even.
set(index, index) = -(nr-2)*(nr-2)/alpha ;
295 system_even.
set(index, index+1) = (nr-1)*(nr-1)/alpha ;
296 system_odd.
set(index, index) = -(nr-2)*(nr-2)/alpha ;
297 system_odd.
set(index, index+1) = (nr-1)*(nr-1)/alpha ;
301 if (lz == domain_bc) {
302 system_l0.
set(index01, index01-1) = c_val + c_der*(nr-2)*(nr-2)/alpha ;
303 system_l0.
set(index01, index01) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
304 system_l1.
set(index01, index01-1) = c_val + c_der*(nr-2)*(nr-2)/alpha ;
305 system_l1.
set(index01, index01) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
307 system_even.
set(index, index-1) = c_val + c_der*(nr-2)*(nr-2)/alpha ;
308 system_even.
set(index, index) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
309 system_odd.
set(index, index-1) = c_val + c_der*(nr-2)*(nr-2)/alpha ;
310 system_odd.
set(index, index) = c_val + c_der*(nr-1)*(nr-1)/alpha ;
314 system_l0.
set(index01, index01-1) = 1. ;
315 system_l0.
set(index01, index01) = 1. ;
316 system_l1.
set(index01, index01-1) = 1. ;
317 system_l1.
set(index01, index01) = 1. ;
318 system_even.
set(index, index-1) = 1. ;
319 system_even.
set(index, index) = 1. ;
320 system_odd.
set(index, index-1) = 1. ;
321 system_odd.
set(index, index) = 1. ;
323 system_l0.
set(index01+1, index01-1) = (nr-2)*(nr-2)/alpha ;
324 system_l0.
set(index01+1, index01) = (nr-1)*(nr-1)/alpha ;
325 system_l1.
set(index01+1, index01-1) = (nr-2)*(nr-2)/alpha ;
326 system_l1.
set(index01+1, index01) = (nr-1)*(nr-1)/alpha ;
327 system_even.
set(index+1, index-1) = (nr-2)*(nr-2)/alpha ;
328 system_even.
set(index+1, index) = (nr-1)*(nr-1)/alpha ;
329 system_odd.
set(index+1, index-1) = (nr-2)*(nr-2)/alpha ;
330 system_odd.
set(index+1, index) = (nr-1)*(nr-1)/alpha ;
335 assert(index01 == system01_size) ;
336 assert(index == system_size) ;
341 if (par_mat != 0x0) {
355 const Matrice& sys_even = (need_matrices ? system_even :
357 const Matrice& sys_odd = (need_matrices ? system_odd :
368 int m_q, l_q, base_r ;
369 for (
int k=0; k<np+2; k++) {
370 for (
int j=0; j<nt; j++) {
372 if ((nullite_plm(j, nt, k, np, base) == 1)&&(l_q >= l_min)) {
374 int sys_size = (l_q < 2 ? system01_size : system_size) ;
375 int nl = (l_q < 2 ? 1 : 2) ;
380 int nr = mgrid.
get_nr(0) ;
383 if (isexcised==
false){
386 double val_c = 0.; pari = 1 ;
387 for (
int i=0; i<nr-nl; i++) {
388 val_c += pari*coef(0, k, j, i) ;
391 rhs.
set(index) = val_c ;
395 double der_c = 0.; pari = 1 ;
396 for (
int i=0; i<nr-nl-1; i++) {
397 der_c += pari*(2*i+1)*coef(0, k, j, i) ;
400 rhs.
set(index) = der_c / alpha ;
405 for (
int i=0; i<nr-nl; i++) {
406 val_b += coef(0, k, j, i) ;
407 der_b += 4*i*i*coef(0, k, j, i) ;
412 for (
int i=0; i<nr-nl-1; i++) {
413 val_b += coef(0, k, j, i) ;
414 der_b += (2*i+1)*(2*i+1)*coef(0, k, j, i) ;
418 rhs.
set(index) = mu(k,j) - c_val*val_b - c_der*der_b/alpha ;
422 rhs.
set(index) = -val_b ;
424 rhs.
set(index+1) = -der_b/alpha ;
428 if ((1 == domain_bc)&&(bc_ced))
429 alpha = -0.25/alpha ;
431 int nr_lim = nr - n_conditions ;
432 val_b = 0 ; pari = 1 ;
433 for (
int i=0; i<nr_lim; i++) {
434 val_b += pari*coef(1, k, j, i) ;
437 rhs.
set(index) += val_b ;
440 der_b = 0 ; pari = -1 ;
441 for (
int i=0; i<nr_lim; i++) {
442 der_b += pari*i*i*coef(1, k, j, i) ;
445 rhs.
set(index) += der_b/alpha ;
449 for (
int i=0; i<nr_lim; i++)
450 val_b += coef(1, k, j, i) ;
452 for (
int i=0; i<nr_lim; i++) {
453 der_b += i*i*coef(1, k, j, i) ;
456 rhs.
set(index) = mu(k,j) - c_val*val_b - c_der*der_b/alpha ;
460 rhs.
set(index) = -val_b ;
461 if (derivative) rhs.
set(index+1) = -der_b / alpha ;
467 if ((1 == domain_bc)&&(bc_ced))
468 alpha = -0.25/alpha ;
470 int nr_lim = nr - 1 ;
472 for (
int i=0; i<nr_lim; i++)
473 val_b += coef(1, k, j, i) ;
475 for (
int i=0; i<nr_lim; i++) {
476 der_b += i*i*coef(1, k, j, i) ;
479 rhs.
set(index) = mu(k,j) - c_val*val_b - c_der*der_b/alpha ;
483 rhs.
set(index) = -val_b ;
484 if (derivative) rhs.
set(index+1) = -der_b / alpha ;
490 for (
int lz=2; lz<=domain_bc; lz++) {
492 if ((lz == domain_bc)&&(bc_ced))
493 alpha = -0.25/alpha ;
495 int nr_lim = nr - n_conditions ;
496 val_b = 0 ; pari = 1 ;
497 for (
int i=0; i<nr_lim; i++) {
498 val_b += pari*coef(lz, k, j, i) ;
501 rhs.
set(index) += val_b ;
504 der_b = 0 ; pari = -1 ;
505 for (
int i=0; i<nr_lim; i++) {
506 der_b += pari*i*i*coef(lz, k, j, i) ;
509 rhs.
set(index) += der_b/alpha ;
513 for (
int i=0; i<nr_lim; i++)
514 val_b += coef(lz, k, j, i) ;
516 for (
int i=0; i<nr_lim; i++) {
517 der_b += i*i*coef(lz, k, j, i) ;
520 rhs.
set(index) = mu(k,j) - c_val*val_b - c_der*der_b/alpha ;
524 rhs.
set(index) = -val_b ;
525 if (derivative) rhs.
set(index+1) = -der_b / alpha ;
538 solut = (l_q%2 == 0 ? sys_even.
inverse(rhs) :
542 int dec = (base_r ==
R_CHEBP ? 0 : 1) ;
544 if (isexcised==
false){
546 coef.
set(0, k, j, nr-2-dec) = solut(index) ;
549 coef.
set(0, k, j, nr-1-dec) = solut(index) ;
552 coef.
set(0, k, j, nr-1) = 0 ;
556 for (nl=1; nl<=n_conditions; nl++) {
557 int ii = n_conditions - nl + 1 ;
558 coef.
set(1, k, j, nr-ii) = solut(index) ;
564 coef.
set(1,k,j,nr-1)=solut(index);
567 for (
int lz=2; lz<=domain_bc; lz++) {
569 for (nl=1; nl<=n_conditions; nl++) {
570 int ii = n_conditions - nl + 1 ;
571 coef.
set(lz, k, j, nr-ii) = solut(index) ;
577 for (
int lz=0; lz<=domain_bc; lz++)
578 for (
int i=0; i<mgrid.
get_nr(lz); i++)
579 coef.
set(lz, k, j, i) = 0 ;
const Base_val & get_spectral_base() const
Returns the spectral bases of the Valeur va.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
double & get_double_mod(int position=0) const
Returns the reference of a stored modifiable double .
const double * get_alpha() const
Returns the pointer on the array alpha.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
void coef() const
Computes the coeffcients of *this.
int get_n_matrice_mod() const
Returns the number of modifiable Matrice 's addresses in the list.
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.
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)
void add_matrice_mod(Matrice &ti, int position=0)
Adds the address of a new modifiable Matrice to the list.
void match_tau(Param &par_bc, Param *par_mat=0x0)
Method for matching accross domains and imposing boundary condition.
void annule_hard()
Sets the Scalar to zero in a hard way.
int get_n_int() const
Returns the number of stored int 's addresses.
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define R_CHEBP
base de Cheb. paire (rare) seulement
Mtbl * c
Values of the function at the points of the multi-grid.
Tbl & get_tbl_mod(int position=0) const
Returns the reference of a modifiable Tbl stored in the list.
int get_n_double_mod() const
Returns the number of stored modifiable double 's addresses.
int get_nzone() const
Returns the number of domains.
Valeur va
The numerical value of the Scalar.
void annule_hard()
Sets the logical state to ETATQCQ (undefined state).
double & set(int j, int i)
Read/write of a particuliar element.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
int get_n_tbl_mod() const
Returns the number of modifiable Tbl 's addresses in the list.
Bases of the spectral expansions.
int etat
The logical state ETATNONDEF (undefined), ETATZERO (null), ETATUN (one), or ETATQCQ (ordinary)...
Coefficients storage for the multi-domain spectral method.
Matrice & get_matrice_mod(int position=0) const
Returns the reference of a modifiable Matrice stored in the list.
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.