KADATH
domain.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 "Kadath_point_h/kadath.hpp"
21 
22 //num_dom
23 // ndim
24 //nbr_points
25 // nbr_coefs
26 //type_base
27 // coloc
28 //absol
29 // cart
30 //radius
31 // cart_surr
32 namespace Kadath {
33 
34 
35 // Constructor by copy
36 Domain::Domain (const Domain& so) :
37  num_dom{so.num_dom}, ndim{so.ndim}, nbr_points{so.nbr_points}, nbr_coefs{so.nbr_coefs}, type_base{so.type_base},
38  coloc{ndim,do_not_initialize}, absol{ndim,do_not_initialize}, cart{ndim,do_not_initialize},
39  radius{so.radius ? new Val_domain{*so.radius} : nullptr}, cart_surr{ndim,do_not_initialize}
40 {
41  for (int i=0 ; i<ndim ; i++) coloc[i] = (so.coloc[i] ? new Array<double>{*so.coloc[i]} : nullptr) ;
42  for (int i=0 ; i<ndim ; i++) absol[i] = (so.absol[i] ? new Val_domain{*so.absol[i]} : nullptr) ;
43  for (int i=0 ; i<ndim ; i++) cart[i] = (so.cart[i] ? new Val_domain{*so.cart[i]} : nullptr) ;
44  for (int i=0 ; i<ndim ; i++) cart_surr[i] = (so.cart_surr[i] ? new Val_domain {*so.cart_surr[i]} : nullptr) ;
45 }
46 
47 
48 Domain::Domain (int num, FILE* fd) :
49  num_dom(num), ndim{}, nbr_points(fd), nbr_coefs(fd), type_base{}, coloc{}, absol{}, cart{}, radius{nullptr},
50  cart_surr{}
51 {
52  fread_be (&ndim, sizeof(int), 1, fd) ;
53  fread_be (&type_base, sizeof(int), 1, fd) ;
54  assert (ndim==nbr_points.get_ndim()) ;
55  assert (ndim==nbr_coefs.get_ndim()) ;
56  coloc.resize(ndim) ;
57  for (auto & x : coloc) x = nullptr;
58  absol.resize(ndim) ;
59  for (auto & x : absol) x = nullptr ;
60  cart.resize(ndim) ;
61  for (auto & x : cart) x = nullptr ;
62  cart_surr.resize(ndim) ;
63  for (auto & x : cart_surr) x = nullptr ;
64 }
65 
66 
67 
68 void Domain::save (FILE* fd) const {
69  nbr_points.save(fd) ;
70  nbr_coefs.save(fd) ;
71  fwrite_be (&ndim, sizeof(int), 1, fd) ;
72  fwrite_be (&type_base, sizeof(int), 1, fd) ;
73 }
74 
75 
76 // destructor of the derived quantities
78  for (int l=0 ; l<ndim ; l++) {
79  safe_delete(coloc[l]);
80  safe_delete(absol[l]);
81  safe_delete(cart[l]);
82  safe_delete(cart_surr[l]);
83  }
84  safe_delete(radius);
85 }
86 
87 Val_domain Domain::laplacian (const Val_domain& so, int m) const {
88 
89  if (m!=0) {
90  cerr << "In the general case, Laplacian must be called with m=0" << endl ;
91  abort() ;
92  }
93 
94  Val_domain res (so.der_abs(1).der_abs(1)) ;
95  for (int j=2 ; j<=get_ndim() ; j++)
96  res += so.der_abs(j).der_abs(j) ;
97  return res ;
98 }
99 
101  cerr << "laplacian2 not implemented for" << endl ;
102  cerr << *this << endl ;
103  abort() ;
104 
105 }
106 
107 Term_eq Domain::import (int numdom, int bound, int n_ope, Term_eq** parts) const {
108 
109  // get indices of domains :
110  Array<int> zedoms(n_ope) ;
111  for (int i=0 ; i<n_ope ; i++)
112  zedoms.set(i) = parts[i]->get_dom() ;
113 
114  // Get val part :
115  Tensor** parts_val = new Tensor* [n_ope] ;
116  for (int i=0 ; i<n_ope ; i++)
117  parts_val[i] = parts[i]->val_t ;
118 
119  Tensor res_val (import(numdom, bound, n_ope, zedoms, parts_val)) ;
120  delete [] parts_val ;
121 
122  // Do the derivative parts ?
123  bool doder = true ;
124  for (int i=0 ; i<n_ope ; i++)
125  if (parts[i]->der_t==nullptr)
126  doder = false ;
127 
128  if (doder) {
129  Tensor** parts_der = new Tensor* [n_ope] ;
130  for (int i=0 ; i<n_ope ; i++)
131  parts_der[i] = parts[i]->der_t ;
132  Tensor res_der (import(numdom, bound, n_ope, zedoms, parts_der)) ;
133  delete [] parts_der ;
134  return Term_eq (numdom, res_val, res_der) ;
135  }
136  else
137  return Term_eq (numdom, res_val) ;
138 }
139 
140 // Term eq version of operators
141 Term_eq Domain::der_normal_term_eq (const Term_eq& so, int bound) const {
142  return do_comp_by_comp_with_int (so, bound, &Domain::der_normal) ;
143 }
144 
145 Term_eq Domain::dr_term_eq (const Term_eq& so) const {
146  return do_comp_by_comp (so, &Domain::der_r) ;
147 }
148 
150  return do_comp_by_comp (so, &Domain::dtime) ;
151 }
152 
154  return do_comp_by_comp (so, &Domain::ddtime) ;
155 }
156 
157 Term_eq Domain::lap_term_eq (const Term_eq& so, int mm) const {
158  return do_comp_by_comp_with_int (so, mm, &Domain::laplacian) ;
159 }
160 
161 Term_eq Domain::lap2_term_eq (const Term_eq& so, int mm) const {
162  return do_comp_by_comp_with_int (so, mm, &Domain::laplacian2) ;
163 }
164 
166  return do_comp_by_comp (so, &Domain::mult_r) ;
167 }
168 
170  return do_comp_by_comp (so, &Domain::div_r) ;
171 }
172 
174 
175  Term_eq res (partial_cart(so)) ;
176  if (so.val_t->is_m_quant_affected()) {
178  }
179 
180  if (so.der_t!=nullptr) {
181  if (so.der_t->is_m_quant_affected()) {
183  }
184  }
185  return res ;
186 }
187 Term_eq Domain::integ_term_eq (const Term_eq& so, int bound) const {
188 
189  // Check it is a tensor
190  if (so.type_data != TERM_T) {
191  cerr << "integ_term_eq only defined with respect for a tensor" << endl ;
192  abort() ;
193  }
194 
195  if (so.val_t->get_n_comp() != 1) {
196  cerr << "integ_term_eq only defined with respect to a scalar" << endl ;
197  abort() ;
198  }
199 
200  assert (so.dom==num_dom) ;
201 
202 
203  // The value
204  Array<int> ind (so.val_t->indices(0)) ;
205  Val_domain value ((*so.val_t)(ind)(so.dom)) ;
206  double resval ;
207  if (value.check_if_zero())
208  resval= 0. ;
209  else
210  resval = integ(value, bound) ;
211 
212  if (so.der_t!=nullptr) {
213  Val_domain value_der ((*so.der_t)(ind)(so.dom)) ;
214  double resder ;
215  if (value_der.check_if_zero())
216  resder = 0. ;
217  else
218  resder = integ(value_der, bound) ;
219  Term_eq res (so.dom, resval, resder) ;
220  return res ;
221  }
222  else {
223  Term_eq res (so.dom, resval) ;
224  return res ;
225  }
226 }
227 
228 Term_eq Domain::do_comp_by_comp_with_int (const Term_eq& target, int val, Val_domain (Domain::*pfunc) (const Val_domain&, int) const ) const {
229 
230  // The value
231  Tensor resval (*target.val_t, false) ;
232 
233  for (int i=0 ; i<target.val_t->get_n_comp() ; i++) {
234  Array<int> ind (target.val_t->indices(i)) ;
235  Val_domain value ((*target.val_t)(ind)(num_dom)) ;
236  if (value.check_if_zero())
237  resval.set(ind).set_domain(num_dom).set_zero() ;
238  else {
239  Val_domain auxi ((this->*pfunc)(value, val)) ;
240  resval.set(ind).set_domain(num_dom) = auxi ;
241  }
242  if (target.get_val_t().get_parameters())
243  resval.set_parameters() = target.get_val_t().get_parameters() ;
244 
245  // affecte parameters
246  if (target.get_val_t().is_name_affected()) {
247  resval.set_name_affected() ;
248  for (int cmp=0 ; cmp<resval.get_valence() ; cmp++)
249  resval.name_indice[cmp] = target.get_val_t().name_indice[cmp] ;
250  }
251  }
252 
253  if (target.der_t!=nullptr) {
254  Tensor resder (*target.der_t, false) ;
255  for (int i=0 ; i<target.der_t->get_n_comp() ; i++) {
256  Array<int> ind (target.der_t->indices(i)) ;
257  Val_domain value ((*target.der_t)(ind)(num_dom)) ;
258  if (value.check_if_zero())
259  resder.set(ind).set_domain(num_dom).set_zero() ;
260  else {
261  Val_domain auxi ((this->*pfunc)(value, val)) ;
262  resder.set(ind).set_domain(num_dom) = auxi ;
263  }
264  }
265  if (target.get_der_t().get_parameters())
266  resder.set_parameters() = target.get_der_t().get_parameters() ;
267  // affecte parameters
268  if (target.get_der_t().is_name_affected()) {
269  resder.set_name_affected() ;
270  for (int cmp=0 ; cmp<resder.get_valence() ; cmp++)
271  resder.name_indice[cmp] = target.get_der_t().name_indice[cmp] ;
272  }
273 
274  Term_eq res (num_dom, resval, resder) ;
275  return res ;
276  }
277  else {
278  Term_eq res (num_dom, resval) ;
279  return res ;
280  }
281 }
282 
283 Term_eq Domain::do_comp_by_comp (const Term_eq& target, Val_domain (Domain::*pfunc) (const Val_domain&) const ) const {
284 
285  // The value
286  Tensor resval (*target.val_t, false) ;
287 
288  for (int i=0 ; i<target.val_t->get_n_comp() ; i++) {
289  Array<int> ind (target.val_t->indices(i)) ;
290  Val_domain value ((*target.val_t)(ind)(num_dom)) ;
291  if (value.check_if_zero())
292  resval.set(ind).set_domain(num_dom).set_zero() ;
293  else {
294  Val_domain auxi ((this->*pfunc)(value)) ;
295  resval.set(ind).set_domain(num_dom) = auxi ;
296  }
297  if (target.get_val_t().get_parameters())
298  resval.set_parameters() = target.get_val_t().get_parameters() ;
299 
300  // affecte parameters
301  if (target.get_val_t().is_name_affected()) {
302  resval.set_name_affected() ;
303  for (int cmp=0 ; cmp<resval.get_valence() ; cmp++)
304  resval.name_indice[cmp] = target.get_val_t().name_indice[cmp] ;
305  }
306  }
307 
308  if (target.der_t!=nullptr) {
309  Tensor resder (*target.der_t, false) ;
310  for (int i=0 ; i<target.der_t->get_n_comp() ; i++) {
311  Array<int> ind (target.der_t->indices(i)) ;
312  Val_domain value ((*target.der_t)(ind)(num_dom)) ;
313  if (value.check_if_zero())
314  resder.set(ind).set_domain(num_dom).set_zero() ;
315  else {
316  Val_domain auxi ((this->*pfunc)(value)) ;
317  resder.set(ind).set_domain(num_dom) = auxi ;
318  }
319  }
320  if (target.get_der_t().get_parameters())
321  resder.set_parameters() = target.get_der_t().get_parameters() ;
322 
323  // affecte parameters
324  if (target.get_der_t().is_name_affected()) {
325  resder.set_name_affected() ;
326  for (int cmp=0 ; cmp<resder.get_valence() ; cmp++)
327  resder.name_indice[cmp] = target.get_der_t().name_indice[cmp] ;
328  }
329  Term_eq res (num_dom, resval, resder) ;
330  return res ;
331  }
332  else {
333  Term_eq res (num_dom, resval) ;
334  return res ;
335  }
336 }
337 
339  int dom = so.get_dom() ;
340  int val_res = so.val_t->get_valence() + 1 ;
341  Array<int> type_ind (val_res) ;
342  type_ind.set(0) = COV ;
343  for (int i=1 ; i<val_res ; i++)
344  type_ind.set(i) = so.val_t->get_index_type(i-1) ;
345 
346  Base_tensor basis (so.get_val_t().get_space()) ;
347  basis.set_basis(dom) = CARTESIAN_BASIS ;
348 
349  // Tensor for val
350  Tensor auxi_val (so.get_val_t().get_space(), val_res, type_ind, basis) ;
351 
352  //Loop on the components :
353  Index pos_auxi(auxi_val) ;
354  Index pos_so (*so.val_t) ;
355  do {
356  for (int i=0 ; i<val_res-1 ; i++)
357  pos_so.set(i) = pos_auxi(i+1) ;
358  auxi_val.set(pos_auxi).set_domain(dom) = (*so.val_t)(pos_so)(dom).der_abs(pos_auxi(0)+1) ;
359  }
360  while (pos_auxi.inc()) ;
361 
362  if (so.der_t==nullptr) {
363  return Term_eq (dom, auxi_val) ;
364  }
365  else {
366  // Need to compute the derivative :
367  // Tensor for der
368  Tensor auxi_der (so.get_val_t().get_space(), val_res, type_ind, basis) ;
369 
370  //Loop on the components :
371  Index pos_auxi_der(auxi_der) ;
372  do {
373  for (int i=0 ; i<val_res-1 ; i++)
374  pos_so.set(i) = pos_auxi_der(i+1) ;
375  auxi_der.set(pos_auxi_der).set_domain(dom) = (*so.der_t)(pos_so)(dom).der_abs(pos_auxi_der(0)+1) ;
376  }
377  while (pos_auxi_der.inc()) ;
378 
379  return Term_eq (dom, auxi_val, auxi_der) ;
380  }
381 }
382 
384 
385 
386 
387  int dom = so.get_dom() ;
388  int val_res = so.val_t->get_valence() + 1 ;
389  Array<int> type_ind (val_res) ;
390  type_ind.set(0) = COV ;
391  for (int i=1 ; i<val_res ; i++)
392  type_ind.set(i) = so.val_t->get_index_type(i-1) ;
393 
394  Base_tensor basis (so.get_val_t().get_space()) ;
395  basis.set_basis(dom) = SPHERICAL_BASIS ;
396 
397  // Tensor for val
398  Tensor auxi_val (so.get_val_t().get_space(), val_res, type_ind, basis) ;
399 
400  //Loop on the components :
401  Index pos_auxi(auxi_val) ;
402  Index pos_so (*so.val_t) ;
403  do {
404  for (int i=0 ; i<val_res-1 ; i++)
405  pos_so.set(i) = pos_auxi(i+1) ;
406  switch (pos_auxi(0)) {
407  case 0 :
408  // d/dr :
409  auxi_val.set(pos_auxi).set_domain(dom) = (*so.val_t)(pos_so)(dom).der_r() ;
410  break ;
411  case 1 :
412  // 1/r dtheta
413  auxi_val.set(pos_auxi).set_domain(dom) = (*so.val_t)(pos_so)(dom).der_var(2).div_r() ;
414  break ;
415  case 2 :
416  // 1/r sint d/dphi
417  auxi_val.set(pos_auxi).set_domain(dom) = (*so.val_t)(pos_so)(dom).der_var(3).div_r().div_sin_theta() ;
418  break ;
419  default :
420  cerr << "Bad indice in Domain::derive_partial_spher" << endl ;
421  abort() ;
422  }
423  }
424  while (pos_auxi.inc()) ;
425 
426  if (so.der_t==nullptr) {
427  return Term_eq (dom, auxi_val) ;
428  }
429  else {
430  // Need to compute the derivative :
431  // Tensor for der
432  Tensor auxi_der (so.get_val_t().get_space(), val_res, type_ind, basis) ;
433 
434  //Loop on the components :
435  Index pos_auxi_der(auxi_der) ;
436  do {
437  for (int i=0 ; i<val_res-1 ; i++)
438  pos_so.set(i) = pos_auxi_der(i+1) ;
439  switch (pos_auxi_der(0)) {
440  case 0 :
441  // d/dr :
442  auxi_der.set(pos_auxi_der).set_domain(dom) = (*so.der_t)(pos_so)(dom).der_r() ;
443  break ;
444  case 1 :
445  // 1/r dtheta
446  auxi_der.set(pos_auxi_der).set_domain(dom) = (*so.der_t)(pos_so)(dom).der_var(2).div_r() ;
447  break ;
448  case 2 :
449  // 1/r sint d/dphi
450  auxi_der.set(pos_auxi_der).set_domain(dom) = (*so.der_t)(pos_so)(dom).der_var(3).div_r().div_sin_theta() ;
451  break ;
452  default :
453  cerr << "Bad indice in Domain::derive_partial_spher" << endl ;
454  abort() ;
455  }
456  }
457  while (pos_auxi_der.inc()) ;
458 
459  return Term_eq (dom, auxi_val, auxi_der) ;
460  }
461 }
462 
464 
465 
466 
467  int dom = so.get_dom() ;
468  int val_res = so.val_t->get_valence() + 1 ;
469  Array<int> type_ind (val_res) ;
470  type_ind.set(0) = COV ;
471  for (int i=1 ; i<val_res ; i++)
472  type_ind.set(i) = so.val_t->get_index_type(i-1) ;
473 
474  Base_tensor basis (so.get_val_t().get_space()) ;
475  basis.set_basis(dom) = MTZ_BASIS ;
476 
477  // Tensor for val
478  Tensor auxi_val (so.get_val_t().get_space(), val_res, type_ind, basis) ;
479 
480  //Loop on the components :
481  Index pos_auxi(auxi_val) ;
482  Index pos_so (*so.val_t) ;
483  do {
484  for (int i=0 ; i<val_res-1 ; i++)
485  pos_so.set(i) = pos_auxi(i+1) ;
486  switch (pos_auxi(0)) {
487  case 0 :
488  // d/dr :
489  auxi_val.set(pos_auxi).set_domain(dom) = (*so.val_t)(pos_so)(dom).der_r() ;
490  break ;
491  case 1 :
492  // cost/r dtheta
493  auxi_val.set(pos_auxi).set_domain(dom) = (*so.val_t)(pos_so)(dom).der_var(2).div_r().mult_cos_theta() ;
494  break ;
495  case 2 :
496  // cost/r sint d/dphi
497  auxi_val.set(pos_auxi).set_domain(dom) = (*so.val_t)(pos_so)(dom).der_var(3).div_r().div_sin_theta().mult_cos_theta() ;
498  break ;
499  default :
500  cerr << "Bad indice in Domain::derive_partial_mtz" << endl ;
501  abort() ;
502  }
503  }
504  while (pos_auxi.inc()) ;
505 
506  if (so.der_t==nullptr) {
507  return Term_eq (dom, auxi_val) ;
508  }
509  else {
510  // Need to compute the derivative :
511  // Tensor for der
512  Tensor auxi_der (so.get_val_t().get_space(), val_res, type_ind, basis) ;
513 
514  //Loop on the components :
515  Index pos_auxi_der(auxi_der) ;
516  do {
517  for (int i=0 ; i<val_res-1 ; i++)
518  pos_so.set(i) = pos_auxi_der(i+1) ;
519  switch (pos_auxi_der(0)) {
520  case 0 :
521  // d/dr :
522  auxi_der.set(pos_auxi_der).set_domain(dom) = (*so.der_t)(pos_so)(dom).der_r() ;
523  break ;
524  case 1 :
525  // 1/r dtheta
526  auxi_der.set(pos_auxi_der).set_domain(dom) = (*so.der_t)(pos_so)(dom).der_var(2).div_r().mult_cos_theta() ;
527  break ;
528  case 2 :
529  // 1/r sint d/dphi
530  auxi_der.set(pos_auxi_der).set_domain(dom) = (*so.der_t)(pos_so)(dom).der_var(3).div_r().div_sin_theta().mult_cos_theta() ;
531  break ;
532  default :
533  cerr << "Bad indice in Domain::derive_partial_mtz" << endl ;
534  abort() ;
535  }
536  }
537  while (pos_auxi_der.inc()) ;
538 
539  return Term_eq (dom, auxi_val, auxi_der) ;
540  }
541 }
542 
543 
545 
546  int dom = so.get_dom() ;
547  assert (dom == num_dom) ;
548 
549  int valence = so.val_t->get_valence() ;
550  int val_res = so.val_t->get_valence() + 1 ;
551 
552  Array<int> type_ind (val_res) ;
553  type_ind.set(0) = COV ;
554  for (int i=1 ; i<val_res ; i++)
555  type_ind.set(i) = so.val_t->get_index_type(i-1) ;
556 
557  Base_tensor basis (so.get_val_t().get_space()) ;
558  basis.set_basis(dom) = SPHERICAL_BASIS ;
559 
560  Tensor auxi_val (so.get_val_t().get_space(), val_res, type_ind, basis, 3) ;
561  for (int cmp=0 ; cmp<auxi_val.get_n_comp() ; cmp ++)
562  auxi_val.set(auxi_val.indices(cmp)) = 0 ;
563 
564  for (int ind_sum=0 ; ind_sum<valence ; ind_sum++) {
565 
566  //Loop on the components :
567  Index pos_auxi(auxi_val) ;
568  Index pos_so (*so.val_t) ;
569 
570  do {
571  for (int i=0 ; i<valence ; i++)
572  pos_so.set(i) = pos_auxi(i+1) ;
573  // Different cases of the derivative index :
574  switch (pos_auxi(0)) {
575  case 0 :
576  // Dr nothing
577  break ;
578  case 1 :
579  // Dtheta
580  // Different cases of the source index
581  switch (pos_auxi(ind_sum+1)) {
582  case 0 :
583  //Dtheta S_r
584  pos_so.set(ind_sum) = 1 ;
585  auxi_val.set(pos_auxi).set_domain(dom) -= (*so.val_t)(pos_so)(dom).div_r() ;
586  break ;
587  case 1 :
588  // Dtheta S_theta
589  pos_so.set(ind_sum) = 0 ;
590  auxi_val.set(pos_auxi).set_domain(dom) += (*so.val_t)(pos_so)(dom).div_r() ;
591  break ;
592  case 2 :
593  //Dtheta S_phi
594  break ;
595  default :
596  cerr << "Bad indice in Domain::connection_spher" << endl ;
597  abort() ;
598  }
599  break ;
600  case 2 :
601  // Dphi
602  // Different cases of the source index
603  switch (pos_auxi(ind_sum+1)) {
604  case 0 :
605  //Dphi S_r
606  pos_so.set(ind_sum) = 2 ;
607  auxi_val.set(pos_auxi).set_domain(dom) -= (*so.val_t)(pos_so)(dom).div_r() ;
608  break ;
609  case 1 :
610  // Dphi S_theta
611  pos_so.set(ind_sum) = 2 ;
612  auxi_val.set(pos_auxi).set_domain(dom) -= (*so.val_t)(pos_so)(dom).div_r().mult_cos_theta().div_sin_theta() ;
613  break ;
614  case 2 :
615  //Dphi S_phi
616  pos_so.set(ind_sum) = 0 ;
617  auxi_val.set(pos_auxi).set_domain(dom) += (*so.val_t)(pos_so)(dom).div_r() ;
618  pos_so.set(ind_sum) = 1 ;
619  auxi_val.set(pos_auxi).set_domain(dom) += (*so.val_t)(pos_so)(dom).div_r().mult_cos_theta().div_sin_theta() ;
620  break ;
621  default :
622  cerr << "Bad indice in Domain::connection_spher" << endl ;
623  abort() ;
624  }
625  break ;
626  default :
627  cerr << "Bad indice in Domain::connection_spher" << endl ;
628  abort() ;
629  }
630  }
631  while (pos_auxi.inc()) ;
632  }
633 
634 
635  if (so.der_t==nullptr) {
636  // No need for derivative :
637  return Term_eq (dom, auxi_val) ;
638  }
639  else {
640 
641  // Need to compute the derivative :
642  // Tensor for der
643  Tensor auxi_der (so.get_val_t().get_space(), val_res, type_ind, basis, 3) ;
644  for (int cmp=0 ; cmp<auxi_der.get_n_comp() ; cmp ++)
645  auxi_der.set(auxi_der.indices(cmp)) = 0 ;
646 
647  // Loop indice summation on connection symbols
648  for (int ind_sum=0 ; ind_sum<valence ; ind_sum++) {
649 
650  //Loop on the components :
651  Index pos_auxi_der(auxi_der) ;
652  Index pos_so (*so.der_t) ;
653 
654  do {
655  for (int i=0 ; i<valence ; i++)
656  pos_so.set(i) = pos_auxi_der(i+1) ;
657  // Different cases of the derivative index :
658  switch (pos_auxi_der(0)) {
659  case 0 :
660  // Dr nothing
661  break ;
662  case 1 :
663  // Dtheta
664  // Different cases of the source index
665  switch (pos_auxi_der(ind_sum+1)) {
666  case 0 :
667  //Dtheta S_r
668  pos_so.set(ind_sum) = 1 ;
669  auxi_der.set(pos_auxi_der).set_domain(dom) -= (*so.der_t)(pos_so)(dom).div_r() ;
670  break ;
671  case 1 :
672  // Dtheta S_theta
673  pos_so.set(ind_sum) = 0 ;
674  auxi_der.set(pos_auxi_der).set_domain(dom) += (*so.der_t)(pos_so)(dom).div_r() ;
675  break ;
676  case 2 :
677  //Dtheta S_phi
678  break ;
679  default :
680  cerr << "Bad indice in Domain::connection_spher" << endl ;
681  abort() ;
682  }
683  break ;
684  case 2 :
685  // Dphi
686  // Different cases of the source index
687  switch (pos_auxi_der(ind_sum+1)) {
688  case 0 :
689  //Dphi S_r
690  pos_so.set(ind_sum) = 2 ;
691  auxi_der.set(pos_auxi_der).set_domain(dom) -= (*so.der_t)(pos_so)(dom).div_r() ;
692  break ;
693  case 1 :
694  // Dphi S_theta
695  pos_so.set(ind_sum) = 2 ;
696  auxi_der.set(pos_auxi_der).set_domain(dom) -= (*so.der_t)(pos_so)(dom).div_r().mult_cos_theta().div_sin_theta() ;
697  break ;
698  case 2 :
699  //Dphi S_phi
700  pos_so.set(ind_sum) = 0 ;
701  auxi_der.set(pos_auxi_der).set_domain(dom) += (*so.der_t)(pos_so)(dom).div_r() ;
702  pos_so.set(ind_sum) = 1 ;
703  auxi_der.set(pos_auxi_der).set_domain(dom) += (*so.der_t)(pos_so)(dom).div_r().mult_cos_theta().div_sin_theta() ;
704  break ;
705  default :
706  cerr << "Bad indice in Domain::connection_spher" << endl ;
707  abort() ;
708  }
709  break ;
710  default :
711  cerr << "Bad indice in Domain::connection_spher" << endl ;
712  abort() ;
713  }
714  }
715  while (pos_auxi_der.inc()) ;
716  }
717 
718  return Term_eq (dom, auxi_val, auxi_der) ;
719  }
720 }
721 
723 
724  int dom = so.get_dom() ;
725  assert (dom == num_dom) ;
726 
727  int valence = so.val_t->get_valence() ;
728  int val_res = so.val_t->get_valence() + 1 ;
729 
730  Array<int> type_ind (val_res) ;
731  type_ind.set(0) = COV ;
732  for (int i=1 ; i<val_res ; i++)
733  type_ind.set(i) = so.val_t->get_index_type(i-1) ;
734 
735  Base_tensor basis (so.get_val_t().get_space()) ;
736  basis.set_basis(dom) = MTZ_BASIS ;
737 
738  Tensor auxi_val (so.get_val_t().get_space(), val_res, type_ind, basis, 3) ;
739  for (int cmp=0 ; cmp<auxi_val.get_n_comp() ; cmp ++)
740  auxi_val.set(auxi_val.indices(cmp)) = 0 ;
741 
742  for (int ind_sum=0 ; ind_sum<valence ; ind_sum++) {
743 
744  //Loop on the components :
745  Index pos_auxi(auxi_val) ;
746  Index pos_so (*so.val_t) ;
747 
748  do {
749  for (int i=0 ; i<valence ; i++)
750  pos_so.set(i) = pos_auxi(i+1) ;
751  // Different cases of the derivative index :
752  switch (pos_auxi(0)) {
753  case 0 :
754  // Dr nothing
755  break ;
756  case 1 :
757  // Dtheta
758  // Different cases of the source index
759  switch (pos_auxi(ind_sum+1)) {
760  case 0 :
761  //Dtheta S_r
762  pos_so.set(ind_sum) = 1 ;
763  auxi_val.set(pos_auxi).set_domain(dom) -= (*so.val_t)(pos_so)(dom).div_r() ;
764  break ;
765  case 1 :
766  // Dtheta S_theta
767  pos_so.set(ind_sum) = 0 ;
768  auxi_val.set(pos_auxi).set_domain(dom) += (*so.val_t)(pos_so)(dom).div_r() ;
769  break ;
770  case 2 :
771  //Dtheta S_phi
772  break ;
773  default :
774  cerr << "Bad indice in Domain::connection_mtz" << endl ;
775  abort() ;
776  }
777  break ;
778  case 2 :
779  // Dphi
780  // Different cases of the source index
781  switch (pos_auxi(ind_sum+1)) {
782  case 0 :
783  //Dphi S_r
784  pos_so.set(ind_sum) = 2 ;
785  auxi_val.set(pos_auxi).set_domain(dom) -= (*so.val_t)(pos_so)(dom).div_r() ;
786  break ;
787  case 1 :
788  // Dphi S_theta
789  pos_so.set(ind_sum) = 2 ;
790  auxi_val.set(pos_auxi).set_domain(dom) -= (*so.val_t)(pos_so)(dom).div_r().div_sin_theta() ;
791  break ;
792  case 2 :
793  //Dphi S_phi
794  pos_so.set(ind_sum) = 0 ;
795  auxi_val.set(pos_auxi).set_domain(dom) += (*so.val_t)(pos_so)(dom).div_r() ;
796  pos_so.set(ind_sum) = 1 ;
797  auxi_val.set(pos_auxi).set_domain(dom) += (*so.val_t)(pos_so)(dom).div_r().div_sin_theta() ;
798  break ;
799  default :
800  cerr << "Bad indice in Domain::connection_mtz" << endl ;
801  abort() ;
802  }
803  break ;
804  default :
805  cerr << "Bad indice in Domain::connection_mtz" << endl ;
806  abort() ;
807  }
808  }
809  while (pos_auxi.inc()) ;
810  }
811 
812 
813  if (so.der_t==nullptr) {
814  // No need for derivative :
815  return Term_eq (dom, auxi_val) ;
816  }
817  else {
818 
819  // Need to compute the derivative :
820  // Tensor for der
821  Tensor auxi_der (so.get_val_t().get_space(), val_res, type_ind, basis, 3) ;
822  for (int cmp=0 ; cmp<auxi_der.get_n_comp() ; cmp ++)
823  auxi_der.set(auxi_der.indices(cmp)) = 0 ;
824 
825  // Loop indice summation on connection symbols
826  for (int ind_sum=0 ; ind_sum<valence ; ind_sum++) {
827 
828  //Loop on the components :
829  Index pos_auxi_der(auxi_der) ;
830  Index pos_so (*so.der_t) ;
831 
832  do {
833  for (int i=0 ; i<valence ; i++)
834  pos_so.set(i) = pos_auxi_der(i+1) ;
835  // Different cases of the derivative index :
836  switch (pos_auxi_der(0)) {
837  case 0 :
838  // Dr nothing
839  break ;
840  case 1 :
841  // Dtheta
842  // Different cases of the source index
843  switch (pos_auxi_der(ind_sum+1)) {
844  case 0 :
845  //Dtheta S_r
846  pos_so.set(ind_sum) = 1 ;
847  auxi_der.set(pos_auxi_der).set_domain(dom) -= (*so.der_t)(pos_so)(dom).div_r() ;
848  break ;
849  case 1 :
850  // Dtheta S_theta
851  pos_so.set(ind_sum) = 0 ;
852  auxi_der.set(pos_auxi_der).set_domain(dom) += (*so.der_t)(pos_so)(dom).div_r() ;
853  break ;
854  case 2 :
855  //Dtheta S_phi
856  break ;
857  default :
858  cerr << "Bad indice in Domain::connection_mtz" << endl ;
859  abort() ;
860  }
861  break ;
862  case 2 :
863  // Dphi
864  // Different cases of the source index
865  switch (pos_auxi_der(ind_sum+1)) {
866  case 0 :
867  //Dphi S_r
868  pos_so.set(ind_sum) = 2 ;
869  auxi_der.set(pos_auxi_der).set_domain(dom) -= (*so.der_t)(pos_so)(dom).div_r() ;
870  break ;
871  case 1 :
872  // Dphi S_theta
873  pos_so.set(ind_sum) = 2 ;
874  auxi_der.set(pos_auxi_der).set_domain(dom) -= (*so.der_t)(pos_so)(dom).div_r().div_sin_theta() ;
875  break ;
876  case 2 :
877  //Dphi S_phi
878  pos_so.set(ind_sum) = 0 ;
879  auxi_der.set(pos_auxi_der).set_domain(dom) += (*so.der_t)(pos_so)(dom).div_r() ;
880  pos_so.set(ind_sum) = 1 ;
881  auxi_der.set(pos_auxi_der).set_domain(dom) += (*so.der_t)(pos_so)(dom).div_r().div_sin_theta() ;
882  break ;
883  default :
884  cerr << "Bad indice in Domain::connection_mtz" << endl ;
885  abort() ;
886  }
887  break ;
888  default :
889  cerr << "Bad indice in Domain::connection_mtz" << endl ;
890  abort() ;
891  }
892  }
893  while (pos_auxi_der.inc()) ;
894  }
895 
896  return Term_eq (dom, auxi_val, auxi_der) ;
897  }
898 }
899 
900 
902 
903  int dom = target.get_dom() ;
904 
905  // Check it is a tensor
906  if (target.type_data != TERM_T) {
907  cerr << "Ope_int_volume only defined with respect for a tensor" << endl ;
908  abort() ;
909  }
910 
911  if (target.val_t->get_n_comp() != 1) {
912  cerr << "Ope_int_volume only defined with respect to a scalar" << endl ;
913  abort() ;
914  }
915 
916  // The value
917  Array<int> ind (target.val_t->indices(0)) ;
918  Val_domain value ((*target.val_t)(ind)(dom)) ;
919  double resval ;
920  if (value.check_if_zero())
921  resval= 0. ;
922  else
923  resval = value.get_domain()->integ_volume(value) ;
924 
925  if (target.der_t!=nullptr) {
926  Val_domain value_der ((*target.der_t)(ind)(dom)) ;
927  double resder ;
928  if (value_der.check_if_zero())
929  resder = 0. ;
930  else
931  resder = value_der.get_domain()->integ_volume(value_der) ;
932  Term_eq res (dom, resval, resder) ;
933  return res ;
934  }
935  else {
936  Term_eq res (dom, resval) ;
937  return res ;
938  }
939 }
940 
941 // List of all the functions that must be implemented for the concerned types of domain
942 bool Domain::is_in(const Point&, double) const {
943  cerr << "is_in not implemented for" << endl ;
944  cerr << *this << endl ;
945  abort() ;
946 }
947 
948 const Point Domain::absol_to_num(const Point&) const {
949  cerr << "Absol_to_num not implemented for" << endl ;
950  cerr << *this << endl ;
951  abort() ;
952 }
953 
954 const Point Domain::absol_to_num_bound(const Point&, int) const {
955  cerr << "Absol_to_num_bound not implemented for" << endl ;
956  cerr << *this << endl ;
957  abort() ;
958 }
959 
960 void Domain::do_der_abs_from_der_var(const Val_domain *const *const der_var, Val_domain **const der_abs) const {
961  cerr << "do_der_abs_from_der_var not implemented for" << endl ;
962  cerr << *this << endl ;
963  abort() ;
964 }
965 
967  cerr << "mult not implemented for" << endl ;
968  cerr << *this << endl ;
969  abort() ;
970 }
971 
973  cerr << "do_coloc not implemented for" << endl ;
974  cerr << *this << endl ;
975  abort() ;
976 }
977 
979  cerr << "Symetric Chebyshev spectral base not implemented for" << endl ;
980  cerr << *this << endl ;
981  abort() ;
982 }
984  cerr << "Symetric Legendre spectral base not implemented for" << endl ;
985  cerr << *this << endl ;
986  abort() ;
987 }
988 
990  cerr << "Chebyshev spectral base for r not implemented for" << endl ;
991  cerr << *this << endl ;
992  abort() ;
993 }
994 
996  cerr << "Legendre spectral base for r not implemented for" << endl ;
997  cerr << *this << endl ;
998  abort() ;
999 }
1000 
1002  cerr << "Anti symetric Chebyshev spectral base not implemented for" << endl ;
1003  cerr << *this << endl ;
1004  abort() ;
1005 }
1006 
1008  cerr << "Anti symetric Legendre spectral base not implemented for" << endl ;
1009  cerr << *this << endl ;
1010  abort() ;
1011 }
1013  cerr << "Symetric Chebyshev spectral base not implemented for" << endl ;
1014  cerr << *this << endl ;
1015  abort() ;
1016 }
1017 
1019  cerr << "Symetric Legendre spectral base not implemented for" << endl ;
1020  cerr << *this << endl ;
1021  abort() ;
1022 }
1023 
1025  cerr << "Anti symetric Chebyshev spectral base not implemented for" << endl ;
1026  cerr << *this << endl ;
1027  abort() ;
1028 }
1029 
1031  cerr << "Anti symetric Legendre spectral base not implemented for" << endl ;
1032  cerr << *this << endl ;
1033  abort() ;
1034 }
1035 
1037  cerr << "Chebyshev with xodd spectral base not implemented for" << endl ;
1038  cerr << *this << endl ;
1039  abort() ;
1040 }
1041 
1043  cerr << "Legendre with xodd spectral base not implemented for" << endl ;
1044  cerr << *this << endl ;
1045  abort() ;
1046 }
1047 
1049  cerr << "Chebyshev with todd spectral base not implemented for" << endl ;
1050  cerr << *this << endl ;
1051  abort() ;
1052 }
1053 
1055  cerr << "Legendre with todd spectral base not implemented for" << endl ;
1056  cerr << *this << endl ;
1057  abort() ;
1058 }
1059 
1061  cerr << "Chebyshev with X and T odd spectral base not implemented for" << endl ;
1062  cerr << *this << endl ;
1063  abort() ;
1064 }
1065 
1067  cerr << "Odd Legendre with X and T odd spectral base not implemented for" << endl ;
1068  cerr << *this << endl ;
1069  abort() ;
1070 }
1071 
1073  cerr << "Cheb base r not implemented for " << endl ;
1074  cerr << *this << endl ;
1075  abort() ;
1076 }
1077 
1079  cerr << "Cheb base t not implemented for " << endl ;
1080  cerr << *this << endl ;
1081  abort() ;
1082 }
1083 
1085  cerr << "Cheb base p not implemented for " << endl ;
1086  cerr << *this << endl ;
1087  abort() ;
1088 }
1090  cerr << "Cheb base r MTZ not implemented for " << endl ;
1091  cerr << *this << endl ;
1092  abort() ;
1093 }
1094 
1096  cerr << "Cheb base t MTZ not implemented for " << endl ;
1097  cerr << *this << endl ;
1098  abort() ;
1099 }
1100 
1102  cerr << "Cheb base p MTZ not implemented for " << endl ;
1103  cerr << *this << endl ;
1104  abort() ;
1105 }
1107  cerr << "Cheb base rt not implemented for " << endl ;
1108  cerr << *this << endl ;
1109  abort() ;
1110 }
1111 
1113  cerr << "Cheb base rp not implemented for " << endl ;
1114  cerr << *this << endl ;
1115  abort() ;
1116 }
1117 
1119  cerr << "Cheb base tp not implemented for " << endl ;
1120  cerr << *this << endl ;
1121  abort() ;
1122 }
1124  cerr << "Legendre base r not implemented for " << endl ;
1125  cerr << *this << endl ;
1126  abort() ;
1127 }
1128 
1130  cerr << "Legendre base t not implemented for " << endl ;
1131  cerr << *this << endl ;
1132  abort() ;
1133 }
1134 
1136  cerr << "Legendre base p not implemented for " << endl ;
1137  cerr << *this << endl ;
1138  abort() ;
1139 }
1140 
1142  cerr << "Legendre base r MTZ not implemented for " << endl ;
1143  cerr << *this << endl ;
1144  abort() ;
1145 }
1146 
1148  cerr << "Legendre base t MTZ not implemented for " << endl ;
1149  cerr << *this << endl ;
1150  abort() ;
1151 }
1152 
1154  cerr << "Legendre base p MTZ not implemented for " << endl ;
1155  cerr << *this << endl ;
1156  abort() ;
1157 }
1159  cerr << "Cheb base with odd cosines not implemented for " << endl ;
1160  cerr << *this << endl ;
1161  abort() ;
1162 }
1163 
1165  cerr << "Legendre base with odd cosines not implemented for " << endl ;
1166  cerr << *this << endl ;
1167  abort() ;
1168 }
1170  cerr << "Cheb base xy not implemented for " << endl ;
1171  cerr << *this << endl ;
1172  abort() ;
1173 }
1174 
1175 
1177  cerr << "Cheb base xz not implemented for " << endl ;
1178  cerr << *this << endl ;
1179  abort() ;
1180 }
1181 
1182 
1184  cerr << "Cheb base yz not implemented for " << endl ;
1185  cerr << *this << endl ;
1186  abort() ;
1187 }
1189  // Default version
1190  set_cheb_base(ba) ;
1191 }
1192 
1193 
1195  // Default version
1196  set_cheb_base(ba) ;
1197 }
1198 
1199 
1201  // Default version
1202  set_anti_cheb_base(ba) ;
1203 }
1204 
1205 
1207  // Default version
1208  set_legendre_base(ba) ;
1209 }
1210 
1211 
1213  // Default version
1214  set_legendre_base(ba) ;
1215 }
1216 
1217 
1219  // Default version
1221 }
1222 
1223 
1225  cerr << "Multiplication by cos(theta) not implemented for" << endl ;
1226  cerr << *this << endl ;
1227  abort() ;
1228 }
1229 
1231  cerr << "Multiplication by cos(phi) not implemented for" << endl ;
1232  cerr << *this << endl ;
1233  abort() ;
1234 }
1235 
1237  cerr << "Multiplication by sin(theta) not implemented for" << endl ;
1238  cerr << *this << endl ;
1239  abort() ;
1240 }
1241 
1243  cerr << "Multiplication by sin(phi) not implemented for this type of domain" << endl ;
1244  cerr << *this << endl ;
1245  abort() ;
1246 }
1247 
1249  cerr << "Division by sin(theta) not implemented for" << endl ;
1250  cerr << *this << endl ;
1251  abort() ;
1252 }
1253 
1255  cerr << "Division by cos(theta) not implemented for" << endl ;
1256  cerr << *this << endl ;
1257  abort() ;
1258 }
1259 
1261  cerr << "Division by x not implemented for" << endl ;
1262  cerr << *this << endl ;
1263  abort() ;
1264 }
1265 
1266 void Domain::set_val_inf (Val_domain&, double) const {
1267  cerr << "set_val_inf not defined for" << endl ;
1268  cerr << *this << endl ;
1269  abort() ;
1270 }
1271 
1273  cerr << "Division by (x-1) not implemented for" << endl ;
1274  cerr << *this << endl ;
1275  abort() ;
1276 }
1277 
1279  cerr << "Division by (x+1) not implemented for" << endl ;
1280  cerr << *this << endl ;
1281  abort() ;
1282 }
1283 
1285  cerr << "Division by 1 - r/L not implemented for" << endl ;
1286  cerr << *this << endl ;
1287  abort() ;
1288 }
1289 
1290 
1292  cerr << "Multiplication by 1 - r/L not implemented for" << endl ;
1293  cerr << *this << endl ;
1294  abort() ;
1295 }
1296 
1298  cerr << "Multiplication by (x-1) not implemented for" << endl ;
1299  cerr << *this << endl ;
1300  abort() ;
1301 }
1302 
1304  cerr << "Multiplication by r not implemented for" << endl ;
1305  cerr << *this << endl ;
1306  abort() ;
1307 }
1308 
1310  cerr << "Multiplication by x not implemented for" << endl ;
1311  cerr << *this << endl ;
1312  abort() ;
1313 }
1314 
1316  cerr << "Multiplication by cos(time) not implemented for" << endl ;
1317  cerr << *this << endl ;
1318  abort() ;
1319 }
1320 
1322  cerr << "Multiplication by sin(time) not implemented for" << endl ;
1323  cerr << *this << endl ;
1324  abort() ;
1325 }
1326 
1328  cerr << "Divison by 1-x^2 not implemented for" << endl ;
1329  cerr << *this << endl ;
1330  abort() ;
1331 }
1332 
1334  cerr << "srdr not implemented for" << endl ;
1335  cerr << *this << endl ;
1336  abort() ;
1337 }
1338 
1340  cerr << "Division by r not implemented for" << endl ;
1341  cerr << *this << endl ;
1342  abort() ;
1343 }
1344 
1346  cerr << "Division by sin(chi) not implemented for" << endl ;
1347  cerr << *this << endl ;
1348  abort() ;
1349 }
1350 
1352  cerr << "Division by chi not implemented for" << endl ;
1353  cerr << *this << endl ;
1354  abort() ;
1355 }
1356 
1358  cerr << "change_basis_cart_to_spher not implemented for" << endl ;
1359  cerr << *this << endl ;
1360  abort() ;
1361 }
1362 
1364  cerr << "change_basis_spher_to_cart not implemented for" << endl ;
1365  cerr << *this << endl ;
1366  abort() ;
1367 }
1368 
1369 double Domain::get_rmax() const {
1370  cerr << "No rmax for" << endl ;
1371  cerr << *this << endl ;
1372  abort() ;
1373 }
1374 
1375 double Domain::get_rmin() const {
1376  cerr << "No rmin for" << endl ;
1377  cerr << *this << endl ;
1378  abort() ;
1379 }
1380 
1382  cerr << "No center for" << endl ;
1383  cerr << *this << endl ;
1384  abort() ;
1385 }
1386 
1387 const Val_domain & Domain::get_chi() const {
1388  cerr << "No chi for" << endl ;
1389  cerr << *this << endl ;
1390  abort() ;
1391 }
1392 
1393 const Val_domain & Domain::get_eta() const {
1394  cerr << "No eta for" << endl ;
1395  cerr << *this << endl ;
1396  abort() ;
1397 }
1398 
1399 const Val_domain & Domain::get_X() const {
1400  cerr << "No X for" << endl ;
1401  cerr << *this << endl ;
1402  abort() ;
1403 }
1404 
1405 const Val_domain & Domain::get_T() const {
1406  cerr << "No T for" << endl ;
1407  cerr << *this << endl ;
1408  abort() ;
1409 }
1410 
1411 void Domain::find_other_dom (int, int, int&, int&) const {
1412  cerr << "find_other_dom not implemented for" << endl ;
1413  cerr << *this << endl ;
1414  abort() ;
1415 }
1416 
1418  cerr << "der_normal not implemented for" << endl ;
1419  cerr << *this << endl ;
1420  abort() ;
1421 }
1422 
1424  cerr << "der_partial_var not implemented for" << endl ;
1425  cerr << *this << endl ;
1426  abort() ;
1427 }
1428 
1430  cerr << "der_r not implemented for" << endl ;
1431  cerr << *this << endl ;
1432  abort() ;
1433 }
1434 
1436  cerr << "der_t not implemented for" << endl ;
1437  cerr << *this << endl ;
1438  abort() ;
1439 }
1441  cerr << "der_p not implemented for" << endl ;
1442  cerr << *this << endl ;
1443  abort() ;
1444 }
1445 
1447  cerr << "der_r_rtwo not implemented for" << endl ;
1448  cerr << *this << endl ;
1449  abort() ;
1450 }
1451 
1452 Val_domain Domain::ddr (const Val_domain& so) const {
1453  return so.der_r().der_r() ;
1454 }
1455 
1457  cerr << "ddp not implemented for" << endl ;
1458  cerr << *this << endl ;
1459  abort() ;
1460 }
1461 
1463  cerr << "ddt not implemented for" << endl ;
1464  cerr << *this << endl ;
1465  abort() ;
1466 }
1467 
1469  cerr << "dt not implemented for" << endl ;
1470  cerr << *this << endl ;
1471  abort() ;
1472 }
1473 
1475  cerr << "dtime not implemented for" << endl ;
1476  cerr << *this << endl ;
1477  abort() ;
1478 }
1479 
1481  cerr << "ddtime not implemented for" << endl ;
1482  cerr << *this << endl ;
1483  abort() ;
1484 }
1485 
1486 double Domain::integ (const Val_domain&, int) const {
1487  cerr << "integ not implemented for" << endl ;
1488  cerr << *this << endl ;
1489  abort() ;
1490 }
1491 
1492 double Domain::integrale (const Val_domain&) const {
1493  cerr << "integrale not implemented for" << endl ;
1494  cerr << *this << endl ;
1495  abort() ;
1496 }
1497 
1498 int Domain::nbr_unknowns (const Tensor&, int) const {
1499  cerr << "nbr_unknowns not implemented for" << endl ;
1500  cerr << *this << endl ;
1501  abort() ;
1502 }
1503 
1504 Array<int> Domain::nbr_conditions (const Tensor&, int, int, int, Array<int>**) const {
1505  cerr << "nbr_conditions not implemented for" << endl ;
1506  cerr << *this << endl ;
1507  abort() ;
1508 }
1509 
1511  cerr << "nbr_conditions (with array) not implemented for" << endl ;
1512  cerr << *this << endl ;
1513  abort() ;
1514 }
1515 
1517  cerr << "nbr_conditions_boundary not implemented for" << endl ;
1518  cerr << *this << endl ;
1519  abort() ;
1520 }
1521 
1523  cerr << "nbr_conditions_boundary (array version) not implemented for" << endl ;
1524  cerr << *this << endl ;
1525  abort() ;
1526 }
1528  cerr << "nbr_conditions_boundary_one_side not implemented for" << endl ;
1529  cerr << *this << endl ;
1530  abort() ;
1531 }
1532 
1533 void Domain::export_tau (const Tensor&, int, int, Array<double>&, int&, const Array<int>&, int, Array<int>**) const {
1534  cerr << "export_tau not implemented for" << endl ;
1535  cerr << *this << endl ;
1536  abort() ;
1537 }
1538 
1539 void Domain::export_tau_array (const Tensor&, int, const Array<int>&, Array<double>&, int&, const Array<int>&, int, Array<int>**) const {
1540  cerr << "export_tau (with array) not implemented for" << endl ;
1541  cerr << *this << endl ;
1542  abort() ;
1543 }
1544 
1545 void Domain::export_tau_boundary (const Tensor&, int, int, Array<double>&, int&, const Array<int>&, int, Array<int>**) const {
1546  cerr << "export_tau_boundary not implemented for" << endl ;
1547  cerr << *this << endl ;
1548  abort() ;
1549 }
1550 void Domain::export_tau_boundary_exception (const Tensor&, int, int, Array<double>&, int&, const Array<int>&, const Param&, int, const Tensor&,
1551  int, Array<int>**) const {
1552  cerr << "export_tau_boundary_exception not implemented for" << endl ;
1553  cerr << *this << endl ;
1554  abort() ;
1555 }
1556 
1557 void Domain::export_tau_boundary_array (const Tensor&, int, int, const Array<int>&, Array<double>&, int&, const Array<int>&, int, Array<int>**) const {
1558  cerr << "export_tau_boundary (with array) not implemented for" << endl ;
1559  cerr << *this << endl ;
1560  abort() ;
1561 }
1562 
1563 void Domain::export_tau_boundary_one_side (const Tensor&, int, int, Array<double>&, int&, const Array<int>&, int, Array<int>**) const {
1564  cerr << "export_tau_boundary_one_side not implemented for" << endl ;
1565  cerr << *this << endl ;
1566  abort() ;
1567 }
1568 
1569 void Domain::affecte_tau (Tensor&, int, const Array<double>&, int&) const {
1570  cerr << "affecte_tau not implemented for" << endl ;
1571  cerr << *this << endl ;
1572  abort() ;
1573 }
1574 
1575 void Domain::affecte_tau_one_coef (Tensor&, int, int, int&) const {
1576  cerr << "affecte_tau_one_coef not implemented for" << endl ;
1577  cerr << *this << endl ;
1578  abort() ;
1579 }
1580 
1581 double Domain::val_boundary (int, const Val_domain&, const Index&) const {
1582  cerr << "val_boundary not implemented for" << endl ;
1583  cerr << *this << endl ;
1584  abort() ;
1585 }
1586 
1588  cerr << "nbr_points_boundary not implemented for" << endl ;
1589  cerr << *this << endl ;
1590  abort() ;
1591 }
1592 
1593 void Domain::do_which_points_boundary (int, const Base_spectral&, Index**, int) const {
1594  cerr << "do_which_points_boundary not implemented for" << endl ;
1595  cerr << *this << endl ;
1596  abort() ;
1597 }
1598 
1599 void Domain::do_absol () const {
1600  cerr << "do_absol not implemented for" << endl ;
1601  cerr << *this << endl ;
1602  abort() ;
1603 }
1604 
1605 void Domain::do_cart () const {
1606  cerr << "do_cart not implemented for" << endl ;
1607  cerr << *this << endl ;
1608  abort() ;
1609 }
1610 
1611 void Domain::do_cart_surr () const {
1612  cerr << "do_cart_surr not implemented for" << endl ;
1613  cerr << *this << endl ;
1614  abort() ;
1615 }
1616 
1617 void Domain::do_radius () const {
1618  cerr << "do_radius not implemented for" << endl ;
1619  cerr << *this << endl ;
1620  abort() ;
1621 }
1622 
1623 double Domain::multipoles_sym (int, int, int, const Val_domain&, const Array<double>&) const {
1624  cerr << "multipoles sym not implemented for" << endl ;
1625  cerr << *this << endl ;
1626  abort() ;
1627 }
1628 
1629 double Domain::multipoles_asym (int, int, int, const Val_domain&, const Array<double>&) const {
1630  cerr << "multipoles asym not implemented for" << endl ;
1631  cerr << *this << endl ;
1632  abort() ;
1633 }
1634 
1635 Term_eq Domain::multipoles_sym (int, int, int, const Term_eq&, const Array<double>&) const {
1636  cerr << "multipoles sym not implemented for" << endl ;
1637  cerr << *this << endl ;
1638  abort() ;
1639 }
1640 
1641 Term_eq Domain::multipoles_asym (int, int, int, const Term_eq&, const Array<double>&) const {
1642  cerr << "multipoles asym not implemented for" << endl ;
1643  cerr << *this << endl ;
1644  abort() ;
1645 }
1646 
1647 Term_eq Domain::radial_part_sym (const Space&, int, int, const Term_eq&, Term_eq (*f) (const Space&, int, int, const Term_eq&, const Param&), const Param&) const {
1648  cerr << "radial part sym not implemented for" << endl ;
1649  cerr << *this << endl ;
1650  cerr << "and function " << f << endl ;
1651  abort() ;
1652 }
1653 
1654 Term_eq Domain::radial_part_asym (const Space&, int, int, const Term_eq&, Term_eq (*f) (const Space&, int, int, const Term_eq&, const Param&), const Param&) const {
1655  cerr << "radial part asym not implemented for" << endl ;
1656  cerr << *this << endl ;
1657  cerr << "and function " << f << endl ;
1658  abort() ;
1659 }
1660 
1661 Term_eq Domain::harmonics_sym (const Term_eq&, const Term_eq&, int, Term_eq (*f) (const Space&, int, int, const Term_eq&, const Param&), const Param&, const Array<double>&) const {
1662  cerr << "harmonics_sym not implemented for" << endl ;
1663  cerr << *this << endl ;
1664  cerr << "and function " << f << endl ;
1665  abort() ;
1666 }
1667 
1668 Term_eq Domain::harmonics_asym (const Term_eq&, const Term_eq&, int, Term_eq (*f) (const Space&, int, int, const Term_eq&, const Param&), const Param&, const Array<double>&) const {
1669  cerr << "harmonics_asym not implemented for" << endl ;
1670  cerr << *this << endl ;
1671  cerr << "and function " << f << endl ;
1672  abort() ;
1673 }
1674 
1675 Term_eq Domain::der_multipoles_sym (int, int, int, const Term_eq&, const Array<double>&) const {
1676  cerr << "der multipoles sym not implemented for" << endl ;
1677  cerr << *this << endl ;
1678  abort() ;
1679 }
1680 
1681 Term_eq Domain::der_multipoles_asym (int, int, int, const Term_eq&, const Array<double>&) const {
1682  cerr << "der multipoles asym not implemented for" << endl ;
1683  cerr << *this << endl ;
1684  abort() ;
1685 }
1686 
1687 Term_eq Domain::der_radial_part_sym (const Space&, int, int, const Term_eq&, Term_eq (*f) (const Space&, int, int, const Term_eq&, const Param&), const Param&) const {
1688  cerr << "der radial part sym not implemented for" << endl ;
1689  cerr << *this << endl ;
1690  cerr << "and function " << f << endl ;
1691  abort() ;
1692 }
1693 
1694 Term_eq Domain::der_radial_part_asym (const Space&, int, int, const Term_eq&, Term_eq (*f) (const Space&, int, int, const Term_eq&, const Param&), const Param&) const {
1695  cerr << "der radial part asym not implemented for" << endl ;
1696  cerr << *this << endl ;
1697  cerr << "and function " << f << endl ;
1698  abort() ;
1699 }
1700 
1701 Term_eq Domain::der_harmonics_sym (const Term_eq&, const Term_eq&, int, Term_eq (*f) (const Space&, int, int, const Term_eq&, const Param&), const Param&, const Array<double>&) const {
1702  cerr << "der_harmonics_sym not implemented for" << endl ;
1703  cerr << *this << endl ;
1704  cerr << "and function " << f << endl ;
1705  abort() ;
1706 }
1707 
1708 Term_eq Domain::der_harmonics_asym (const Term_eq&, const Term_eq&, int, Term_eq (*f) (const Space&, int, int, const Term_eq&, const Param&), const Param&, const Array<double>&) const {
1709  cerr << "der harmonics_asym not implemented for" << endl ;
1710  cerr << *this << endl ;
1711  cerr << "and function " << f << endl ;
1712  abort() ;
1713 }
1714 
1715 const Term_eq* Domain::give_normal (int, int) const {
1716  cerr << "give_normal not implemented for" << endl ;
1717  cerr << *this << endl ;
1718  abort() ;
1719 }
1720 
1721 Term_eq Domain::derive_flat_spher (int, char, const Term_eq&, const Metric*) const {
1722  cerr << "derive_flat_spher not implemented for" << endl ;
1723  cerr << *this << endl ;
1724  abort() ;
1725 }
1726 
1727 Term_eq Domain::derive_flat_mtz (int, char, const Term_eq&, const Metric*) const {
1728  cerr << "derive_flat_mtz not implemented for" << endl ;
1729  cerr << *this << endl ;
1730  abort() ;
1731 }
1732 
1733 Term_eq Domain::derive_flat_cart (int, char, const Term_eq&, const Metric*) const {
1734  cerr << "derive_flat_cart not implemented for" << endl ;
1735  cerr << *this << endl ;
1736  abort() ;
1737 }
1738 
1739 int Domain::give_place_var (char*) const {
1740  return -1 ;
1741 }
1742 
1743 Tensor Domain::import (int, int, int, const Array<int>&, Tensor**) const {
1744  cerr << "import not implemented for" << endl ;
1745  cerr << *this << endl ;
1746  abort() ;
1747 }
1748 
1750  so->set_der_zero() ;
1751 }
1752 
1753 double Domain::integ_volume (const Val_domain&) const {
1754  cerr << "Integ volume not implemented for " << endl ;
1755  cerr << *this << endl ;
1756  abort() ;
1757 }
1758 
1759 void Domain::filter (Tensor&, int, double) const {
1760  cerr << "Filter not implemented for" << endl ;
1761  cerr << *this << endl ;
1762  abort() ;
1763 }
1764 
1766  return do_comp_by_comp (so, &Domain::div_1mx2) ;
1767 }
1768 }
reference set(const Index &pos)
Read/write of an element.
Definition: array.hpp:186
Class for storing the basis of decompositions of a field.
Describes the tensorial basis used by the various tensors.
Definition: base_tensor.hpp:49
int & set_basis(int nd)
Read/write the basis in a given domain.
Definition: base_tensor.hpp:91
int get_ndim() const
Returns the number of dimensions.
Definition: dim_array.hpp:63
void save(FILE *) const
Save function.
Definition: dim_array.cpp:32
Abstract class that implements the fonctionnalities common to all the type of domains.
Definition: space.hpp:60
virtual void del_deriv()
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
Definition: domain.cpp:77
virtual void export_tau_array(const Tensor &eq, int dom, const Array< int > &order, Array< double > &res, int &pos_res, const Array< int > &ncond, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to one tensorial one in the bulk.
Definition: domain.cpp:1539
Val_domain * radius
The generalized radius.
Definition: space.hpp:78
virtual Val_domain div_cos_theta(const Val_domain &) const
Division by .
Definition: domain.cpp:1254
virtual const Val_domain & get_T() const
Returns the variable .
Definition: domain.cpp:1405
virtual void set_legendre_base_odd(Base_spectral &so) const
Gives the base using odd Legendre polynomials$.
Definition: domain.cpp:1164
virtual Point get_center() const
Returns the center.
Definition: domain.cpp:1381
virtual void set_cheb_base_yz_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Definition: domain.cpp:1183
virtual Val_domain laplacian(const Val_domain &so, int m) const
Computes the ordinary flat Laplacian for a scalar field with an harmonic index m.
Definition: domain.cpp:87
Term_eq import(int numdom, int bound, int n_ope, Term_eq **parts) const
Gets the value of a Term_eq by importing data from neighboring domains, on a boundary.
Definition: domain.cpp:107
virtual Val_domain ddr(const Val_domain &so) const
Compute the second radial derivative w of a scalar field.
Definition: domain.cpp:1452
virtual void set_cheb_base_r_mtz(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the radial component of a vector in the MTZ setting.
Definition: domain.cpp:1089
virtual Term_eq derive_flat_spher(int tipe, char ind, const Term_eq &so, const Metric *manip) const
Computes the flat derivative of a Term_eq, in spherical orthonormal coordinates.
Definition: domain.cpp:1721
Memory_mapped_array< Val_domain * > cart
Cartesian coordinates.
Definition: space.hpp:77
virtual Term_eq partial_mtz(const Term_eq &so) const
Computes the part of the gradient containing the partial derivative of the field, in orthonormal coor...
Definition: domain.cpp:463
virtual void set_val_inf(Val_domain &so, double xx) const
Sets the value at infinity of a Val_domain : not implemented for this type of Domain.
Definition: domain.cpp:1266
virtual void filter(Tensor &tt, int dom, double treshold) const
Puts to zero all the coefficients below a given treshold.
Definition: domain.cpp:1759
virtual void do_der_abs_from_der_var(const Val_domain *const *const der_var, Val_domain **const der_abs) const
Computes the derivative with respect to the absolute Cartesian coordinates from the derivative with r...
Definition: domain.cpp:960
virtual Val_domain der_p(const Val_domain &so) const
Compute the derivative with respect to of a scalar field.
Definition: domain.cpp:1440
Memory_mapped_array< Val_domain * > absol
Asbolute coordinates (if defined ; usually Cartesian-like)
Definition: space.hpp:76
virtual void set_anti_legendre_base(Base_spectral &so) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
Definition: domain.cpp:1007
int get_ndim() const
Returns the number of dimensions.
Definition: space.hpp:96
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
Definition: domain.cpp:966
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
Definition: domain.cpp:1236
int ndim
Number of dimensions.
Definition: space.hpp:64
virtual Term_eq radial_part_sym(const Space &space, int k, int j, const Term_eq &omega, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &param) const
Gives some radial fit for a given multipole, intended for symmetric scalar function.
Definition: domain.cpp:1647
virtual Val_domain mult_cos_phi(const Val_domain &) const
Multiplication by .
Definition: domain.cpp:1230
virtual Val_domain div_xm1(const Val_domain &) const
Division by .
Definition: domain.cpp:1272
Term_eq do_comp_by_comp(const Term_eq &so, Val_domain(Domain::*pfunc)(const Val_domain &) const) const
Function used to apply the same operation to all the components of a tensor, in the current domain.
Definition: domain.cpp:283
virtual Val_domain div_sin_chi(const Val_domain &) const
Division by .
Definition: domain.cpp:1345
virtual Val_domain div_1mrsL(const Val_domain &so) const
Division by .
Definition: domain.cpp:1284
virtual Val_domain mult_cos_time(const Val_domain &) const
Multiplication by .
Definition: domain.cpp:1315
virtual Term_eq integ_term_eq(const Term_eq &so, int bound) const
Surface integral of a Term_eq.
Definition: domain.cpp:187
virtual double get_rmax() const
Returns the maximum radius.
Definition: domain.cpp:1369
virtual Array< int > nbr_conditions_array(const Tensor &eq, int dom, const Array< int > &order, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation in the bulk.
Definition: domain.cpp:1510
virtual Val_domain ddp(const Val_domain &so) const
Compute the second derivative with respect to of a scalar field.
Definition: domain.cpp:1456
virtual Val_domain der_r(const Val_domain &so) const
Compute the radial derivative of a scalar field.
Definition: domain.cpp:1429
virtual Val_domain der_partial_var(const Val_domain &so, int ind) const
Partial derivative with respect to a coordinate.
Definition: domain.cpp:1423
virtual const Term_eq * give_normal(int bound, int tipe) const
Returns the vector normal to a surface.
Definition: domain.cpp:1715
Memory_mapped_array< Val_domain * > cart_surr
Cartesian coordinates divided by the radius.
Definition: space.hpp:79
virtual void update_term_eq(Term_eq *so) const
Update the value of a field, after the shape of the Domain has been changed by the system.
Definition: domain.cpp:1749
virtual void set_cheb_base_rt_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a 2-tensor.
Definition: domain.cpp:1106
virtual Val_domain dtime(const Val_domain &so) const
Computes the time derivative of a field.
Definition: domain.cpp:1474
virtual void set_legendre_base_t_mtz(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector in the MTZ context.
Definition: domain.cpp:1147
virtual Val_domain div_xp1(const Val_domain &) const
Division by .
Definition: domain.cpp:1278
virtual double val_boundary(int bound, const Val_domain &so, const Index &ind) const
Computes the value of a field at a boundary.
Definition: domain.cpp:1581
virtual Val_domain mult_xm1(const Val_domain &) const
Multiplication by .
Definition: domain.cpp:1297
virtual Term_eq div_r_term_eq(const Term_eq &) const
Division by of a Term_eq.
Definition: domain.cpp:169
virtual void set_cheb_base_xz_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Definition: domain.cpp:1176
virtual Val_domain dt(const Val_domain &so) const
Compute the derivative with respect to of a scalar field.
Definition: domain.cpp:1468
virtual void set_cheb_xodd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in (critic space case)
Definition: domain.cpp:1036
virtual int nbr_unknowns(const Tensor &so, int dom) const
Computes the number of true unknowns of a Tensor, in a given domain.
Definition: domain.cpp:1498
virtual Val_domain div_r(const Val_domain &so) const
Division by .
Definition: domain.cpp:1339
virtual void do_cart_surr() const
Computes the Cartesian coordinates over the radius.
Definition: domain.cpp:1611
virtual void set_cheb_base_p_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Definition: domain.cpp:1084
virtual Val_domain der_r_rtwo(const Val_domain &so) const
Compute the radial derivative multiplied by of a scalar field.
Definition: domain.cpp:1446
virtual void set_cheb_base_t_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Definition: domain.cpp:1078
Domain(int num, int ttype, const Dim_array &res)
Constructor from a number of points and a type of base.
Definition: space.hpp:1429
virtual void export_tau(const Tensor &eq, int dom, int order, Array< double > &res, int &pos_res, const Array< int > &ncond, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to a tensorial one in the bulk.
Definition: domain.cpp:1533
virtual void set_legendre_base_r_spher(Base_spectral &so) const
Gives the base using Legendre polynomials, for the radial component of a vector.
Definition: domain.cpp:1123
virtual int nbr_points_boundary(int bound, const Base_spectral &base) const
Computes the number of relevant collocation points on a boundary.
Definition: domain.cpp:1587
int num_dom
Number of the current domain (used by the Space)
Definition: space.hpp:63
virtual void set_cheb_r_base(Base_spectral &so) const
Gives the base using odd Chebyshev polynomials$ for the radius.
Definition: domain.cpp:989
virtual void set_cheb_base(Base_spectral &so) const
Gives the standard base for Chebyshev polynomials.
Definition: domain.cpp:978
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
Definition: domain.cpp:942
Term_eq do_comp_by_comp_with_int(const Term_eq &so, int val, Val_domain(Domain::*pfunc)(const Val_domain &, int) const) const
Function used to apply the same operation to all the components of a tensor, in the current domain.
Definition: domain.cpp:228
virtual void set_cheb_base_z_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Definition: domain.cpp:1200
Dim_array nbr_coefs
Number of coefficients.
Definition: space.hpp:66
virtual void set_cheb_base_rp_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a 2-tensor.
Definition: domain.cpp:1112
virtual Val_domain mult_x(const Val_domain &so) const
Multiplication by .
Definition: domain.cpp:1309
virtual Term_eq div_1mx2_term_eq(const Term_eq &) const
Returns the division by of a Term_eq.
Definition: domain.cpp:1765
virtual void set_legendre_base_y_cart(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
Definition: domain.cpp:1212
virtual Val_domain div_sin_theta(const Val_domain &) const
Division by .
Definition: domain.cpp:1248
virtual Term_eq partial_cart(const Term_eq &so) const
Computes the part of the gradient containing the partial derivative of the field, in Cartesian coordi...
Definition: domain.cpp:338
virtual void set_cheb_base_tp_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a 2-tensor.
Definition: domain.cpp:1118
virtual void set_legendre_xodd_base(Base_spectral &so) const
Gives the base using Legendre polynomials, for odd functions in (critic space case)
Definition: domain.cpp:1042
virtual const Val_domain & get_chi() const
Returns the variable .
Definition: domain.cpp:1387
virtual void set_legendre_base_with_m(Base_spectral &so, int m) const
Gives the stnadard base using Legendre polynomials.
Definition: domain.cpp:1018
virtual Array< int > nbr_conditions_boundary_array(const Tensor &eq, int dom, int bound, const Array< int > &order, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation on a boundary.
Definition: domain.cpp:1522
virtual const Point absol_to_num_bound(const Point &xxx, int bound) const
Computes the numerical coordinates from the physical ones for a point lying on a boundary.
Definition: domain.cpp:954
virtual Val_domain mult_1mrsL(const Val_domain &so) const
Multiplication by .
Definition: domain.cpp:1291
virtual Term_eq der_harmonics_asym(const Term_eq &so, const Term_eq &omega, int bound, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &param, const Array< double > &passage) const
Fit, spherical harmonic by spherical harmonic, for the radial derivative of an anti-symmetric functio...
Definition: domain.cpp:1708
virtual void set_cheb_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in (critic space case)
Definition: domain.cpp:1048
virtual Val_domain der_t(const Val_domain &so) const
Compute the derivative with respect to of a scalar field.
Definition: domain.cpp:1435
virtual Term_eq der_harmonics_sym(const Term_eq &so, const Term_eq &omega, int bound, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &param, const Array< double > &passage) const
Fit, spherical harmonic by spherical harmonic, for the radial derivative of a symmetric function.
Definition: domain.cpp:1701
virtual double get_rmin() const
Returns the minimum radius.
Definition: domain.cpp:1375
virtual Val_domain mult_r(const Val_domain &so) const
Multiplication by .
Definition: domain.cpp:1303
virtual void set_cheb_base_y_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Definition: domain.cpp:1194
virtual void save(FILE *) const
Saving function.
Definition: domain.cpp:68
virtual Array< int > nbr_conditions_boundary_one_side(const Tensor &eq, int dom, int bound, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation on a boundary.
Definition: domain.cpp:1527
virtual Val_domain mult_sin_time(const Val_domain &) const
Multiplication by .
Definition: domain.cpp:1321
virtual double multipoles_sym(int k, int j, int bound, const Val_domain &so, const Array< double > &passage) const
Extraction of a given multipole, at some boundary, for a symmetric scalar function.
Definition: domain.cpp:1623
virtual Val_domain srdr(const Val_domain &so) const
Compute the of a scalar field .
Definition: domain.cpp:1333
virtual Term_eq dtime_term_eq(const Term_eq &so) const
Time derivative of a Term_eq.
Definition: domain.cpp:149
virtual double multipoles_asym(int k, int j, int bound, const Val_domain &so, const Array< double > &passage) const
Extraction of a given multipole, at some boundary, for a anti-symmetric scalar function.
Definition: domain.cpp:1629
virtual Term_eq der_multipoles_asym(int k, int j, int bound, const Term_eq &so, const Array< double > &passage) const
Extraction of a given multipole, at some boundary, for the radial derivative of an anti-symmetric sca...
Definition: domain.cpp:1681
virtual Term_eq connection_spher(const Term_eq &so) const
Computes the part of the gradient involving the connections, in spherical orthonormal coordinates.
Definition: domain.cpp:544
virtual const Val_domain & get_X() const
Returns the variable .
Definition: domain.cpp:1399
virtual Val_domain div_1mx2(const Val_domain &) const
Division by .
Definition: domain.cpp:1327
virtual void set_anti_legendre_base_with_m(Base_spectral &so, int m) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
Definition: domain.cpp:1030
virtual void export_tau_boundary(const Tensor &eq, int dom, int bound, Array< double > &res, int &pos_res, const Array< int > &ncond, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to a tensorial one on a given boundary It makes use ...
Definition: domain.cpp:1545
virtual Term_eq lap2_term_eq(const Term_eq &so, int m) const
Returns the flat 2d-Laplacian of Term_eq, for a given harmonic.
Definition: domain.cpp:161
virtual void affecte_tau_one_coef(Tensor &so, int dom, int cc, int &pos_cf) const
Sets at most one coefficient of a Tensor to 1.
Definition: domain.cpp:1575
virtual Term_eq dr_term_eq(const Term_eq &so) const
Radial derivative of a Term_eq.
Definition: domain.cpp:145
virtual Val_domain ddt(const Val_domain &so) const
Compute the second derivative with respect to of a scalar field.
Definition: domain.cpp:1462
virtual void set_cheb_base_t_mtz(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector in the MTZ setting.
Definition: domain.cpp:1095
virtual Term_eq derive_flat_cart(int tipe, char ind, const Term_eq &so, const Metric *manip) const
Computes the flat derivative of a Term_eq, in Cartesian coordinates.
Definition: domain.cpp:1733
virtual Term_eq grad_term_eq(const Term_eq &so) const
Gradient of Term_eq.
Definition: domain.cpp:173
virtual Term_eq der_radial_part_asym(const Space &space, int k, int j, const Term_eq &omega, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &param) const
Gives some radial fit for a given multipole, intended for the radial derivative of an anti-symmetric ...
Definition: domain.cpp:1694
virtual void set_legendre_todd_base(Base_spectral &so) const
Gives the base using Legendre polynomials, for odd functions in (critic space case)
Definition: domain.cpp:1054
virtual void set_legendre_base_r_mtz(Base_spectral &so) const
Gives the base using Legendre polynomials, for the radial component of a vector in the MTZ context.
Definition: domain.cpp:1141
virtual Tensor change_basis_cart_to_spher(int dd, const Tensor &so) const
Changes the tensorial basis from Cartsian to spherical in a given domain.
Definition: domain.cpp:1357
virtual void set_legendre_base_z_cart(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
Definition: domain.cpp:1218
virtual Val_domain mult_sin_phi(const Val_domain &) const
Multiplication by .
Definition: domain.cpp:1242
virtual void set_cheb_base_r_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the radial component of a vector.
Definition: domain.cpp:1072
virtual Term_eq der_normal_term_eq(const Term_eq &so, int bound) const
Returns the normal derivative of a Term_eq.
Definition: domain.cpp:141
virtual Term_eq partial_spher(const Term_eq &so) const
Computes the part of the gradient containing the partial derivative of the field, in spherical orthon...
Definition: domain.cpp:383
virtual void do_which_points_boundary(int bound, const Base_spectral &base, Index **ind, int start) const
Lists all the indices corresponding to true collocation points on a boundary.
Definition: domain.cpp:1593
Dim_array nbr_points
Number of colocation points.
Definition: space.hpp:65
virtual void set_cheb_base_odd(Base_spectral &so) const
Gives the base using odd Chebyshev polynomials$.
Definition: domain.cpp:1158
virtual Array< int > nbr_conditions_boundary(const Tensor &eq, int dom, int bound, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation on a boundary.
Definition: domain.cpp:1516
virtual void set_cheb_xodd_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in and in (critic space case)
Definition: domain.cpp:1060
virtual void set_legendre_base_p_spher(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
Definition: domain.cpp:1135
virtual Term_eq der_radial_part_sym(const Space &space, int k, int j, const Term_eq &omega, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &param), const Param &param) const
Gives some radial fit for a given multipole, intended for the radial derivative of a symmetric scalar...
Definition: domain.cpp:1687
virtual Term_eq lap_term_eq(const Term_eq &so, int m) const
Returns the flat Laplacian of Term_eq, for a given harmonic.
Definition: domain.cpp:157
virtual void set_legendre_base_t_spher(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
Definition: domain.cpp:1129
virtual void export_tau_boundary_array(const Tensor &eq, int dom, int bound, const Array< int > &order, Array< double > &res, int &pos_res, const Array< int > &ncond, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to one tensorial one on a given boundary It makes us...
Definition: domain.cpp:1557
virtual Val_domain laplacian2(const Val_domain &so, int m) const
Computes the ordinary flat 2dè- Laplacian for a scalar field with an harmonic index m.
Definition: domain.cpp:100
virtual Term_eq derive_flat_mtz(int tipe, char ind, const Term_eq &so, const Metric *manip) const
Computes the flat derivative of a Term_eq, in spherical coordinates where the constant radii sections...
Definition: domain.cpp:1727
int type_base
Type of colocation point :
Definition: space.hpp:73
virtual void set_legendre_base_x_cart(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
Definition: domain.cpp:1206
virtual Tensor change_basis_spher_to_cart(int dd, const Tensor &so) const
Changes the tensorial basis from spherical to Cartesian in a given domain.
Definition: domain.cpp:1363
virtual double integ_volume(const Val_domain &so) const
Volume integral.
Definition: domain.cpp:1753
virtual void set_cheb_base_x_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Definition: domain.cpp:1188
virtual void set_legendre_base_p_mtz(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector in the MTZ context.
Definition: domain.cpp:1153
virtual Val_domain der_normal(const Val_domain &so, int bound) const
Normal derivative with respect to a given surface.
Definition: domain.cpp:1417
virtual void set_legendre_base(Base_spectral &so) const
Gives the standard base for Legendre polynomials.
Definition: domain.cpp:983
virtual Term_eq harmonics_asym(const Term_eq &so, const Term_eq &omega, int bound, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &param, const Array< double > &passage) const
Fit, spherical harmonic by spherical harmonic, for an anti-symmetric function.
Definition: domain.cpp:1668
virtual void do_cart() const
Computes the Cartesian coordinates.
Definition: domain.cpp:1605
virtual void set_cheb_base_xy_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Definition: domain.cpp:1169
virtual Term_eq harmonics_sym(const Term_eq &so, const Term_eq &omega, int bound, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &param, const Array< double > &passage) const
Fit, spherical harmonic by spherical harmonic, for a symmetric function.
Definition: domain.cpp:1661
virtual void export_tau_boundary_one_side(const Tensor &eq, int dom, int bound, Array< double > &res, int &pos_res, const Array< int > &ncond, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to one tensorial one on a given boundary.
Definition: domain.cpp:1563
virtual Val_domain div_chi(const Val_domain &) const
Division by .
Definition: domain.cpp:1351
virtual void set_anti_cheb_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
Definition: domain.cpp:1001
virtual void export_tau_boundary_exception(const Tensor &eq, int dom, int bound, Array< double > &res, int &pos_res, const Array< int > &ncond, const Param &param, int type_exception, const Tensor &exception, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to one tensorial one on a given boundary,...
Definition: domain.cpp:1550
virtual int give_place_var(char *name) const
Translates a name of a coordinate into its corresponding numerical name.
Definition: domain.cpp:1739
virtual void set_legendre_xodd_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in and in (critic space case)
Definition: domain.cpp:1066
virtual const Val_domain & get_eta() const
Returns the variable .
Definition: domain.cpp:1393
virtual Term_eq connection_mtz(const Term_eq &so) const
Computes the part of the gradient involving the connections, in spherical coordinates where the const...
Definition: domain.cpp:722
virtual void affecte_tau(Tensor &so, int dom, const Array< double > &cf, int &pos_cf) const
Affects some coefficients to a Tensor.
Definition: domain.cpp:1569
virtual void set_cheb_base_p_mtz(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector in the MTZ setting.
Definition: domain.cpp:1101
Memory_mapped_array< Array< double > * > coloc
Colocation points in each dimension (stored in ndim 1d- arrays)
Definition: space.hpp:75
virtual void find_other_dom(int dom, int bound, int &otherdom, int &otherbound) const
Gives the informations corresponding the a touching neighboring domain.
Definition: domain.cpp:1411
virtual void do_radius() const
Computes the generalized radius.
Definition: domain.cpp:1617
virtual Val_domain ddtime(const Val_domain &so) const
Computes the second time derivative of a field.
Definition: domain.cpp:1480
virtual Val_domain div_x(const Val_domain &) const
Division by .
Definition: domain.cpp:1260
virtual void set_legendre_r_base(Base_spectral &so) const
Gives the base using odd Legendre polynomials$ for the radius.
Definition: domain.cpp:995
virtual Term_eq der_multipoles_sym(int k, int j, int bound, const Term_eq &so, const Array< double > &passage) const
Extraction of a given multipole, at some boundary, for the radial derivative a symmetric scalar funct...
Definition: domain.cpp:1675
virtual void set_cheb_base_with_m(Base_spectral &so, int m) const
Gives the standard base using Chebyshev polynomials.
Definition: domain.cpp:1012
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
Definition: domain.cpp:1224
virtual void set_anti_cheb_base_with_m(Base_spectral &so, int m) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
Definition: domain.cpp:1024
virtual Term_eq integ_volume_term_eq(const Term_eq &so) const
Volume integral of a Term_eq.
Definition: domain.cpp:901
virtual void do_coloc()
Computes the colocation points.
Definition: domain.cpp:972
virtual void do_absol() const
Computes the absolute coordinates.
Definition: domain.cpp:1599
virtual Term_eq radial_part_asym(const Space &space, int k, int j, const Term_eq &omega, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &param) const
Gives some radial fit for a given multipole, intended for anti-symmetric scalar function.
Definition: domain.cpp:1654
virtual Term_eq mult_r_term_eq(const Term_eq &so) const
Multiplication by of a Term_eq.
Definition: domain.cpp:165
virtual double integ(const Val_domain &so, int bound) const
Surface integral on a given boundary.
Definition: domain.cpp:1486
virtual Term_eq ddtime_term_eq(const Term_eq &so) const
Second time derivative of a Term_eq.
Definition: domain.cpp:153
virtual const Point absol_to_num(const Point &xxx) const
Computes the numerical coordinates from the physical ones.
Definition: domain.cpp:948
virtual Array< int > nbr_conditions(const Tensor &eq, int dom, int order, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation in the bulk.
Definition: domain.cpp:1504
virtual double integrale(const Val_domain &so) const
Volume integral.
Definition: domain.cpp:1492
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
bool inc(int increm, int var=0)
Increments the position of the Index.
Definition: index.hpp:99
Purely abstract class for metric handling.
Definition: metric.hpp:39
int get_m_quant() const
Returns .
Definition: tensor.hpp:747
int & set_m_quant()
Sets .
Definition: tensor.hpp:757
Parameter storage.
Definition: param.hpp:30
The class Point is used to store the coordinates of a point.
Definition: point.hpp:30
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
Definition: scalar.hpp:555
The Space class is an ensemble of domains describing the whole space of the computation.
Definition: space.hpp:1362
Tensor handling.
Definition: tensor.hpp:149
Memory_mapped_array< char > name_indice
If the indices haves names they are stored here.
Definition: tensor.hpp:176
void set_name_affected()
Affects the name of the indices.
Definition: tensor.hpp:435
Param_tensor & set_parameters()
Read/write of the parameters.
Definition: tensor.hpp:314
const Param_tensor & get_parameters() const
Returns a pointer on the possible additional parameter.
Definition: tensor.hpp:311
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
Definition: tensor_impl.hpp:91
int get_index_type(int i) const
Gives the type (covariant or contravariant) of a given index.
Definition: tensor.hpp:526
int get_n_comp() const
Returns the number of stored components.
Definition: tensor.hpp:514
virtual Array< int > indices(int pos) const
Gives the values of the indices corresponding to a location in the array used for storage of the comp...
Definition: tensor.hpp:484
int get_valence() const
Returns the valence.
Definition: tensor.hpp:509
bool is_name_affected() const
Check whether the names of the indices have been affected.
Definition: tensor.hpp:429
bool is_m_quant_affected() const
Checks whether the additional parameter is affected (used for boson stars for instance).
Definition: tensor.hpp:326
const Space & get_space() const
Returns the Space.
Definition: tensor.hpp:499
This class is intended to describe the manage objects appearing in the equations.
Definition: term_eq.hpp:62
Tensor * der_t
Pointer on the variation, if the Term_eq is a Tensor.
Definition: term_eq.hpp:69
const int type_data
Flag describing the type of data :
Definition: term_eq.hpp:75
int get_dom() const
Definition: term_eq.hpp:135
void set_der_zero()
Sets the variation of the approriate type to zero.
Definition: term_eq.cpp:187
const int dom
Index of the Domain where the Term_eq is defined.
Definition: term_eq.hpp:65
Tensor const & get_val_t() const
Definition: term_eq.hpp:355
Tensor const & get_der_t() const
Definition: term_eq.hpp:369
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Definition: term_eq.hpp:68
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
Val_domain div_r() const
Division by the radius.
Definition: val_domain.cpp:743
bool check_if_zero() const
Check whether the logical state is zero or not.
Definition: val_domain.hpp:142
Val_domain der_r() const
Definition: val_domain.cpp:726
Val_domain div_sin_theta() const
Division by .
Val_domain mult_cos_theta() const
Multiplication by .
Val_domain der_abs(int i) const
Computes the derivative with respect to an absolute coordinate (typically Cartesian).
Definition: val_domain.cpp:681
const Domain * get_domain() const
Definition: val_domain.hpp:111