KADATH
domain_fourD_periodic_shell.cpp
1 /*
2  Copyright 2017 Philippe Grandclement
3 
4  This file is part of Kadath.
5 
6  Kadath is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Kadath is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Kadath. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "headcpp.hpp"
21 #include "utilities.hpp"
22 #include "fourD_periodic.hpp"
23 #include "point.hpp"
24 #include "array_math.hpp"
25 #include "term_eq.hpp"
26 #include "val_domain.hpp"
27 #include "term_eq.hpp"
28 #include "scalar.hpp"
29 #include "tensor_impl.hpp"
30 
31 namespace Kadath {
32 void coef_1d (int, Array<double>&) ;
33 void coef_i_1d (int, Array<double>&) ;
34 int der_1d (int, Array<double>&) ;
35 
36 // Standard constructor
37 Domain_fourD_periodic_shell::Domain_fourD_periodic_shell (int num, int ttype, double rin, double rout, double oome, const Dim_array& nbr) :
38  Domain(num, ttype, nbr), alpha((rout-rin)/2.), beta ((rout+rin)/2.), ome(oome), type_time(TO_PI) {
39  assert (nbr.get_ndim()==4) ;
40  switch (type_time) {
41  case TO_PI :
42  maxt = M_PI ;
43  break ;
44  default:
45  cerr << "Unknown case for type_time" << endl ;
46  abort() ;
47  }
48  do_coloc() ;
49 }
50 
51 // Constructor by copy
52 Domain_fourD_periodic_shell::Domain_fourD_periodic_shell (const Domain_fourD_periodic_shell& so) : Domain(so), alpha(so.alpha), beta(so.beta), ome(so.ome),
53  type_time(so.type_time), maxt(so.maxt) {
54 }
55 
57  fread_be (&alpha, sizeof(double), 1, fd) ;
58  fread_be (&beta, sizeof(double), 1, fd) ;
59  fread_be (&ome, sizeof(double), 1, fd) ;
60  fread_be (&type_time, sizeof(int), 1, fd) ;
61  switch (type_time) {
62  case TO_PI :
63  maxt = M_PI ;
64  break ;
65  default:
66  cerr << "Unknown case for type_time" << endl ;
67  abort() ;
68  }
69  do_coloc() ;
70 }
71 
72 // Destructor
73 Domain_fourD_periodic_shell::~Domain_fourD_periodic_shell() {
74 }
75 
76 void Domain_fourD_periodic_shell::save (FILE* fd) const {
77  nbr_points.save(fd) ;
78  nbr_coefs.save(fd) ;
79  fwrite_be (&ndim, sizeof(int), 1, fd) ;
80  fwrite_be (&type_base, sizeof(int), 1, fd) ;
81  fwrite_be (&alpha, sizeof(double), 1, fd) ;
82  fwrite_be (&beta, sizeof(double), 1, fd) ;
83  fwrite_be (&ome, sizeof(double), 1, fd) ;
84  fwrite_be (&type_time, sizeof(int), 1, fd) ;
85 }
86 
87 ostream& Domain_fourD_periodic_shell::print (ostream& o) const {
88  o << "fourD_periodic shell" << endl ;
89  o << "time goes to " << maxt << endl ;
90  o << beta-alpha << " < r < " << beta+alpha << endl ;
91  o << "Omega = " << ome << endl ;
92  o << "Nbr pts = " << nbr_points << endl ;
93  o << endl ;
94  return o ;
95 }
96 
97 // Computes the cartesian coordinates
99  for (int i=0 ; i<4 ; i++)
100  assert (coloc[i] != 0x0) ;
101  for (int i=0 ; i<4 ; i++)
102  assert (absol[i] == 0x0) ;
103  for (int i=0 ; i<4 ; i++) {
104  absol[i] = new Val_domain(this) ;
105  absol[i]->allocate_conf() ;
106  }
107  Index index (nbr_points) ;
108  do {
109 
110  absol[0]->set(index) = (alpha* ((*coloc[0])(index(0))) +beta)*
111  sin((*coloc[1])(index(1)))*cos((*coloc[2])(index(2))) ; //xx
112  absol[1]->set(index) = (alpha* ((*coloc[0])(index(0))) +beta) *
113  sin((*coloc[1])(index(1)))*sin((*coloc[2])(index(2))) ; //yy
114  absol[2]->set(index) = (alpha* ((*coloc[0])(index(0))) + beta) * cos((*coloc[1])(index(1))) ; //zz
115  absol[3]->set(index) = (*coloc[3])(index(3)) / ome ; // time
116  }
117  while (index.inc()) ;
118 
119 }
120 
122  for (int i=0 ; i<4 ; i++)
123  assert (coloc[i] != 0x0) ;
124  for (int i=0 ; i<4 ; i++)
125  assert (cart[i] == 0x0) ;
126  for (int i=0 ; i<4 ; i++) {
127  cart[i] = new Val_domain(this) ;
128  cart[i]->allocate_conf() ;
129  }
130  Index index (nbr_points) ;
131  do {
132 
133  cart[0]->set(index) = (alpha* ((*coloc[0])(index(0))) +beta)*
134  sin((*coloc[1])(index(1)))*cos((*coloc[2])(index(2))) ; //xx
135  cart[1]->set(index) = (alpha* ((*coloc[0])(index(0))) +beta) *
136  sin((*coloc[1])(index(1)))*sin((*coloc[2])(index(2))) ; //yy
137  cart[2]->set(index) = (alpha* ((*coloc[0])(index(0))) + beta) * cos((*coloc[1])(index(1))) ; //zz
138  cart[3]->set(index) = (*coloc[3])(index(3)) / ome ; // time
139  }
140  while (index.inc()) ;
141 
142  // Put base for x and y
143  switch (type_base) {
144  case CHEB_TYPE:
145  set_cheb_base_x_cart(cart[0]->set_base()) ;
146  set_cheb_base_y_cart(cart[1]->set_base()) ;
147  break ;
148  case LEG_TYPE:
149  set_legendre_base_x_cart(cart[0]->set_base()) ;
150  set_legendre_base_y_cart(cart[1]->set_base()) ;
151  break ;
152  default :
153  cerr << "Unknown type of basis in Domain_fourD_periodic_shell::do_cart" << endl ;
154  abort() ;
155  }
156 
157 }
158 
159 // Computes the radius
161 
162  for (int i=0 ; i<4 ; i++)
163  assert (coloc[i] != 0x0) ;
164  assert (radius == 0x0) ;
165  radius = new Val_domain(this) ;
166  radius->allocate_conf() ;
167  Index index (nbr_points) ;
168  do
169  radius->set(index) = alpha* ((*coloc[0])(index(0))) + beta ;
170  while (index.inc()) ;
171 }
172 
173 
174 // Is a point inside this domain ?
175 bool Domain_fourD_periodic_shell::is_in (const Point& xx, double prec) const {
176 
177  assert (xx.get_ndim()==4) ;
178 
179  double x_loc = xx(1) ;
180  double y_loc = xx(2) ;
181  double z_loc = xx(3) ;
182  double air_loc = sqrt (x_loc*x_loc + y_loc*y_loc + z_loc*z_loc) ;
183 
184  bool res = ((air_loc <= alpha+beta+prec) && (air_loc >= beta-alpha-prec)) ? true : false ;
185 
186  if ((xx(4)<0-prec) || (xx(4)>maxt/ome + prec))
187  res = false ;
188 
189  return res ;
190 }
191 
192 // Convert absolute coordinates to numerical ones
194 
195  assert (is_in(abs)) ;
196  Point num(4) ;
197 
198  double x_loc = abs(1) ;
199  double y_loc = abs(2) ;
200  double z_loc = abs(3) ;
201  double air = sqrt(x_loc*x_loc+y_loc*y_loc+z_loc*z_loc) ;
202  num.set(1) = (air-beta)/alpha ;
203  double rho = sqrt(x_loc*x_loc+y_loc*y_loc) ;
204 
205  if (rho==0) {
206  // On the axis ?
207  num.set(2) = (z_loc>=0) ? 0 : M_PI ;
208  num.set(3) = 0 ;
209  }
210  else {
211  num.set(2) = atan(rho/z_loc) ;
212  num.set(3) = atan2 (y_loc, x_loc) ;
213  }
214 
215  if (num(2) <0)
216  num.set(2) = M_PI + num(2) ;
217 
218  num.set(4) = abs(4)*ome ;
219 
220  return num ;
221 }
222 
223 double coloc_leg(int, int) ;
225 
226  switch (type_base) {
227  case CHEB_TYPE:
229  nbr_coefs.set(2) += 2 ;
230  del_deriv() ;
231  for (int i=0 ; i<ndim ; i++)
232  coloc[i] = new Array<double> (nbr_points(i)) ;
233  for (int i=0 ; i<nbr_points(0) ; i++)
234  coloc[0]->set(i) = -cos(M_PI*i/(nbr_points(0)-1)) ;
235  for (int j=0 ; j<nbr_points(1) ; j++)
236  coloc[1]->set(j) = M_PI/2.*j/(nbr_points(1)-1) ;
237  for (int k=0 ; k<nbr_points(2) ; k++)
238  coloc[2]->set(k) = M_PI*2.*k/nbr_points(2) ;
239  for (int l=0 ; l<nbr_points(3) ; l++)
240  coloc[3]->set(l) = maxt*l/(nbr_points(3)-1) ;
241  break ;
242  case LEG_TYPE:
244  nbr_coefs.set(2) += 2 ;
245  del_deriv() ;
246  for (int i=0 ; i<ndim ; i++)
247  coloc[i] = new Array<double> (nbr_points(i)) ;
248  for (int i=0 ; i<ndim ; i++)
249  coloc[i] = new Array<double> (nbr_points(i)) ;
250  for (int i=0 ; i<nbr_points(0) ; i++)
251  coloc[0]->set(i) = coloc_leg(i, nbr_points(0)) ;
252  for (int j=0 ; j<nbr_points(1) ; j++)
253  coloc[1]->set(j) = M_PI/2.*j/(nbr_points(1)-1) ;
254  for (int k=0 ; k<nbr_points(2) ; k++)
255  coloc[2]->set(k) = M_PI*2.*k/nbr_points(2) ;
256  for (int l=0 ; l<nbr_points(3) ; l++)
257  coloc[3]->set(l) = maxt*l/(nbr_points(3)-1) ;
258  break ;
259  default :
260  cerr << "Unknown type of basis in Domain_fourD_periodic_shell::do_coloc" << endl ;
261  abort() ;
262  }
263 }
264 
265 
267 
268  assert (type_base == CHEB_TYPE) ;
269  base.allocate(nbr_coefs) ;
270 
271  base.def =true ;
272  // Time
273  base.bases_1d[3]->set(0) = COS ;
274 
275  for (int l=0 ; l<nbr_coefs(3) ; l++) {
276  // Phi
277  base.bases_1d[2]->set(l) = COSSIN ;
278  for (int k=0 ; k<nbr_coefs(2) ; k++) {
279  // Theta
280  base.bases_1d[1]->set(k, l) = SIN_ODD ;
281  for (int j=0 ; j<nbr_coefs(1) ; j++)
282  // r
283  base.bases_1d[0]->set(j, k, l) = CHEB ;
284  }
285  }
286 }
287 
288 
290 
291  assert (type_base == CHEB_TYPE) ;
292  base.allocate(nbr_coefs) ;
293 
294  base.def =true ;
295  // Time
296  base.bases_1d[3]->set(0) = COS ;
297 
298  for (int l=0 ; l<nbr_coefs(3) ; l++) {
299  // Phi
300  base.bases_1d[2]->set(l) = COSSIN ;
301  for (int k=0 ; k<nbr_coefs(2) ; k++) {
302  // Theta
303  base.bases_1d[1]->set(k, l) = SIN_ODD ;
304  for (int j=0 ; j<nbr_coefs(1) ; j++)
305  // r
306  base.bases_1d[0]->set(j, k, l) = CHEB ;
307  }
308  }
309 }
310 
312 
313  assert (type_base == LEG_TYPE) ;
314  base.allocate(nbr_coefs) ;
315 
316  base.def =true ;
317  // Time
318  base.bases_1d[3]->set(0) = COS ;
319 
320  for (int l=0 ; l<nbr_coefs(3) ; l++) {
321  // Phi
322  base.bases_1d[2]->set(l) = COSSIN ;
323  for (int k=0 ; k<nbr_coefs(2) ; k++) {
324  // Theta
325  base.bases_1d[1]->set(k, l) = SIN_ODD ;
326  for (int j=0 ; j<nbr_coefs(1) ; j++)
327  // r
328  base.bases_1d[0]->set(j, k, l) = LEG ;
329  }
330  }
331 }
332 
333 
335 
336  assert (type_base == LEG_TYPE) ;
337  base.allocate(nbr_coefs) ;
338 
339  base.def =true ;
340  // Time
341  base.bases_1d[3]->set(0) = COS ;
342 
343  for (int l=0 ; l<nbr_coefs(3) ; l++) {
344  // Phi
345  base.bases_1d[2]->set(l) = COSSIN ;
346  for (int k=0 ; k<nbr_coefs(2) ; k++) {
347  // Theta
348  base.bases_1d[1]->set(k, l) = SIN_ODD ;
349  for (int j=0 ; j<nbr_coefs(1) ; j++)
350  // r
351  base.bases_1d[0]->set(j, k, l) = LEG ;
352  }
353  }
354 }
355 
356 
357 
358 // Computes the derivatives with respect to rho,Z as a function of the numerical ones.
359 void Domain_fourD_periodic_shell::do_der_abs_from_der_var(const Val_domain *const *const der_var, Val_domain **const der_abs) const {
360 
361  // d/dx :
362  Val_domain sintdr (der_var[0]->mult_sin_theta()/alpha) ;
363  Val_domain dtsr (*der_var[1]/get_radius()) ;
364  dtsr.set_base() = der_var[1]->get_base() ;
365  Val_domain dpsr (*der_var[2]/get_radius()) ;
366  dpsr.set_base() = der_var[2]->get_base() ;
367  Val_domain costdtsr (dtsr.mult_cos_theta()) ;
368 
369  Val_domain dpsrssint (dpsr.div_sin_theta()) ;
370  der_abs[0] = new Val_domain ((sintdr+costdtsr).mult_cos_phi() - dpsrssint.mult_sin_phi()) ;
371 
372  // d/dy :
373  der_abs[1] = new Val_domain ((sintdr+costdtsr).mult_sin_phi() + dpsrssint.mult_cos_phi()) ;
374  // d/dz :
375  der_abs[2] = new Val_domain (der_var[0]->mult_cos_theta()/alpha - dtsr.mult_sin_theta()) ;
376 
377  // d/dt :
378  der_abs[3] = new Val_domain (*der_var[3]*ome) ;
379 }
380 
381 // Rules for the multiplication of two basis.
383 
384  assert (a.ndim==4) ;
385  assert (b.ndim==4) ;
386 
387  Base_spectral res(4) ;
388  bool res_def = true ;
389 
390  if (!a.def)
391  res_def=false ;
392  if (!b.def)
393  res_def=false ;
394 
395  if (res_def) {
396 
397 
398  // Bases in time :
399  res.bases_1d[3] = new Array<int> (a.bases_1d[3]->get_dimensions()) ;
400  switch ((*a.bases_1d[3])(0)) {
401  case COS:
402  switch ((*b.bases_1d[3])(0)) {
403  case COS:
404  res.bases_1d[3]->set(0) = COS ;
405  break ;
406  case SIN:
407  res.bases_1d[3]->set(0) = SIN ;
408  break ;
409  default:
410  res_def = false ;
411  break ;
412  }
413  break ;
414  case SIN:
415  switch ((*b.bases_1d[3])(0)) {
416  case COS:
417  res.bases_1d[3]->set(0) = SIN ;
418  break ;
419  case SIN:
420  res.bases_1d[3]->set(0) = COS ;
421  break ;
422  default:
423  res_def = false ;
424  break ;
425  }
426  break ;
427  }
428 
429  // Base in phi :
430  Index index_2 (a.bases_1d[2]->get_dimensions()) ;
431  res.bases_1d[2] = new Array<int> (a.bases_1d[2]->get_dimensions()) ;
432  do {
433  switch ((*a.bases_1d[2])(index_2)) {
434  case COSSIN:
435  switch ((*b.bases_1d[2])(index_2)) {
436  case COSSIN:
437  res.bases_1d[2]->set(index_2) = COSSIN ;
438  break ;
439  default:
440  res_def = false ;
441  break ;
442  }
443  break ;
444  default:
445  res_def = false ;
446  break ;
447  }
448  } while (index_2.inc()) ;
449 
450  // Bases in theta :
451  Index index_1 (a.bases_1d[1]->get_dimensions()) ;
452  res.bases_1d[1] = new Array<int> (a.bases_1d[1]->get_dimensions()) ;
453  do {
454  switch ((*a.bases_1d[1])(index_1)) {
455  case COS_EVEN:
456  switch ((*b.bases_1d[1])(index_1)) {
457  case COS_EVEN:
458  res.bases_1d[1]->set(index_1) = COS_EVEN ;
459  break ;
460  case COS_ODD:
461  res.bases_1d[1]->set(index_1) = COS_ODD ;
462  break ;
463  case SIN_EVEN:
464  res.bases_1d[1]->set(index_1) = SIN_EVEN ;
465  break ;
466  case SIN_ODD:
467  res.bases_1d[1]->set(index_1) = SIN_ODD ;
468  break ;
469  default:
470  res_def = false ;
471  break ;
472  }
473  break ;
474  case COS_ODD:
475  switch ((*b.bases_1d[1])(index_1)) {
476  case COS_EVEN:
477  res.bases_1d[1]->set(index_1) = COS_ODD ;
478  break ;
479  case COS_ODD:
480  res.bases_1d[1]->set(index_1) = COS_EVEN ;
481  break ;
482  case SIN_EVEN:
483  res.bases_1d[1]->set(index_1) = SIN_ODD ;
484  break ;
485  case SIN_ODD:
486  res.bases_1d[1]->set(index_1) = SIN_EVEN ;
487  break ;
488  default:
489  res_def = false ;
490  break ;
491  }
492  break ;
493  case SIN_EVEN:
494  switch ((*b.bases_1d[1])(index_1)) {
495  case COS_EVEN:
496  res.bases_1d[1]->set(index_1) = SIN_EVEN ;
497  break ;
498  case COS_ODD:
499  res.bases_1d[1]->set(index_1) = SIN_ODD ;
500  break ;
501  case SIN_EVEN:
502  res.bases_1d[1]->set(index_1) = COS_EVEN ;
503  break ;
504  case SIN_ODD:
505  res.bases_1d[1]->set(index_1) = COS_ODD ;
506  break ;
507  default:
508  res_def = false ;
509  break ;
510  }
511  break ;
512  case SIN_ODD:
513  switch ((*b.bases_1d[1])(index_1)) {
514  case COS_EVEN:
515  res.bases_1d[1]->set(index_1) = SIN_ODD ;
516  break ;
517  case COS_ODD:
518  res.bases_1d[1]->set(index_1) = SIN_EVEN ;
519  break ;
520  case SIN_EVEN:
521  res.bases_1d[1]->set(index_1) = COS_ODD ;
522  break ;
523  case SIN_ODD:
524  res.bases_1d[1]->set(index_1) = COS_EVEN ;
525  break ;
526  default:
527  res_def = false ;
528  break ;
529  }
530  break ;
531  default:
532  res_def = false ;
533  break ;
534  }
535  }
536  while (index_1.inc()) ;
537 
538 
539  // Base in r :
540  Index index_0 (a.bases_1d[0]->get_dimensions()) ;
541  res.bases_1d[0] = new Array<int> (a.bases_1d[0]->get_dimensions()) ;
542  do {
543  switch ((*a.bases_1d[0])(index_0)) {
544  case CHEB:
545  switch ((*b.bases_1d[0])(index_0)) {
546  case CHEB:
547  res.bases_1d[0]->set(index_0) = CHEB ;
548  break ;
549  default:
550  res_def = false ;
551  break ;
552  }
553  break ;
554  case LEG:
555  switch ((*b.bases_1d[0])(index_0)) {
556  case LEG:
557  res.bases_1d[0]->set(index_0) = LEG ;
558  break ;
559  default:
560  res_def = false ;
561  break ;
562  }
563  break ;
564  default:
565  res_def = false ;
566  break ;
567  }
568  }
569  while (index_0.inc()) ;
570  }
571 
572 
573  if (!res_def)
574  for (int dim=0 ; dim<a.ndim ; dim++)
575  if (res.bases_1d[dim]!= 0x0) {
576  delete res.bases_1d[dim] ;
577  res.bases_1d[dim] = 0x0 ;
578  }
579  res.def = res_def ;
580  return res ;
581 }
582 
583 
585 
586  Val_domain res(this) ;
587 
588  // Construction bases
589  Base_spectral base (4) ;
590  base.allocate (get_nbr_coefs()) ;
591 
592  // Time base
593  base.bases_1d[3] = new Array<int> (1) ;
594  base.bases_1d[3]->set(0) = (*so.get_base().bases_1d[2])(0) ;
595 
596  // Phi base
597  base.bases_1d[2] = new Array<int> (get_nbr_coefs()(3)) ;
598  for (int i=0 ; i<get_nbr_coefs()(3) ; i++)
599  base.bases_1d[2]->set(i) = COSSIN ;
600 
601  // Theta base
602  base.bases_1d[1] = new Array<int> (get_nbr_coefs()(2), get_nbr_coefs()(3)) ;
603  for (int l=0 ; l<get_nbr_coefs()(3) ; l++)
604  for (int k=0 ; k<get_nbr_coefs()(2) ; k++) {
605  base.bases_1d[1]->set(k,l) = (*so.get_base().bases_1d[1])(l) ;
606  }
607 
608  // radial base
609  base.bases_1d[0] = new Array<int> (get_nbr_coefs()(1), get_nbr_coefs()(2), get_nbr_coefs()(3)) ;
610  for (int l=0 ; l<get_nbr_coefs()(3) ; l++)
611  for (int k=0 ; k<get_nbr_coefs()(2) ; k++)
612  for (int j=0 ; j<get_nbr_coefs()(1) ; j++) {
613  base.bases_1d[0]->set(j, k,l) = (*so.get_base().bases_1d[0])(j, l) ;
614  }
615  base.def = true ;
616  res.set_base() = base ;
617 
618  // Now affecte the coefficients
619  so.coef() ;
620  res.annule_hard() ;
621  res.coef() ;
622  Index pso (so.get_domain()->get_nbr_coefs()) ;
623  Index pcf (get_nbr_coefs()) ;
624 
625  do {
626  pcf.set(3) = pso(2) ; // t coef
627  pcf.set(2) = 0. ; // phi coef
628  pcf.set(1) = pso(1) ; // Theta coef
629  pcf.set(0) = pso(0) ; // r coef
630  res.set_coef(pcf) = so.get_coef(pso) ;
631  }
632  while (pso.inc()) ;
633 
634  return res ;
635 
636 }
637 
638 
639 }
Class for storing the basis of decompositions of a field.
Bases_container bases_1d
Arrays containing the various basis of decomposition.
void allocate(const Dim_array &nbr_coefs)
Allocates the various arrays, for a given number of coefficients.
bool def
true if the Base_spectral is defined and false otherwise.
int ndim
Number of dimensions.
Class for storing the dimensions of an array.
Definition: dim_array.hpp:34
int get_ndim() const
Returns the number of dimensions.
Definition: dim_array.hpp:63
int & set(int i)
Read/write of the size of a given dimension.
Definition: dim_array.hpp:54
void save(FILE *) const
Save function.
Definition: dim_array.cpp:32
Class for a spherical shell.
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
double beta
Relates the numerical radius to the physical one.
Domain_fourD_periodic_shell(int num, int ttype, double rin, double rout, double ome, const Dim_array &nbr)
Standard constructor :
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
virtual const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
virtual void do_cart() const
Computes the Cartesian coordinates.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual void do_absol() const
Computes the absolute coordinates.
virtual void save(FILE *) const
Saving function.
virtual void set_legendre_base_y_cart(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual void do_coloc()
Computes the colocation points.
virtual void do_radius() const
Computes the generalized radius.
virtual void set_cheb_base_y_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual Val_domain mult_cos_phi(const Val_domain &) const
Multiplication by .
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
double maxt
Upper bound of which is or .
int type_time
Gives the type of time periodicity.
double alpha
Relates the numerical radius to the physical one.
virtual Val_domain mult_sin_phi(const Val_domain &) const
Multiplication by .
virtual void set_cheb_base_x_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_legendre_base_x_cart(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
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...
Val_domain translate(const Val_domain &so) const
Generates a Val_domain, from another one assumed to be on a Polar_periodic_nucleus.
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
Val_domain * radius
The generalized radius.
Definition: space.hpp:78
Memory_mapped_array< Val_domain * > cart
Cartesian coordinates.
Definition: space.hpp:77
Memory_mapped_array< Val_domain * > absol
Asbolute coordinates (if defined ; usually Cartesian-like)
Definition: space.hpp:76
int ndim
Number of dimensions.
Definition: space.hpp:64
Dim_array const & get_nbr_coefs() const
Returns the number of coefficients.
Definition: space.hpp:94
Dim_array nbr_coefs
Number of coefficients.
Definition: space.hpp:66
Val_domain const & get_radius() const
Returns the generalized radius.
Definition: space.hpp:1465
Dim_array nbr_points
Number of colocation points.
Definition: space.hpp:65
int type_base
Type of colocation point :
Definition: space.hpp:73
Memory_mapped_array< Array< double > * > coloc
Colocation points in each dimension (stored in ndim 1d- arrays)
Definition: space.hpp:75
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
The class Point is used to store the coordinates of a point.
Definition: point.hpp:30
const int & get_ndim() const
Returns the number of dimensions.
Definition: point.hpp:51
double & set(int i)
Read/write of a coordinate.
Definition: point.hpp:47
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Definition: val_domain.hpp:69
Val_domain mult_sin_phi() const
Multiplication by .
double & set_coef(const Index &pos)
Read/write the value of the field in the coefficient space.
Definition: val_domain.cpp:177
Val_domain mult_sin_theta() const
Multiplication by .
Val_domain mult_cos_phi() const
Multiplication by .
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
Definition: val_domain.cpp:171
Val_domain div_sin_theta() const
Division by .
Val_domain mult_cos_theta() const
Multiplication by .
void coef() const
Computes the coefficients.
Definition: val_domain.cpp:622
Base_spectral & set_base()
Sets the basis of decomposition.
Definition: val_domain.hpp:126
Array< double > get_coef() const
Definition: val_domain.hpp:136
void annule_hard()
Sets all the arrays to zero (the logical state is NOT set to zero).
Definition: val_domain.cpp:159
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
const Base_spectral & get_base() const
Returns the basis of decomposition.
Definition: val_domain.hpp:122