KADATH
val_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 "val_domain.hpp"
21 #include "utilities.hpp"
22 namespace Kadath {
24  zone{dom}, base{zone->get_ndim()}, is_zero{false}, c{nullptr}, cf{nullptr}, in_conf{false},
25  in_coef{false}, p_der_var{zone->get_ndim()}, p_der_abs{zone->get_ndim()}
26 {
27  for (int i=0 ; i<zone->get_ndim() ; i++) {
28  p_der_var[i] = nullptr ;
29  p_der_abs[i] = nullptr ;
30  }
31 }
32 
33 Val_domain::Val_domain (const Val_domain& so, bool const copie) :
34  zone{so.zone}, base{so.base}, is_zero{so.is_zero}, in_conf{copie && so.in_conf}, in_coef{copie && so.in_coef},
35  c{nullptr}, cf{nullptr}, p_der_var{zone->get_ndim()}, p_der_abs{zone->get_ndim()}
36 {
37  if(copie){
38  c = (so.c ? new Array<double> {*so.c} : nullptr);
39  cf = (so.cf ? new Array<double> {*so.cf} : nullptr);
40  }
41  for (int i=0 ; i<zone->get_ndim() ; i++) {
42  p_der_var[i] = ((so.p_der_var[i]!=nullptr) && copie) ? new Val_domain(*so.p_der_var[i]) : nullptr ;
43  p_der_abs[i] = ((so.p_der_abs[i]!=nullptr) && copie) ? new Val_domain(*so.p_der_abs[i]) : nullptr ;
44  }
45 }
46 
47 void Val_domain::swap(Val_domain &so) noexcept {
48  assert(zone == so.zone);
49  base.swap(so.base);
50  std::swap(is_zero,so.is_zero);
51  std::swap(c,so.c);
52  std::swap(cf,so.cf);
53  std::swap(in_conf,so.in_conf);
54  std::swap(in_coef,so.in_coef);
55  p_der_var.swap(so.p_der_var);
56  p_der_abs.swap(so.p_der_abs);
57 }
58 
60  zone{so.zone}, base{std::move(so.base)}, is_zero{so.is_zero}, c{so.c}, cf{so.cf}, in_conf{so.in_conf},
61  in_coef{so.in_coef}, p_der_var{std::move(so.p_der_var)}, p_der_abs{std::move(so.p_der_abs)}
62 {
63  so.c = nullptr;
64  so.cf = nullptr;
65 }
66 
68 {
69  assert(zone = so.zone);
70  base = std::move(so.base);
71  is_zero = so.is_zero ;
72  in_conf = so.in_conf ;
73  in_coef = so.in_coef ;
74  std::swap(c,so.c);
75  std::swap(cf,so.cf);
76  p_der_var = std::move(so.p_der_var);
77  p_der_abs = std::move(so.p_der_abs);
78  return *this;
79 }
80 
81 Val_domain::Val_domain (const Domain* so, FILE* fd) :
82  zone (so), base(fd), is_zero{}, c{}, cf{}, in_conf{}, in_coef{}, p_der_var{}, p_der_abs{}
83 {
84  int indic ;
85  fread_be (&indic, sizeof(int), 1, fd) ;
86  is_zero = (indic==0) ? false : true ;
87  fread_be (&indic, sizeof(int), 1, fd) ;
88  in_conf = (indic==0) ? true : false ;
89  c = (in_conf) ? new Array<double>(fd) : nullptr ;
90  fread_be (&indic, sizeof(int), 1, fd) ;
91  in_coef = (indic==0) ? true : false ;
92  cf = (in_coef) ? new Array<double>(fd) : nullptr ;
93 
94  p_der_var.resize(zone->get_ndim()) ;
95  p_der_abs.resize(zone->get_ndim()) ;
96  for (int i=0 ; i<zone->get_ndim() ; i++) {
97  p_der_var[i] = nullptr ;
98  p_der_abs[i] = nullptr ;
99  }
100 }
101 
103  del_deriv();
104 // if (c!=nullptr) delete c ;
105 // if (cf!=nullptr) delete cf ;
106  safe_delete(c);
107  safe_delete(cf);
108 }
109 
110 void Val_domain::save (FILE* fd) const {
111  base.save(fd) ;
112  int indic = (is_zero) ? 1 : 0 ;
113  fwrite_be (&indic, sizeof(int), 1, fd) ;
114  indic = (in_conf) ? 0 : 1 ;
115  fwrite_be (&indic, sizeof(int), 1, fd) ;
116  if (in_conf)
117  c->save(fd) ;
118  indic = (in_coef) ? 0 : 1 ;
119  fwrite_be (&indic, sizeof(int), 1, fd) ;
120  if (in_coef)
121  cf->save(fd) ;
122 }
123 
124 void Val_domain::del_deriv() const {
125 // auto safe_delete = [](Val_domain * & p) -> void {if(p) {delete p; p = nullptr;}};
126  p_der_var.apply(Safe_deleter<Val_domain>{});
127  p_der_abs.apply(Safe_deleter<Val_domain>{});
128 }
129 
131  assert (zone == so.zone) ;
132  is_zero = so.is_zero ;
133  in_conf = so.in_conf ;
134  in_coef = so.in_coef ;
135  safe_delete(c);
136  c = (in_conf) ? new Array<double> {*so.c} : nullptr ;
137  safe_delete(cf);
138  cf = (in_coef) ? new Array<double> (*so.cf) : nullptr ;
139  if (so.base.is_def()) base=so.base ;
140  else base.set_non_def() ;
141  del_deriv() ;
142  for (int i=0 ; i<zone->get_ndim() ; i++) {
143  p_der_var[i] = (so.p_der_var[i]==nullptr) ? nullptr : new Val_domain(*so.p_der_var[i]) ;
144  p_der_abs[i] = (so.p_der_abs[i]==nullptr) ? nullptr : new Val_domain(*so.p_der_abs[i]) ;
145  }
146 }
147 
148 void Val_domain::operator=(double xx) {
149  if (xx==0)
150  set_zero() ;
151  else {
152  is_zero = false ;
153  allocate_conf() ;
154  del_deriv() ;
155  *c = xx ;
156  }
157 }
158 
160  allocate_conf() ;
161  del_deriv() ;
162  *c = 0. ;
163 }
164 
166  allocate_coef() ;
167  del_deriv() ;
168  *cf = 0. ;
169 }
170 
171 double& Val_domain::set(const Index& index) {
172  set_in_conf() ;
173  del_deriv() ;
174  return c->set(index) ;
175 }
176 
177 double& Val_domain::set_coef(const Index& index) {
178  set_in_coef() ;
179  del_deriv() ;
180  return cf->set(index) ;
181 }
182 
183 double Val_domain::get_coef(const Index& index) const {
184  if (is_zero)
185  return 0. ;
186  else {
187  assert (in_coef) ;
188  return cf->set(index) ;
189  }
190 }
191 
192 double Val_domain::operator()(const Index& index) const {
193  coef_i() ;
194  return (*c)(index) ;
195 }
196 
198  safe_delete(cf);
199  in_conf = true ;
200  in_coef = false ;
201 }
202 
204  safe_delete(c);
205  in_conf = false ;
206  in_coef = true ;
207 }
208 
210  set_in_conf() ;
211  is_zero = false ;
212  safe_delete(c);
213  c = new Array<double>{zone->get_nbr_points()} ;
214 }
215 
217  set_in_coef() ;
218  is_zero = false ;
219  safe_delete(cf);
220  cf = new Array<double>{zone->get_nbr_coefs()} ;
221 }
222 
224  if (!is_zero) {
225  del_deriv() ;
226 
227  if (in_conf) {
228  assert(c);
229  delete c ;
230  c = nullptr ;
231  in_conf = false ;
232  }
233 
234  if (in_coef) {
235  assert(cf);
236  delete cf ;
237  cf = nullptr ;
238  in_coef = false ;
239  }
240  base.set_non_def() ;
241 
242  }
243  is_zero = true ;
244 }
245 
247  // recupere le type :
248  int typeb = zone->get_type_base() ;
249  switch (typeb) {
250  case CHEB_TYPE :
252  break ;
253  case LEG_TYPE :
255  break ;
256  default:
257  cerr << "Unknown type of base in Val_domain::std_base" ;
258  abort() ;
259  }
260 }
261 
263  // recupere le type :
264  int typeb = zone->get_type_base() ;
265  switch (typeb) {
266  case CHEB_TYPE :
268  break ;
269  case LEG_TYPE :
271  break ;
272  default:
273  cerr << "Unknown type of base in Val_domain::std_base" ;
274  abort() ;
275  }
276 }
277 
278 
280  // recupere le type :
281  int typeb = zone->get_type_base() ;
282  switch (typeb) {
283  case CHEB_TYPE :
285  break ;
286  case LEG_TYPE :
288  break ;
289  default:
290  cerr << "Unknown type of base in Val_domain::std_anti_base" ;
291  abort() ;
292  }
293 }
294 
295 void Val_domain::std_base(int m) {
296  // recupere le type :
297  int typeb = zone->get_type_base() ;
298  switch (typeb) {
299  case CHEB_TYPE :
301  break ;
302  case LEG_TYPE :
304  break ;
305  default:
306  cerr << "Unknown type of base in Val_domain::std_base" ;
307  abort() ;
308  }
309 }
310 
311 
313  // recupere le type :
314  int typeb = zone->get_type_base() ;
315  switch (typeb) {
316  case CHEB_TYPE :
318  break ;
319  case LEG_TYPE :
321  break ;
322  default:
323  cerr << "Unknown type of base in Val_domain::std_anti_base" ;
324  abort() ;
325  }
326 }
327 
329 {
330  int typeb(zone->get_type_base());
331  switch (typeb)
332  {
333  case CHEB_TYPE :
335  break;
336  default:
337  cerr << "Unknown type of base in Val_domain::std_base_rt_spher";
338  abort();
339  }
340 }
341 
343 {
344  int typeb(zone->get_type_base());
345  switch (typeb)
346  {
347  case CHEB_TYPE :
349  break;
350  default:
351  cerr << "Unknown type of base in Val_domain::std_base_rp_spher";
352  abort();
353  }
354 }
355 
357 {
358  int typeb(zone->get_type_base());
359  switch (typeb)
360  {
361  case CHEB_TYPE :
363  break;
364  default:
365  cerr << "Unknown type of base in Val_domain::std_base_tp_spher";
366  abort();
367  }
368 }
369 
371 {
372  int typeb(zone->get_type_base());
373  switch (typeb)
374  {
375  case CHEB_TYPE :
377  break;
378  default:
379  cerr << "Unknown type of base in Val_domain::std_base_xy_cart";
380  abort();
381  }
382 }
383 
385 {
386  int typeb(zone->get_type_base());
387  switch (typeb)
388  {
389  case CHEB_TYPE :
391  break;
392  default:
393  cerr << "Unknown type of base in Val_domain::std_base_xz_cart";
394  abort();
395  }
396 }
397 
399 {
400  int typeb(zone->get_type_base());
401  switch (typeb)
402  {
403  case CHEB_TYPE :
405  break;
406  default:
407  cerr << "Unknown type of base in Val_domain::std_base_yz_cart";
408  abort();
409  }
410 }
411 
413  // recupere le type :
414  int typeb = zone->get_type_base() ;
415  switch (typeb) {
416  case CHEB_TYPE :
418  break ;
419  case LEG_TYPE :
421  break ;
422  default:
423  cerr << "Unknown type of base in Val_domain::std_base_r_spher" ;
424  abort() ;
425  }
426 }
427 
429  // recupere le type :
430  int typeb = zone->get_type_base() ;
431  switch (typeb) {
432  case CHEB_TYPE :
434  break ;
435  case LEG_TYPE :
437  break ;
438  default:
439  cerr << "Unknown type of base in Val_domain::std_base_t_spher" ;
440  abort() ;
441  }
442 }
443 
445  // recupere le type :
446  int typeb = zone->get_type_base() ;
447  switch (typeb) {
448  case CHEB_TYPE :
450  break ;
451  case LEG_TYPE :
453  break ;
454  default:
455  cerr << "Unknown type of base in Val_domain::std_base_p_spher" ;
456  abort() ;
457  }
458 }
459 
461  // recupere le type :
462  int typeb = zone->get_type_base() ;
463  switch (typeb) {
464  case CHEB_TYPE :
466  break ;
467  case LEG_TYPE :
469  break ;
470  default:
471  cerr << "Unknown type of base in Val_domain::std_base_x_cart" ;
472  abort() ;
473  }
474 }
475 
477  // recupere le type :
478  int typeb = zone->get_type_base() ;
479  switch (typeb) {
480  case CHEB_TYPE :
482  break ;
483  case LEG_TYPE :
485  break ;
486  default:
487  cerr << "Unknown type of base in Val_domain::std_base_y_cart" ;
488  abort() ;
489  }
490 }
491 
493  // recupere le type :
494  int typeb = zone->get_type_base() ;
495  switch (typeb) {
496  case CHEB_TYPE :
498  break ;
499  case LEG_TYPE :
501  break ;
502  default:
503  cerr << "Unknown type of base in Val_domain::std_base_z_cart" ;
504  abort() ;
505  }
506 }
507 
509  // recupere le type :
510  int typeb = zone->get_type_base() ;
511  switch (typeb) {
512  case CHEB_TYPE :
514  break ;
515  case LEG_TYPE :
517  break ;
518  default:
519  cerr << "Unknown type of base in Val_domain::std_base_r_mtz" ;
520  abort() ;
521  }
522 }
523 
525  // recupere le type :
526  int typeb = zone->get_type_base() ;
527  switch (typeb) {
528  case CHEB_TYPE :
530  break ;
531  case LEG_TYPE :
533  break ;
534  default:
535  cerr << "Unknown type of base in Val_domain::std_base_t_mtz" ;
536  abort() ;
537  }
538 }
539 
541  // recupere le type :
542  int typeb = zone->get_type_base() ;
543  switch (typeb) {
544  case CHEB_TYPE :
546  break ;
547  case LEG_TYPE :
549  break ;
550  default:
551  cerr << "Unknown type of base in Val_domain::std_base_p_mtz" ;
552  abort() ;
553  }
554 }
555 
556 
558  // recupere le type :
559  int typeb = zone->get_type_base() ;
560  switch (typeb) {
561  case CHEB_TYPE :
563  break ;
564  case LEG_TYPE :
566  break ;
567  default:
568  cerr << "Unknown type of base in Val_domain::std_xodd_base" ;
569  abort() ;
570  }
571 }
572 
574  // recupere le type :
575  int typeb = zone->get_type_base() ;
576  switch (typeb) {
577  case CHEB_TYPE :
579  break ;
580  case LEG_TYPE :
582  break ;
583  default:
584  cerr << "Unknown type of base in Val_domain::std_todd_base" ;
585  abort() ;
586  }
587 }
588 
590  // recupere le type :
591  int typeb = zone->get_type_base() ;
592  switch (typeb) {
593  case CHEB_TYPE :
595  break ;
596  case LEG_TYPE :
598  break ;
599  default:
600  cerr << "Unknown type of base in Val_domain::std_xodd_todd_base" ;
601  abort() ;
602  }
603 }
604 
606  // recupere le type :
607  int typeb = zone->get_type_base() ;
608  switch (typeb) {
609  case CHEB_TYPE :
611  break ;
612  case LEG_TYPE :
614  break ;
615  default:
616  cerr << "Unknown type of base in Val_domain::std_base_odd" ;
617  abort() ;
618  }
619 }
620 
621 
622 void Val_domain::coef() const {
623  if ((!in_coef) && (!is_zero)) {
624 #ifndef REMOVE_ALL_CHECKS
625  if (base.is_def()==false) {
626  cout << "Base not defined in Val_domain::coef" << endl ;
627  abort() ;
628  }
629 #endif
630  assert(in_conf) ;
631  if (cf !=nullptr) delete cf ;
632  cf = new Array<double>(base.coef(zone->get_nbr_coefs(), *c)) ;
633  in_coef = true ;
634  }
635 }
636 
637 void Val_domain::coef_i() const {
638  if ((!in_conf) && (!is_zero)) {
639 #ifndef REMOVE_ALL_CHECKS
640  if (base.is_def()==false) {
641  cout << "Base not defined in Val_domain::coef" << endl ;
642  abort() ;
643  }
644 #endif
645  assert(in_coef) ;
646  if (c !=nullptr)
647  delete c ;
649  in_conf = true ;
650  }
651 }
652 
653 ostream& operator<< (ostream& o, const Val_domain& so) {
654 
655  if (so.is_zero)
656  o << "Null Val_domain" << endl ;
657 
658  if (so.in_conf) {
659  o << "Configuration space : " << endl ;
660  o << *so.c<< endl ;
661  }
662 
663  if (so.in_coef) {
664  o << "Coefficient space : " << endl ;
665  o << *so.cf << endl ;
666  }
667  return o ;
668 }
669 
671  assert ((var>0) && (var<=zone->get_ndim())) ;
672  if (is_zero)
673  return *this ;
674  else {
675  if (p_der_var[var-1] == nullptr)
676  compute_der_var() ;
677  return *p_der_var[var-1] ;
678  }
679 }
680 
682 {
683  assert ((var>=0) && (var<=zone->get_ndim())) ;
684  if (var == 0)
685  {
686  Val_domain zero(get_domain());
687  zero = 0.0;
688  return zero;
689  }
690  if (is_zero)
691  return *this ;
692  else {
693  if (p_der_abs[var-1] == nullptr)
694  compute_der_abs() ;
695  return *p_der_abs[var-1] ;
696  }
697 }
698 
700 {
701  assert ( (var > 0 ) and ( var <= zone->get_ndim() ) );
702  if (is_zero)
703  return *this;
704  else
705  {
706  Val_domain zero(zone);
707  zero = 0.0;
708  if (var == 0)
709  return zero;
710  else if (var == 1)
711  return this->der_r();
712  else if (var == 2)
713  return this->der_t();
714  else if (var == 3)
715  return this->der_p();
716 #ifndef REMOVE_ALL_CHECKS
717  else
718  {
719  cerr << "bad index in der_spher" << endl;
720  abort();
721  }
722 #endif
723  }
724 }
725 
727  return zone->der_r (*this) ;
728 }
729 
731  return zone->der_t (*this) ;
732 }
733 
735  return zone->der_p (*this) ;
736 }
737 
738 
740  return zone->der_r_rtwo (*this) ;
741 }
742 
744  if (is_zero)
745  return *this ;
746  else
747  return zone->div_r (*this) ;
748 }
749 
751  if (is_zero)
752  return *this ;
753  else
754  return zone->mult_r (*this) ;
755 }
756 double Val_domain::integrale() const {
757  if (is_zero)
758  return 0. ;
759  else
760  return zone->integrale(*this) ;
761 }
762 
763 double Val_domain::integ_volume() const {
764  if (is_zero)
765  return 0. ;
766  else
767  return zone->integ_volume(*this) ;
768 }
769 
770 int der_1d (int, Array<double>&) ;
772  coef() ;
773  for (int var=0 ; var<zone->get_ndim() ; var++) {
774  Val_domain res(zone) ;
775  res.base = base ;
776  res.cf = new Array<double>{base.ope_1d(der_1d, var, *cf, res.base)} ;
777  res.in_coef = true ;
778  safe_delete(p_der_var[var]);
779  p_der_var[var] = new Val_domain{res} ;
780  }
781 }
782 
784  for (int i=0 ; i<zone->get_ndim() ; i++)
785  if (p_der_var[i]==nullptr)
786  compute_der_var() ;
787  zone->do_der_abs_from_der_var(p_der_var.get_data(), p_der_abs.set_data()) ;
788 }
789 
790 }
791 
reference set(const Index &pos)
Read/write of an element.
Definition: array.hpp:186
void save(FILE *fd, Array_ordering order=last_index) const
Save in a file.
Definition: array.hpp:502
void save(FILE *) const
Saving function.
Array< double > coef(const Dim_array &nbr_coefs, const Array< double > &so) const
Definition: coef.cpp:96
Array< double > coef_i(const Dim_array &nbr_points, const Array< double > &so) const
Definition: coef_i.cpp:96
void set_non_def()
Sets all the basis to the undefined state.
Array< double > ope_1d(int(*function)(int, Array< double > &), int var, const Array< double > &so, Base_spectral &base) const
One-dimensional operator acting in the coefficient space.
Definition: ope_1d.cpp:26
Abstract class that implements the fonctionnalities common to all the type of domains.
Definition: space.hpp:60
virtual void set_legendre_base_odd(Base_spectral &so) const
Gives the base using odd Legendre polynomials$.
Definition: domain.cpp:1164
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 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 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
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
Dim_array const & get_nbr_coefs() const
Returns the number of coefficients.
Definition: space.hpp:94
virtual Val_domain der_r(const Val_domain &so) const
Compute the radial derivative of a scalar field.
Definition: domain.cpp:1429
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 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 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 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 Val_domain div_r(const Val_domain &so) const
Division by .
Definition: domain.cpp:1339
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
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 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 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
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
Dim_array const & get_nbr_points() const
Returns the number of points.
Definition: space.hpp:92
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 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 void set_legendre_base_with_m(Base_spectral &so, int m) const
Gives the stnadard base using Legendre polynomials.
Definition: domain.cpp:1018
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 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 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 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 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 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 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
int get_type_base() const
Returns the type of the basis.
Definition: space.hpp:98
virtual void set_cheb_base_odd(Base_spectral &so) const
Gives the base using odd Chebyshev polynomials$.
Definition: domain.cpp:1158
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 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 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 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 void set_legendre_base(Base_spectral &so) const
Gives the standard base for Legendre polynomials.
Definition: domain.cpp:983
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 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 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 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
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 void set_cheb_base_with_m(Base_spectral &so, int m) const
Gives the standard base using Chebyshev polynomials.
Definition: domain.cpp:1012
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 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
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Definition: val_domain.hpp:69
double operator()(const Index &pos) const
Read only value of the field in the configuration space.
Definition: val_domain.cpp:192
void std_base_r_spher()
Sets the basis for the radial component of a vector in orthonormal spherical coordinates.
Definition: val_domain.cpp:412
void std_base_p_mtz()
Sets the basis for the component of a vector in orthonormal coordinates in the MTZ context.
Definition: val_domain.cpp:540
Base_spectral base
Spectral basis of the field.
Definition: val_domain.hpp:72
void set_in_conf()
Destroys the values in the coefficient space.
Definition: val_domain.cpp:197
void std_todd_base()
Sets the basis for an odd function in (Critic case).
Definition: val_domain.cpp:573
void std_base_t_mtz()
Sets the basis for the component of a vector in orthonormal coordinates in the MTZ context.
Definition: val_domain.cpp:524
void operator=(const Val_domain &)
Assignement to another Val_domain.
Definition: val_domain.cpp:130
void save(FILE *) const
Saving on a file.
Definition: val_domain.cpp:110
void set_in_coef()
Destroys the values in the configuration space.
Definition: val_domain.cpp:203
double & set_coef(const Index &pos)
Read/write the value of the field in the coefficient space.
Definition: val_domain.cpp:177
void swap(Val_domain &so) noexcept
Swaps the content with the source.
Definition: val_domain.cpp:47
void set_zero()
Sets the Val_domain to zero (logical state to zero and arrays destroyed).
Definition: val_domain.cpp:223
double integrale() const
Definition: val_domain.cpp:756
void std_base_y_cart()
Sets the basis for the Y-component of a vector in Cartesian coordinates.
Definition: val_domain.cpp:476
Val_domain div_r() const
Division by the radius.
Definition: val_domain.cpp:743
void allocate_coef()
Allocates the values in the coefficient space and destroys the values in the configuration space.
Definition: val_domain.cpp:216
void std_base_tp_spher()
Sets the basis for the component of a 2-tensor in orthonormal spherical coordinates.
Definition: val_domain.cpp:356
Val_domain der_r() const
Definition: val_domain.cpp:726
bool in_conf
Is the field known in the configuration space ?
Definition: val_domain.hpp:78
void compute_der_abs() const
Computes the derivatives with respect to the absolute Cartesian coordinates.
Definition: val_domain.cpp:783
void std_base_xy_cart()
Sets the basis for the XY component of a 2-tensor in Cartesian coordinates.
Definition: val_domain.cpp:370
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
Definition: val_domain.hpp:77
void del_deriv() const
Delete the derived quantities.
Definition: val_domain.cpp:124
void std_r_base()
Sets the basis for the radius.
Definition: val_domain.cpp:262
void coef_i() const
Computes the values in the configuration space.
Definition: val_domain.cpp:637
void std_base_x_cart()
Sets the basis for the X-component of a vector in Cartesian coordinates.
Definition: val_domain.cpp:460
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
Definition: val_domain.cpp:171
void std_base_xz_cart()
Sets the basis for the XZ component of a 2-tensor in Cartesian coordinates.
Definition: val_domain.cpp:384
void std_xodd_base()
Sets the basis for an odd function in (Critic case).
Definition: val_domain.cpp:557
bool is_zero
Indicator used for null fields (for speed issues).
Definition: val_domain.hpp:74
void std_base()
Sets the standard basis of decomposition.
Definition: val_domain.cpp:246
~Val_domain()
Destructor.
Definition: val_domain.cpp:102
void std_base_yz_cart()
Sets the basis for the YZ component of a 2-tensor in Cartesian coordinates.
Definition: val_domain.cpp:398
Val_domain der_t() const
Definition: val_domain.cpp:730
Val_domain der_r_rtwo() const
Definition: val_domain.cpp:739
bool in_coef
Is the field known in the coefficient space ?
Definition: val_domain.hpp:79
void coef() const
Computes the coefficients.
Definition: val_domain.cpp:622
Val_domain der_var(int i) const
Computes the derivative with respect to a numerical coordinate.
Definition: val_domain.cpp:670
Memory_mapped_array< Val_domain * > p_der_var
Pointers on the derivatives of the field with respect to the numerical coordinates.
Definition: val_domain.hpp:81
double integ_volume() const
Definition: val_domain.cpp:763
void std_base_z_cart()
Sets the basis for the Z-component of a vector in Cartesian coordinates.
Definition: val_domain.cpp:492
void annule_hard_coef()
Sets all the arrays to zero in the coefficient space (the logical state is NOT set to zero).
Definition: val_domain.cpp:165
Val_domain mult_r() const
Multiplication by the radius.
Definition: val_domain.cpp:750
void std_base_t_spher()
Sets the basis for the component of a vector in orthonormal spherical coordinates.
Definition: val_domain.cpp:428
void std_anti_base()
Sets the standard, anti-symetric, basis of decomposition.
Definition: val_domain.cpp:279
Array< double > get_coef() const
Definition: val_domain.hpp:136
void std_base_r_mtz()
Sets the basis for the radial component of a vector in orthonormal coordinates in the MTZ context.
Definition: val_domain.cpp:508
void std_base_p_spher()
Sets the basis for the component of a vector in orthonormal spherical coordinates.
Definition: val_domain.cpp:444
void std_xodd_todd_base()
Sets the basis for an odd function in and (Critic case).
Definition: val_domain.cpp:589
Array< double > * c
Pointer on the Array of the values in the configuration space.
Definition: val_domain.hpp:76
Val_domain der_spher(int i) const
Computes the derivative with respect to the spherical coordinates (if defined).
Definition: val_domain.cpp:699
Memory_mapped_array< Val_domain * > p_der_abs
Pointers on the derivatives of the field with respect to the absolute Cartesian coordinates.
Definition: val_domain.hpp:82
void std_base_odd()
Sets the basis in odd polynomials.
Definition: val_domain.cpp:605
void std_base_rp_spher()
Sets the basis for the component of a 2-tensor in orthonormal spherical coordinates.
Definition: val_domain.cpp:342
Val_domain(const Domain *so)
Constructor from a Domain.
Definition: val_domain.cpp:23
Val_domain der_abs(int i) const
Computes the derivative with respect to an absolute coordinate (typically Cartesian).
Definition: val_domain.cpp:681
void annule_hard()
Sets all the arrays to zero (the logical state is NOT set to zero).
Definition: val_domain.cpp:159
void compute_der_var() const
Computes the derivatives with respect to the numerical coordinates.
Definition: val_domain.cpp:771
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.
Definition: val_domain.cpp:209
const Domain * get_domain() const
Definition: val_domain.hpp:111
Val_domain der_p() const
Definition: val_domain.cpp:734
void std_base_rt_spher()
Sets the basis for the component of a 2-tensor in orthonormal spherical coordinates.
Definition: val_domain.cpp:328
const Domain * zone
Pointer to the associated Domain.
Definition: val_domain.hpp:71