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