KADATH
domain_nucleus_affecte_tau_one_coef.cpp
1 /*
2  Copyright 2017 Philippe Grandclement
3 
4  This file is part of Kadath.
5 
6  Kadath is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Kadath is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Kadath. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "headcpp.hpp"
21 
22 #include "spheric.hpp"
23 #include "scalar.hpp"
24 #include "tensor_impl.hpp"
25 #include "tensor.hpp"
26 namespace Kadath {
27 void Domain_nucleus::affecte_tau_one_coef_val_domain_vr (Val_domain& so, int cc, int& conte) const {
28 
29  so.allocate_coef() ;
30  *so.cf = 0. ;
31  Index pos_cf (nbr_coefs) ;
32 
33  // Positions of the Galerkin basis
34  Index pos_gal_t (nbr_coefs) ;
35  Index pos_gal_r (nbr_coefs) ;
36  Index pos_gal_rt (nbr_coefs) ;
37  double fact_t, fact_r, fact_rt ;
38 
39  bool found = false ;
40 
41 
42  // Case k=0 ; j<=1
43  {
44  pos_cf.set(2) = 0 ;
45  int baset = (*so.get_base().bases_1d[1]) (0) ;
46  assert (baset==COS_EVEN) ;
47  for (int j=0 ; j<2 ; j++) {
48  int baser = (*so.get_base().bases_1d[0]) (j, 0) ;
49  pos_cf.set(1) = j ;
50  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
51  for (int i=0 ; i<nbr_coefs(0)-1 ; i++) {
52  pos_cf.set(0) = i ;
53  if (conte==cc) {
54  found = true ;
55  so.cf->set(pos_cf) = 1. ;
56  }
57  conte ++ ;
58  }
59  }
60  }
61 
62  // Case k==0 ; j>1
63  {
64  pos_cf.set(2) = 0 ;
65  int baset = (*so.get_base().bases_1d[1]) (0) ;
66  assert (baset==COS_EVEN) ;
67  for (int j=2 ; j<nbr_coefs(1) ; j++) {
68  int baser = (*so.get_base().bases_1d[0]) (j, 0) ;
69  pos_cf.set(1) = j ;
70  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
71  for (int i=1 ; i<nbr_coefs(0)-1 ; i++) {
72  pos_cf.set(0) = i ;
73  pos_gal_r = pos_cf ;
74  pos_gal_r.set(0) = 0 ;
75  switch (baser) {
76  case CHEB_ODD :
77  fact_r = - (2*i+1) * pow(-1, i) ;
78  break ;
79  case LEG_ODD : {
80  fact_r = -1. ;
81  for (int t=0 ; t<i ; t++)
82  fact_r *= -double(2*t+3)/double(2*t+2) ;
83  }
84  break ;
85  default :
86  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_cart" << endl ;
87  abort() ;
88  }
89  if (conte==cc) {
90  found = true ;
91  so.cf->set(pos_cf) = 1 ;
92  so.cf->set(pos_gal_r) += fact_r ;
93  }
94  conte ++ ;
95  }
96  }
97  }
98 
99 
100  // Next ones
101  for (int k=2 ; k<nbr_coefs(2)-1 ; k++) {
102 
103  int mquant = (k%2==0) ? int(k/2) : int((k-1)/2) ;
104  pos_cf.set(2) = k ;
105  int baset = (*so.get_base().bases_1d[1]) (k) ;
106 
107  if (mquant%2==0) {
108  assert (baset=COS_EVEN) ;
109  for (int j=1 ; j<nbr_coefs(1) ; j++) {
110  int baser = (*so.get_base().bases_1d[0]) (j, k) ;
111  pos_cf.set(1) = j ;
112  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
113  for (int i=1 ; i<nbr_coefs(0)-1 ; i++) {
114  pos_cf.set(0) = i ;
115  pos_gal_r = pos_cf ;
116  pos_gal_r.set(0) = 0 ;
117  pos_gal_t = pos_cf ;
118  pos_gal_t.set(1) = 0 ;
119  pos_gal_rt = pos_cf ;
120  pos_gal_rt.set(0) = 0 ;
121  pos_gal_rt.set(1) = 0 ;
122  switch (baser) {
123  case CHEB_ODD :
124  fact_r = -pow(-1, i)*(2*i+1) ;
125  fact_t = -1. ;
126  fact_rt = pow(-1, i)*(2*i+1) ;
127  break ;
128  case LEG_ODD : {
129  double l0 = 1 ;
130  for (int t=0 ; t<i ; t++)
131  l0 *= -double(2*t+3)/double(2*t+2) ;
132  fact_r = - l0 ;
133  fact_t = -1. ;
134  fact_rt = l0 ;
135  }
136  break ;
137  default :
138  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_cart" << endl ;
139  abort() ;
140  }
141 
142  if (conte==cc) {
143  found = true ;
144  so.cf->set(pos_cf) = 1. ;
145  so.cf->set(pos_gal_r) += fact_r ;
146  so.cf->set(pos_gal_t) += fact_t ;
147  so.cf->set(pos_gal_rt) += fact_rt ;
148  }
149  conte ++ ;
150  }
151  }
152  }
153 
154  if (mquant%2==1) {
155  assert (baset=SIN_ODD) ;
156  for (int j=0; j<nbr_coefs(1)-1 ; j++) {
157  int baser = (*so.get_base().bases_1d[0]) (j, k) ;
158  pos_cf.set(1) = j ;
159  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
160  for (int i=1 ; i<nbr_coefs(0) ; i++) {
161  pos_cf.set(0) = i ;
162  pos_gal_r = pos_cf ;
163  pos_gal_r.set(0) = 0 ;
164  switch (baser) {
165  case CHEB_EVEN :
166  fact_r = - pow(-1, i) ;
167  break ;
168  case LEG_EVEN : {
169  fact_r = -1. ;
170  for (int t=0 ; t<i ; t++)
171  fact_r *= -double(2*t+1)/double(2*t+2) ;
172  }
173  break ;
174  default :
175  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vr" << endl ;
176  abort() ;
177  }
178  if (conte==cc) {
179  found = true ;
180  so.cf->set(pos_cf) = 1. ;
181  so.cf->set(pos_gal_r) += fact_r ;
182  }
183  conte ++ ;
184  }
185  }
186  }
187 
188  }
189 
190  // If not found put to zero :
191  if (!found)
192  so.set_zero() ;
193 }
194 
195 
197 
198  bool found = false ;
199  so.allocate_coef() ;
200  *so.cf = 0. ;
201  Index pos_cf (nbr_coefs) ;
202 
203  // Positions of the Galerkin basis
204  Index pos_gal_t (nbr_coefs) ;
205  Index pos_gal_r (nbr_coefs) ;
206  Index pos_gal_rt (nbr_coefs) ;
207  double fact_t, fact_r, fact_rt ;
208 
209  // Case k=0
210  {
211  pos_cf.set(2) = 0 ;
212  int baset = (*so.get_base().bases_1d[1]) (0) ;
213  assert (baset==SIN_EVEN) ;
214  for (int j=1 ; j<nbr_coefs(1)-1 ; j++) {
215  int baser = (*so.get_base().bases_1d[0]) (j, 0) ;
216  pos_cf.set(1) = j ;
217  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
218  for (int i=1 ; i<nbr_coefs(0)-1 ; i++) {
219  pos_cf.set(0) = i ;
220  pos_gal_r = pos_cf ;
221  pos_gal_r.set(0) = 0 ;
222  switch (baser) {
223  case CHEB_ODD :
224  fact_r = - (2*i+1) * pow(-1, i) ;
225  break ;
226  case LEG_ODD : {
227  fact_r = -1. ;
228  for (int t=0 ; t<i ; t++)
229  fact_r *= -double(2*t+3)/double(2*t+2) ;
230  }
231  break ;
232  default :
233  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vt" << endl ;
234  abort() ;
235  }
236  if (conte==cc) {
237  found = true ;
238  so.cf->set(pos_cf) = 1. ;
239  so.cf->set(pos_gal_r) += fact_r ;
240  }
241  conte ++ ;
242  }
243  }
244  }
245 
246 
247  // Case k==2 ; j==0
248  if (nbr_coefs(2)-1>2)
249  {
250  pos_cf.set(2) = 2 ;
251  int baset = (*so.get_base().bases_1d[1]) (2) ;
252  assert (baset==COS_ODD) ;
253  int baser = (*so.get_base().bases_1d[0]) (0, 2) ;
254  pos_cf.set(1) = 0 ;
255  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
256  for (int i=0 ; i<nbr_coefs(0) ; i++) {
257  pos_cf.set(0) = i ;
258  if (conte==cc) {
259  found = true ;
260  so.cf->set(pos_cf) = 1. ;
261  }
262  conte ++ ;
263  }
264  }
265 
266  // Case k==2 ; j!=0
267  if (nbr_coefs(2)-1>2)
268  {
269  pos_cf.set(2) = 2 ;
270  int baset = (*so.get_base().bases_1d[1]) (2) ;
271  assert (baset=COS_ODD) ;
272  for (int j=1 ; j<nbr_coefs(1)-1 ; j++) {
273  int baser = (*so.get_base().bases_1d[0]) (j, 2) ;
274  pos_cf.set(1) = j ;
275  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
276  for (int i=1 ; i<nbr_coefs(0) ; i++) {
277  pos_cf.set(0) = i ;pos_gal_r = pos_cf ;
278  pos_gal_r.set(0) = 0 ;
279  switch (baser) {
280  case CHEB_EVEN :
281  fact_r = - pow(-1, i) ;
282  break ;
283  case LEG_EVEN : {
284  fact_r = -1. ;
285  for (int t=0 ; t<i ; t++)
286  fact_r *= -double(2*t+1)/double(2*t+2) ;
287  }
288  break ;
289  default :
290  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vt" << endl ;
291  abort() ;
292  }
293  if (conte==cc) {
294  found = true ;
295  so.cf->set(pos_cf) = 1 ;
296  so.cf->set(pos_gal_r) += fact_r ;
297  }
298  conte ++ ;
299  }
300  }
301  }
302 
303 
304  // Case k==3 ; j==0
305  if (nbr_coefs(2)-1>3)
306  {
307  pos_cf.set(2) = 3 ;
308  int baset = (*so.get_base().bases_1d[1]) (3) ;
309  assert (baset==COS_ODD) ;
310  int baser = (*so.get_base().bases_1d[0]) (0, 3) ;
311  pos_cf.set(1) = 0 ;
312  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
313  for (int i=0 ; i<nbr_coefs(0) ; i++) {
314  pos_cf.set(0) = i ;
315  if (conte==cc) {
316  found = true ;
317  so.cf->set(pos_cf) = 1. ;
318  }
319  conte ++ ;
320 
321  }
322  }
323 
324  // Case k==3 ; j!=0
325  if (nbr_coefs(2)-1>3)
326  {
327  pos_cf.set(2) = 3 ;
328  int baset = (*so.get_base().bases_1d[1]) (3) ;
329  assert (baset=COS_ODD) ;
330  for (int j=1 ; j<nbr_coefs(1)-1 ; j++) {
331  int baser = (*so.get_base().bases_1d[0]) (j, 3) ;
332  pos_cf.set(1) = j ;
333  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
334  for (int i=1 ; i<nbr_coefs(0) ; i++) {
335  pos_cf.set(0) = i ;
336  pos_gal_r = pos_cf ;
337  pos_gal_r.set(0) = 0 ;
338  switch (baser) {
339  case CHEB_EVEN :
340  fact_r = - pow(-1, i) ;
341  break ;
342  case LEG_EVEN : {
343  fact_r = -1. ;
344  for (int t=0 ; t<i ; t++)
345  fact_r *= -double(2*t+1)/double(2*t+2) ;
346  }
347  break ;
348  default :
349  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vt" << endl ;
350  abort() ;
351  }
352  if (conte==cc) {
353  found = true ;
354  so.cf->set(pos_cf) = 1 ;
355  so.cf->set(pos_gal_r) += fact_r ;
356  }
357  conte ++ ;
358  }
359  }
360  }
361 
362  // Next ones
363  for (int k=4 ; k<nbr_coefs(2)-1 ; k++) {
364 
365  int mquant = (k%2==0) ? int(k/2) : int((k-1)/2) ;
366  pos_cf.set(2) = k ;
367  int baset = (*so.get_base().bases_1d[1]) (k) ;
368 
369  if (mquant%2==0) {
370  assert (baset=SIN_EVEN) ;
371  for (int j=1 ; j<nbr_coefs(1)-1 ; j++) {
372  int baser = (*so.get_base().bases_1d[0]) (j, k) ;
373  pos_cf.set(1) = j ;
374  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
375  for (int i=1 ; i<nbr_coefs(0)-1 ; i++) {
376  pos_cf.set(0) = i ;
377  pos_gal_r = pos_cf ;
378  pos_gal_r.set(0) = 0 ;
379  switch (baser) {
380  case CHEB_ODD :
381  fact_r = - (2*i+1) * pow(-1, i) ;
382  break ;
383  case LEG_ODD : {
384  fact_r = -1. ;
385  for (int t=0 ; t<i ; t++)
386  fact_r *= -double(2*t+3)/double(2*t+2) ;
387  }
388  break ;
389  default :
390  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vt" << endl ;
391  abort() ;
392  }
393  if (conte==cc) {
394  found = true ;
395  so.cf->set(pos_cf) = 1 ;
396  so.cf->set(pos_gal_r) += fact_r ;
397  }
398  conte ++ ;
399  }
400  }
401  }
402 
403  if (mquant%2==1) {
404  assert (baset=COS_ODD) ;
405  for (int j=1; j<nbr_coefs(1)-1 ; j++) {
406  int baser = (*so.get_base().bases_1d[0]) (j, k) ;
407  pos_cf.set(1) = j ;
408  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
409  for (int i=1 ; i<nbr_coefs(0) ; i++) {
410  pos_cf.set(0) = i ;
411  pos_gal_r = pos_cf ;
412  pos_gal_r.set(0) = 0 ;
413  pos_gal_t = pos_cf ;
414  pos_gal_t.set(1) = 0 ;
415  pos_gal_rt = pos_cf ;
416  pos_gal_rt.set(0) = 0 ;
417  pos_gal_rt.set(1) = 0 ;
418  switch (baser) {
419  case CHEB_EVEN :
420  fact_r = -pow(-1, i) ;
421  fact_t = -1. ;
422  fact_rt = pow(-1, i) ;
423  break ;
424  case LEG_EVEN : {
425  double l0 = 1 ;
426  for (int t=0 ; t<i ; t++)
427  l0 *= -double(2*t+1)/double(2*t+2) ;
428  fact_r = - l0 ;
429  fact_t = -1. ;
430  fact_rt = l0 ;
431  }
432  break ;
433  default :
434  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vt" << endl ;
435  abort() ;
436  }
437  if (conte==cc) {
438  found = true ;
439  so.cf->set(pos_cf) = 1 ;
440  so.cf->set(pos_gal_r) += fact_r ;
441  so.cf->set(pos_gal_t) += fact_t ;
442  so.cf->set(pos_gal_rt) += fact_rt ;
443  }
444  conte ++ ;
445  }
446  }
447  }
448  }
449 
450  // If not found put to zero :
451  if (!found)
452  so.set_zero() ;
453 }
454 
455 
457 
458  bool found = false ;
459  so.allocate_coef() ;
460  *so.cf = 0. ;
461  Index pos_cf (nbr_coefs) ;
462 
463  // Positions of the Galerkin basis
464  Index pos_gal_t (nbr_coefs) ;
465  Index pos_gal_r (nbr_coefs) ;
466  Index pos_gal_rt (nbr_coefs) ;
467  double fact_t, fact_r, fact_rt ;
468 
469  // k = 0 ; j==0
470  {
471  pos_cf.set(2) = 0 ;
472  int baset = (*so.get_base().bases_1d[1]) (0) ;
473  assert (baset==SIN_ODD) ;
474  int baser = (*so.get_base().bases_1d[0]) (0, 0) ;
475  pos_cf.set(1) = 0 ;
476  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
477  for (int i=0 ; i<nbr_coefs(0)-1 ; i++) {
478  pos_cf.set(0) = i ;
479  if (conte==cc) {
480  found = true ;
481  so.cf->set(pos_cf) = 1 ;
482  }
483  conte ++ ;
484  }
485  }
486 
487  // Case k==0 ; j!=0
488  {
489  pos_cf.set(2) = 0 ;
490  int baset = (*so.get_base().bases_1d[1]) (0) ;
491  assert (baset=SIN_ODD) ;
492  for (int j=1 ; j<nbr_coefs(1)-1 ; j++) {
493  int baser = (*so.get_base().bases_1d[0]) (j, 0) ;
494  pos_cf.set(1) = j ;
495  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
496  for (int i=1 ; i<nbr_coefs(0)-1 ; i++) {
497  pos_cf.set(0) = i ;
498  pos_gal_r = pos_cf ;
499  pos_gal_r.set(0) = 0 ;
500  switch (baser) {
501  case CHEB_ODD :
502  fact_r = - (2*i+1) * pow(-1, i) ;
503  break ;
504  case LEG_ODD : {
505  fact_r = -1. ;
506  for (int t=0 ; t<i ; t++)
507  fact_r *= -double(2*t+3)/double(2*t+2) ;
508  }
509  break ;
510  default :
511  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vp" << endl ;
512  abort() ;
513  }
514  if (conte==cc) {
515  found = true ;
516  so.cf->set(pos_cf) = 1 ;
517  so.cf->set(pos_gal_r) += fact_r ;
518  }
519  conte ++ ;
520  }
521  }
522  }
523 
524 
525 
526  // Case k==2 ; j==0
527  if (nbr_coefs(2)-1>2)
528  {
529  pos_cf.set(2) = 2 ;
530  int baset = (*so.get_base().bases_1d[1]) (2) ;
531  assert (baset==COS_EVEN) ;
532  int baser = (*so.get_base().bases_1d[0]) (0, 2) ;
533  pos_cf.set(1) = 0 ;
534  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
535  for (int i=0 ; i<nbr_coefs(0) ; i++) {
536  pos_cf.set(0) = i ;
537  if (conte==cc) {
538  found = true ;
539  so.cf->set(pos_cf) = 1. ;
540  }
541  conte ++ ;
542  }
543  }
544 
545  // Case k==2 ; j!=0
546  if (nbr_coefs(2)-1>2)
547  {
548  pos_cf.set(2) = 2 ;
549  int baset = (*so.get_base().bases_1d[1]) (2) ;
550  assert (baset=COS_EVEN) ;
551  for (int j=1 ; j<nbr_coefs(1) ; j++) {
552  int baser = (*so.get_base().bases_1d[0]) (j, 2) ;
553  pos_cf.set(1) = j ;
554  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
555  for (int i=1 ; i<nbr_coefs(0) ; i++) {
556  pos_cf.set(0) = i ;pos_gal_r = pos_cf ;
557  pos_gal_r.set(0) = 0 ;
558  switch (baser) {
559  case CHEB_EVEN :
560  fact_r = - pow(-1, i) ;
561  break ;
562  case LEG_EVEN : {
563  fact_r = -1. ;
564  for (int t=0 ; t<i ; t++)
565  fact_r *= -double(2*t+1)/double(2*t+2) ;
566  }
567  break ;
568  default :
569  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vp" << endl ;
570  abort() ;
571  }
572 
573  if (conte==cc) {
574  found = true ;
575  so.cf->set(pos_cf) = 1 ;
576  so.cf->set(pos_gal_r) += fact_r ;
577  }
578  conte ++ ;
579  }
580  }
581  }
582 
583 
584  // Case k==3 ; j==0
585  if (nbr_coefs(2)-1>3)
586  {
587  pos_cf.set(2) = 3 ;
588  int baset = (*so.get_base().bases_1d[1]) (3) ;
589  assert (baset==COS_EVEN) ;
590  int baser = (*so.get_base().bases_1d[0]) (0, 3) ;
591  pos_cf.set(1) = 0 ;
592  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
593  for (int i=0 ; i<nbr_coefs(0) ; i++) {
594  pos_cf.set(0) = i ;
595  if (conte==cc) {
596  found = true ;
597  so.cf->set(pos_cf) = 1. ;
598  }
599  conte ++ ;
600  }
601  }
602 
603  // Case k==3 ; j!=0
604  if (nbr_coefs(2)-1>3)
605  {
606  pos_cf.set(2) = 3 ;
607  int baset = (*so.get_base().bases_1d[1]) (3) ;
608  assert (baset=COS_EVEN) ;
609  for (int j=1 ; j<nbr_coefs(1) ; j++) {
610  int baser = (*so.get_base().bases_1d[0]) (j, 3) ;
611  pos_cf.set(1) = j ;
612  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
613  for (int i=1 ; i<nbr_coefs(0) ; i++) {
614  pos_cf.set(0) = i ;
615  pos_gal_r = pos_cf ;
616  pos_gal_r.set(0) = 0 ;
617  switch (baser) {
618  case CHEB_EVEN :
619  fact_r = - pow(-1, i) ;
620  break ;
621  case LEG_EVEN : {
622  fact_r = -1. ;
623  for (int t=0 ; t<i ; t++)
624  fact_r *= -double(2*t+1)/double(2*t+2) ;
625  }
626  break ;
627  default :
628  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vp" << endl ;
629  abort() ;
630  }
631  if (conte==cc) {
632  found = true ;
633  so.cf->set(pos_cf) = 1 ;
634  so.cf->set(pos_gal_r) += fact_r ;
635  }
636  conte ++ ;
637  }
638  }
639  }
640 
641  // k = 4 ; j==0
642  if (nbr_coefs(2)-1>4)
643  {
644  pos_cf.set(2) = 4 ;
645  int baset = (*so.get_base().bases_1d[1]) (4) ;
646  assert (baset==SIN_ODD) ;
647  int baser = (*so.get_base().bases_1d[0]) (0, 4) ;
648  pos_cf.set(1) = 0 ;
649  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
650  for (int i=0 ; i<nbr_coefs(0)-1 ; i++) {
651  pos_cf.set(0) = i ;
652  if (conte==cc) {
653  found = true ;
654  so.cf->set(pos_cf) = 1 ;
655  }
656  conte ++ ;
657  }
658  }
659 
660  // Case k==4 ; j!=0
661  if (nbr_coefs(2)-1>4)
662  {
663  pos_cf.set(2) = 4 ;
664  int baset = (*so.get_base().bases_1d[1]) (4) ;
665  assert (baset=SIN_ODD) ;
666  for (int j=1 ; j<nbr_coefs(1)-1 ; j++) {
667  int baser = (*so.get_base().bases_1d[0]) (j, 4) ;
668  pos_cf.set(1) = j ;
669  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
670  for (int i=1 ; i<nbr_coefs(0)-1 ; i++) {
671  pos_cf.set(0) = i ;
672  pos_gal_r = pos_cf ;
673  pos_gal_r.set(0) = 0 ;
674  switch (baser) {
675  case CHEB_ODD :
676  fact_r = - (2*i+1) * pow(-1, i) ;
677  break ;
678  case LEG_ODD : {
679  fact_r = -1. ;
680  for (int t=0 ; t<i ; t++)
681  fact_r *= -double(2*t+3)/double(2*t+2) ;
682  }
683  break ;
684  default :
685  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vp" << endl ;
686  abort() ;
687  }
688  if (conte==cc) {
689  found = true ;
690  so.cf->set(pos_cf) = 1 ;
691  so.cf->set(pos_gal_r) += fact_r ;
692  }
693  conte ++ ;
694  }
695  }
696  }
697 
698 
699  // k = 5 ; j==0
700  if (nbr_coefs(2)-1>5)
701  {
702  pos_cf.set(2) = 5 ;
703  int baset = (*so.get_base().bases_1d[1]) (5) ;
704  assert (baset==SIN_ODD) ;
705  int baser = (*so.get_base().bases_1d[0]) (0, 5) ;
706  pos_cf.set(1) = 0 ;
707  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
708  for (int i=0 ; i<nbr_coefs(0)-1 ; i++) {
709  pos_cf.set(0) = i ;
710  if (conte==cc) {
711  found = true ;
712  so.cf->set(pos_cf) = 1 ;
713  }
714  conte ++ ;
715  }
716  }
717 
718  // Case k==5 ; j!=0
719  if (nbr_coefs(2)-1>5)
720  {
721  pos_cf.set(2) = 5 ;
722  int baset = (*so.get_base().bases_1d[1]) (5) ;
723  assert (baset=SIN_ODD) ;
724  for (int j=1 ; j<nbr_coefs(1)-1 ; j++) {
725  int baser = (*so.get_base().bases_1d[0]) (j,5) ;
726  pos_cf.set(1) = j ;
727  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
728  for (int i=1 ; i<nbr_coefs(0)-1 ; i++) {
729  pos_cf.set(0) = i ;
730  pos_gal_r = pos_cf ;
731  pos_gal_r.set(0) = 0 ;
732  switch (baser) {
733  case CHEB_ODD :
734  fact_r = - (2*i+1) * pow(-1, i) ;
735  break ;
736  case LEG_ODD : {
737  fact_r = -1. ;
738  for (int t=0 ; t<i ; t++)
739  fact_r *= -double(2*t+3)/double(2*t+2) ;
740  }
741  break ;
742  default :
743  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vp" << endl ;
744  abort() ;
745  }
746  if (conte==cc) {
747  found = true ;
748  so.cf->set(pos_cf) = 1 ;
749  so.cf->set(pos_gal_r) += fact_r ;
750  }
751  conte ++ ;
752  }
753  }
754  }
755 
756 
757  // Next ones
758  for (int k=6 ; k<nbr_coefs(2)-1 ; k++) {
759 
760  int mquant = (k%2==0) ? int(k/2) : int((k-1)/2) ;
761  pos_cf.set(2) = k ;
762  int baset = (*so.get_base().bases_1d[1]) (k) ;
763 
764  if (mquant%2==0) {
765 
766  assert (baset=SIN_ODD) ;
767  for (int j=0 ; j<nbr_coefs(1)-1 ; j++) {
768  int baser = (*so.get_base().bases_1d[0]) (j, 0) ;
769  pos_cf.set(1) = j ;
770  assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
771  for (int i=1 ; i<nbr_coefs(0)-1 ; i++) {
772  pos_cf.set(0) = i ;
773  pos_gal_r = pos_cf ;
774  pos_gal_r.set(0) = 0 ;
775  switch (baser) {
776  case CHEB_ODD :
777  fact_r = - (2*i+1) * pow(-1, i) ;
778  break ;
779  case LEG_ODD : {
780  fact_r = -1. ;
781  for (int t=0 ; t<i ; t++)
782  fact_r *= -double(2*t+3)/double(2*t+2) ;
783  }
784  break ;
785  default :
786  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vp" << endl ;
787  abort() ;
788  }
789  if (conte==cc) {
790  found = true ;
791  so.cf->set(pos_cf) = 1 ;
792  so.cf->set(pos_gal_r) += fact_r ;
793  }
794  conte ++ ;
795  }
796  }
797  }
798 
799 
800  if (mquant%2==1) {
801  assert (baset=COS_EVEN) ;
802  for (int j=1; j<nbr_coefs(1) ; j++) {
803  int baser = (*so.get_base().bases_1d[0]) (j, k) ;
804  pos_cf.set(1) = j ;
805  assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
806  for (int i=1 ; i<nbr_coefs(0) ; i++) {
807  pos_cf.set(0) = i ;
808  pos_gal_r = pos_cf ;
809  pos_gal_r.set(0) = 0 ;
810  pos_gal_t = pos_cf ;
811  pos_gal_t.set(1) = 0 ;
812  pos_gal_rt = pos_cf ;
813  pos_gal_rt.set(0) = 0 ;
814  pos_gal_rt.set(1) = 0 ;
815  switch (baser) {
816  case CHEB_EVEN :
817  fact_r = -pow(-1, i) ;
818  fact_t = -1. ;
819  fact_rt = pow(-1, i) ;
820  break ;
821  case LEG_EVEN : {
822  double l0 = 1 ;
823  for (int t=0 ; t<i ; t++)
824  l0 *= -double(2*t+1)/double(2*t+2) ;
825  fact_r = - l0 ;
826  fact_t = -1. ;
827  fact_rt = l0 ;
828  }
829  break ;
830  default :
831  cerr << "Strange base in Domain_nucleus::affecte_tau_val_domain_vp" << endl ;
832  abort() ;
833  }
834  if (conte==cc) {
835  found = true ;
836  so.cf->set(pos_cf) = 1 ;
837  so.cf->set(pos_gal_r) += fact_r ;
838  so.cf->set(pos_gal_t) += fact_t ;
839  so.cf->set(pos_gal_rt) += fact_rt ;
840  }
841  conte ++ ;
842  }
843  }
844  }
845  }
846 
847  // If not found put to zero :
848  if (!found)
849  so.set_zero() ;
850 }
851 
852 
853 
854 void Domain_nucleus::affecte_tau_one_coef_val_domain (Val_domain& so, int mlim, int llim, int cc, int& conte) const {
855 
856  int kmin = 2*mlim+2 ;
857  int lquant ;
858 
859  so.is_zero = false ;
860  so.allocate_coef() ;
861  *so.cf=0. ;
862  Index pos_cf(nbr_coefs) ;
863 
864  bool found = false ;
865 
866  // Positions of the Galerkin basis
867  Index pos_gal_t (nbr_coefs) ;
868  Index pos_gal_r (nbr_coefs) ;
869  Index pos_gal_rt (nbr_coefs) ;
870  double fact_t, fact_r, fact_rt ;
871 
872  // Loop on phi :
873  for (int k=0 ; k<nbr_coefs(2)-1 ; k++)
874  if (k!=1) {
875  pos_cf.set(2) = k ;
876  // Loop on theta
877  int baset = (*so.get_base().bases_1d[1]) (k) ;
878  for (int j=0 ; j<nbr_coefs(1) ; j++) {
879  int baser = (*so.get_base().bases_1d[0]) (j, k) ;
880  pos_cf.set(1) = j ;
881  // Loop on r :
882  for (int i=0 ; i<nbr_coefs(0) ; i++) {
883  pos_cf.set(0) = i ;
884  switch (baset) {
885  case COS_EVEN :
886  lquant = 2*j ;
887  // No galerkin :
888  if ((k<kmin) && (lquant<=llim)) {
889  if (conte==cc) {
890  found = true ;
891  so.cf->set(pos_cf) = 1. ;
892  }
893  conte ++ ;
894  }
895  else if (k<kmin) {
896  if (i!=0) {
897  if (conte==cc) {
898  found = true ;
899  // Galerkin base in r only
900  pos_gal_r = pos_cf ;
901  pos_gal_r.set(0) = 0 ;
902  switch (baser) {
903  case CHEB_EVEN :
904  fact_r = - pow(-1, i) ;
905  break ;
906  case LEG_EVEN : {
907  fact_r = -1. ;
908  for (int t=0 ; t<i ; t++)
909  fact_r *= -double(2*t+1)/double(2*t+2) ;
910  }
911  break ;
912  default :
913  cerr << "Strange base in Domain_nucleus::affecte_one_coef_val_domain" << endl ;
914  abort() ;
915  }
916  so.cf->set(pos_cf) = 1 ;
917  so.cf->set(pos_gal_r) += fact_r ;
918  }
919  conte ++ ;
920  }
921  }
922  else if ((j!=0) && (i!=0)) {
923  if (conte==cc) {
924  found = true ;
925  // Need to use two_dimensional Galerkin basis (aouch !)
926  pos_gal_r = pos_cf ;
927  pos_gal_r.set(0) = 0 ;
928  pos_gal_t = pos_cf ;
929  pos_gal_t.set(1) = 0 ;
930  pos_gal_rt = pos_cf ;
931  pos_gal_rt.set(0) = 0 ;
932  pos_gal_rt.set(1) = 0 ;
933  switch (baser) {
934  case CHEB_EVEN :
935  fact_r = -pow(-1, i) ;
936  fact_t = -1. ;
937  fact_rt = pow(-1, i) ;
938  break ;
939  case LEG_EVEN : {
940  double l0 = 1 ;
941  for (int t=0 ; t<i ; t++)
942  l0 *= -double(2*t+1)/double(2*t+2) ;
943  fact_r = - l0 ;
944  fact_t = -1. ;
945  fact_rt = l0 ;
946  }
947  break ;
948  default :
949  cerr << "Strange base in Domain_nucleus::affecte_one_coef_val_domain" << endl ;
950  abort() ;
951  }
952  so.cf->set(pos_cf) = 1. ;
953  so.cf->set(pos_gal_r) = fact_r ;
954  so.cf->set(pos_gal_t) = fact_t ;
955  so.cf->set(pos_gal_rt) = fact_rt ;
956  }
957  conte ++ ;
958  }
959  break ;
960  case COS_ODD:
961  lquant = 2*j+1 ;
962  if ((j!=nbr_coefs(1)-1) && (i!=nbr_coefs(0)-1)) {
963  if ((k<kmin) && (lquant<=llim+1)) {
964  if (conte==cc) {
965  found = true ;
966  so.cf->set(pos_cf) = 1. ;
967  }
968  conte++ ;
969  }
970  else {
971  if ((k<kmin) && (i!=0)) {
972  if (conte==cc) {
973  found = true ;
974  pos_gal_r = pos_cf ;
975  pos_gal_r.set(0) = 0 ;
976  switch (baser) {
977  case CHEB_ODD :
978  fact_r = - (2*i+1) * pow(-1, i) ;
979  break ;
980  case LEG_ODD : {
981  fact_r = -1. ;
982  for (int t=0 ; t<i ; t++)
983  fact_r *= -double(2*t+3)/double(2*t+2) ;
984  }
985  break ;
986  default :
987  cerr << "Strange base in Domain_nucleus::affecte_one_coef_val_domain" << endl ;
988  abort() ;
989  }
990 
991  so.cf->set(pos_cf) = 1. ;
992  so.cf->set(pos_gal_r) = fact_r ;
993  }
994  conte ++ ;
995  }
996  else if ((j!=0) && (i!=0)) {
997  if (conte==cc) {
998  found = true ;
999  // Need to use two_dimensional Galerkin basis (aouch !)
1000  pos_gal_r = pos_cf ;
1001  pos_gal_r.set(0) = 0 ;
1002  pos_gal_t = pos_cf ;
1003  pos_gal_t.set(1) = 0 ;
1004  pos_gal_rt = pos_cf ;
1005  pos_gal_rt.set(0) = 0 ;
1006  pos_gal_rt.set(1) = 0 ;
1007  switch (baser) {
1008  case CHEB_ODD :
1009  fact_r = -pow(-1, i)*(2*i+1) ;
1010  fact_t = -1. ;
1011  fact_rt = pow(-1, i)*(2*i+1) ;
1012  break ;
1013  case LEG_ODD : {
1014  double l0 = 1 ;
1015  for (int t=0 ; t<i ; t++)
1016  l0 *= -double(2*t+3)/double(2*t+2) ;
1017  fact_r = - l0 ;
1018  fact_t = -1. ;
1019  fact_rt = l0 ;
1020  }
1021  break ;
1022  default :
1023  cerr << "Strange base in Domain_nucleus::affecte_one_coef_val_domain" << endl ;
1024  abort() ;
1025  }
1026  so.cf->set(pos_cf) = 1. ;
1027  so.cf->set(pos_gal_r) = fact_r ;
1028  so.cf->set(pos_gal_t) = fact_t ;
1029  so.cf->set(pos_gal_rt) = fact_rt ;
1030  }
1031  conte ++ ;
1032  }
1033  }
1034  }
1035  break ;
1036  case SIN_EVEN:
1037  lquant = 2*j ;
1038  if ((j!=0) && (j!=nbr_coefs(1)-1)) {
1039  if ((k<kmin+2) && (lquant<=llim)) {
1040  if (conte==cc) {
1041  found = true ;
1042  so.cf->set(pos_cf) = 1. ;
1043  }
1044  conte ++ ;
1045  }
1046  else {
1047  if ((k<kmin+2) && (i!=0)) {
1048  // Galerkin base in r only
1049  if (conte==cc) {
1050  found = true ;
1051  pos_gal_r = pos_cf ;
1052  pos_gal_r.set(0) = 0 ;
1053  switch (baser) {
1054  case CHEB_EVEN :
1055  fact_r = - pow(-1, i) ;
1056  break ;
1057  case LEG_EVEN : {
1058  fact_r = -1. ;
1059  for (int t=0 ; t<i ; t++)
1060  fact_r *= -double(2*t+1)/double(2*t+2) ;
1061  }
1062  break ;
1063  default :
1064  cerr << "Strange base in Domain_nucleus_::affecte_one_coef_val_domain" << endl ;
1065  abort() ;
1066  }
1067  so.cf->set(pos_cf) = 1. ;
1068  so.cf->set(pos_gal_r) = fact_r ;
1069  }
1070  conte ++ ;
1071  }
1072  else {
1073  //Double Galerkin
1074  if ((j!=1) && (i!=0)) {
1075 
1076  if (conte==cc) {
1077  found = true ;
1078  // Need to use two_dimensional Galerkin basis (aouch !)
1079  pos_gal_r = pos_cf ;
1080  pos_gal_r.set(0) = 0 ;
1081  pos_gal_t = pos_cf ;
1082  pos_gal_t.set(1) = 1 ;
1083  pos_gal_rt = pos_cf ;
1084  pos_gal_rt.set(0) = 0 ;
1085  pos_gal_rt.set(1) = 1 ;
1086  switch (baser) {
1087  case CHEB_EVEN :
1088  fact_r = -pow(-1, i) ;
1089  fact_t = -j ;
1090  fact_rt = pow(-1, i)*j ;
1091  break ;
1092  case LEG_EVEN : {
1093  double l0 = 1 ;
1094  for (int t=0 ; t<i ; t++)
1095  l0 *= -double(2*t+1)/double(2*t+2) ;
1096  fact_r = - l0 ;
1097  fact_t = -j ;
1098  fact_rt = l0*j ;
1099  }
1100  break ;
1101  default :
1102  cerr << "Strange base in Domain_nucleus::affecte_one_domain_val_domain" << endl ;
1103  abort() ;
1104  }
1105  so.cf->set(pos_cf) = 1 ;
1106  so.cf->set(pos_gal_r) = fact_r ;
1107  so.cf->set(pos_gal_t) = fact_t ;
1108  so.cf->set(pos_gal_rt) = fact_rt ;
1109  }
1110  conte ++ ;
1111  }
1112  }
1113  }
1114  }
1115  break ;
1116  case SIN_ODD:
1117  lquant = 2*j+1 ;
1118  if ((j!=nbr_coefs(1)-1) && (i!=nbr_coefs(0)-1)) {
1119  if ((k<kmin+2) && (lquant<=llim+1)) {
1120  if (conte==cc) {
1121  found = true ;
1122  so.cf->set(pos_cf) = 1. ;
1123  }
1124  conte++ ;
1125  }
1126  else {
1127  if ((k<kmin+2) && (i!=0)) {
1128  if (conte==cc) {
1129  found = true ;
1130  pos_gal_r = pos_cf ;
1131  pos_gal_r.set(0) = 0 ;
1132  switch (baser) {
1133  case CHEB_ODD :
1134  fact_r = - (2*i+1) * pow(-1, i) ;
1135  break ;
1136  case LEG_ODD : {
1137  fact_r = -1. ;
1138  for (int t=0 ; t<i ; t++)
1139  fact_r *= -double(2*t+3)/double(2*t+2) ;
1140  }
1141  break ;
1142  default :
1143  cerr << "Strange base in Domain_nucleus::affecte_one_coef_val_domain" << endl ;
1144  abort() ;
1145  }
1146 
1147  so.cf->set(pos_cf) = 1. ;
1148  so.cf->set(pos_gal_r) = fact_r ;
1149  }
1150  conte ++ ;
1151  }
1152  else if ((j!=0) && (i!=0)) {
1153  if (conte==cc) {
1154  found = true ;
1155  // Need to use two_dimensional Galerkin basis (aouch !)
1156  pos_gal_r = pos_cf ;
1157  pos_gal_r.set(0) = 0 ;
1158  pos_gal_t = pos_cf ;
1159  pos_gal_t.set(1) = 0 ;
1160  pos_gal_rt = pos_cf ;
1161  pos_gal_rt.set(0) = 0 ;
1162  pos_gal_rt.set(1) = 0 ;
1163  switch (baser) {
1164  case CHEB_ODD :
1165  fact_r = -pow(-1, i)*(2*i+1) ;
1166  fact_t = -(2*j+1) ;
1167  fact_rt = pow(-1, i)*(2*i+1)*(2*j+1) ;
1168  break ;
1169  case LEG_ODD : {
1170  double l0 = 1 ;
1171  for (int t=0 ; t<i ; t++)
1172  l0 *= -double(2*t+3)/double(2*t+2) ;
1173  fact_r = - l0 ;
1174  fact_t = -(2*j+1) ;
1175  fact_rt = l0*(2*j+1) ;
1176  }
1177  break ;
1178  default :
1179  cerr << "Strange base in Domain_nucleus::affecte_one_coef_val_domain" << endl ;
1180  abort() ;
1181  }
1182  so.cf->set(pos_cf) = 1. ;
1183  so.cf->set(pos_gal_r) = fact_r ;
1184  so.cf->set(pos_gal_t) = fact_t ;
1185  so.cf->set(pos_gal_rt) = fact_rt ;
1186  }
1187  conte ++ ;
1188  }
1189  }
1190  }
1191  break ;
1192  default:
1193  cerr << "Unknow theta basis in Domain_nucleus::affecte_coef_val_domain" << endl ;
1194  abort() ;
1195  }
1196  }
1197  }
1198  }
1199  // If not found put to zero :
1200  if (!found)
1201  so.set_zero() ;
1202 }
1203 
1204 void Domain_nucleus::affecte_tau_one_coef (Tensor& tt, int dom, int cc, int& pos_cf) const {
1205 
1206  // Check right domain
1207  assert (tt.get_space().get_domain(dom)==this) ;
1208 
1209  int val = tt.get_valence() ;
1210  switch (val) {
1211  case 0 :
1212  affecte_tau_one_coef_val_domain (tt.set().set_domain(dom), 0, 0, cc, pos_cf) ;
1213  break ;
1214  case 1 : {
1215  bool found = false ;
1216  // Cartesian basis
1217  if (tt.get_basis().get_basis(dom)==CARTESIAN_BASIS) {
1218  affecte_tau_one_coef_val_domain (tt.set(1).set_domain(dom), 0, 0, cc, pos_cf) ;
1219  affecte_tau_one_coef_val_domain (tt.set(2).set_domain(dom), 0, 0, cc, pos_cf) ;
1220  affecte_tau_one_coef_val_domain (tt.set(3).set_domain(dom), 0, 0, cc, pos_cf) ;
1221  found = true ;
1222  }
1223  // Spherical coordinates
1224  if (tt.get_basis().get_basis(dom)==SPHERICAL_BASIS) {
1225  affecte_tau_one_coef_val_domain_vr (tt.set(1).set_domain(dom), cc, pos_cf) ;
1226  affecte_tau_one_coef_val_domain_vt (tt.set(2).set_domain(dom), cc, pos_cf) ;
1227  affecte_tau_one_coef_val_domain_vp (tt.set(3).set_domain(dom), cc, pos_cf) ;
1228  found = true ;
1229  }
1230  if (!found) {
1231  cerr << "Unknown type of vector Domain_nucleus::affecte_tau_one_coef" << endl ;
1232  abort() ;
1233  }
1234  }
1235  break ;
1236  case 2 : {
1237  bool found = false ;
1238  // Cartesian basis and symetric
1239  if ((tt.get_basis().get_basis(dom)==CARTESIAN_BASIS) && (tt.get_n_comp()==6)) {
1240  affecte_tau_one_coef_val_domain (tt.set(1,1).set_domain(dom), 0, 0, cc, pos_cf) ;
1241  affecte_tau_one_coef_val_domain (tt.set(1,2).set_domain(dom), 0, 0, cc, pos_cf) ;
1242  affecte_tau_one_coef_val_domain (tt.set(1,3).set_domain(dom), 0, 0, cc, pos_cf) ;
1243  affecte_tau_one_coef_val_domain (tt.set(2,2).set_domain(dom), 0, 0, cc, pos_cf) ;
1244  affecte_tau_one_coef_val_domain (tt.set(2,3).set_domain(dom), 0, 0, cc, pos_cf) ;
1245  affecte_tau_one_coef_val_domain (tt.set(3,3).set_domain(dom), 0, 0, cc, pos_cf) ;
1246  found = true ;
1247  }
1248  // Cartesian basis and not symetric
1249  if ((tt.get_basis().get_basis(dom)==CARTESIAN_BASIS) && (tt.get_n_comp()==9)) {
1250  affecte_tau_one_coef_val_domain (tt.set(1,1).set_domain(dom), 0, 0, cc, pos_cf) ;
1251  affecte_tau_one_coef_val_domain (tt.set(1,2).set_domain(dom), 0, 0, cc, pos_cf) ;
1252  affecte_tau_one_coef_val_domain (tt.set(1,3).set_domain(dom), 0, 0, cc, pos_cf) ;
1253  affecte_tau_one_coef_val_domain (tt.set(2,1).set_domain(dom), 0, 0, cc, pos_cf) ;
1254  affecte_tau_one_coef_val_domain (tt.set(2,2).set_domain(dom), 0, 0, cc, pos_cf) ;
1255  affecte_tau_one_coef_val_domain (tt.set(2,3).set_domain(dom), 0, 0, cc, pos_cf) ;
1256  affecte_tau_one_coef_val_domain (tt.set(3,1).set_domain(dom), 0, 0, cc, pos_cf) ;
1257  affecte_tau_one_coef_val_domain (tt.set(3,2).set_domain(dom), 0, 0, cc, pos_cf) ;
1258  affecte_tau_one_coef_val_domain (tt.set(3,3).set_domain(dom), 0, 0, cc, pos_cf) ;
1259  found = true ;
1260  }
1261  if (!found) {
1262  cerr << "Unknown type of 2-tensor Domain_nucleus::affecte_tau_one_coef" << endl ;
1263  abort() ;
1264  }
1265  }
1266  break ;
1267  default :
1268  cerr << "Valence " << val << " not implemented in Domain_nucleus::affecte_tau" << endl ;
1269  break ;
1270  }
1271 }}
reference set(const Index &pos)
Read/write of an element.
Definition: array.hpp:186
Bases_container bases_1d
Arrays containing the various basis of decomposition.
int get_basis(int nd) const
Read only the basis in a given domain.
Definition: base_tensor.hpp:93
void affecte_tau_one_coef_val_domain(Val_domain &so, int mlim, int llim, int cc, int &pos_cf) const
Sets at most one coefficient of a Val_domain to 1.
void affecte_tau_one_coef_val_domain_vp(Val_domain &so, int cc, int &pos_cf) const
Sets at most one coefficient of a Val_domain to 1.
virtual void affecte_tau_one_coef(Tensor &, int, int, int &) const
Sets at most one coefficient of a Tensor to 1.
void affecte_tau_one_coef_val_domain_vr(Val_domain &so, int cc, int &pos_cf) const
Sets at most one coefficient of a Val_domain to 1.
void affecte_tau_one_coef_val_domain_vt(Val_domain &so, int cc, int &pos_cf) const
Sets at most one coefficient of a Val_domain to 1.
Dim_array nbr_coefs
Number of coefficients.
Definition: space.hpp:66
Class that gives the position inside a multi-dimensional Array.
Definition: index.hpp:38
int & set(int i)
Read/write of the position in a given dimension.
Definition: index.hpp:72
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
Definition: scalar.hpp:555
const Domain * get_domain(int i) const
returns a pointer on the domain.
Definition: space.hpp:1385
Tensor handling.
Definition: tensor.hpp:149
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
Definition: tensor_impl.hpp:91
const Base_tensor & get_basis() const
Returns the vectorial basis (triad) on which the components are defined.
Definition: tensor.hpp:504
int get_n_comp() const
Returns the number of stored components.
Definition: tensor.hpp:514
int get_valence() const
Returns the valence.
Definition: tensor.hpp:509
const Space & get_space() const
Returns the Space.
Definition: tensor.hpp:499
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Definition: val_domain.hpp:69
void set_zero()
Sets the Val_domain to zero (logical state to zero and arrays destroyed).
Definition: val_domain.cpp:223
void allocate_coef()
Allocates the values in the coefficient space and destroys the values in the configuration space.
Definition: val_domain.cpp:216
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
Definition: val_domain.hpp:77
bool is_zero
Indicator used for null fields (for speed issues).
Definition: val_domain.hpp:74
const Base_spectral & get_base() const
Returns the basis of decomposition.
Definition: val_domain.hpp:122