KADATH
domain_shell_outer_adapted.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 "adapted.hpp"
23 #include "point.hpp"
24 #include "array_math.hpp"
25 #include "scalar.hpp"
26 #include "tensor_impl.hpp"
27 
28 namespace Kadath {
29 void coef_1d (int, Array<double>&) ;
30 void coef_i_1d (int, Array<double>&) ;
31 int der_1d (int, Array<double>&) ;
32 
33 // Standard constructor
34 Domain_shell_outer_adapted::Domain_shell_outer_adapted (const Space& sss, int num, int ttype, double rin, double rout, const Point& cr, const Dim_array& nbr) :
35  Domain(num, ttype, nbr), sp(sss), inner_radius(rin), center(cr) {
36  assert (nbr.get_ndim()==3) ;
37  assert (cr.get_ndim()==3) ;
38 
39 
40  outer_radius_term_eq = nullptr ;
41  rad_term_eq = nullptr ;
42  der_rad_term_eq = nullptr ;
43  dt_rad_term_eq = nullptr ;
44  dp_rad_term_eq = nullptr ;
45  normal_spher = nullptr ;
46  normal_cart = nullptr ;
47 
48  do_coloc() ;
49  outer_radius = new Val_domain (this) ;
50  *outer_radius = rout ;
52 }
53 
54 Domain_shell_outer_adapted::Domain_shell_outer_adapted (const Space& sss, int num, int ttype, double rin, const Val_domain& rout, const Point& cr, const Dim_array& nbr) :
55  Domain(num, ttype, nbr), sp(sss), inner_radius(rin), center(cr) {
56  assert (nbr.get_ndim()==3) ;
57  assert (cr.get_ndim()==3) ;
58 
59 
60  outer_radius_term_eq = nullptr ;
61  rad_term_eq = nullptr ;
62  der_rad_term_eq = nullptr ;
63  dt_rad_term_eq = nullptr ;
64  dp_rad_term_eq = nullptr ;
65  normal_spher = nullptr ;
66  normal_cart = nullptr ;
67 
68  do_coloc() ;
69  outer_radius = new Val_domain(rout) ;
70 }
71 
72 // Constructor by copy
74  inner_radius (so.inner_radius), center(so.center) {
75 
77  if (so.outer_radius_term_eq != nullptr)
79  if (so.rad_term_eq !=nullptr)
80  rad_term_eq = new Term_eq (*so.rad_term_eq) ;
81  if (so.der_rad_term_eq !=nullptr)
83  if (so.dt_rad_term_eq !=nullptr)
85  if (so.dp_rad_term_eq !=nullptr)
87  if (so.normal_spher !=nullptr)
88  normal_spher = new Term_eq (*so.normal_spher) ;
89  if (so.normal_cart !=nullptr)
90  normal_cart = new Term_eq (*so.normal_cart) ;
91 }
92 
93 Domain_shell_outer_adapted::Domain_shell_outer_adapted (const Space& sss, int num, FILE* fd) : Domain(num, fd), sp(sss), center(fd) {
94  fread_be (&inner_radius, sizeof(double), 1, fd) ;
95  outer_radius = new Val_domain(this, fd) ;
96 
97  outer_radius_term_eq = nullptr ;
98  rad_term_eq = nullptr ;
99  der_rad_term_eq = nullptr ;
100  dt_rad_term_eq = nullptr ;
101  dp_rad_term_eq = nullptr ;
102  normal_spher = nullptr ;
103  normal_cart = nullptr ;
104 
105  do_coloc() ;
106 }
107 
109  for (int i=0 ; i<3 ; i++)
110  assert (coloc[i] != nullptr) ;
111  assert (radius == nullptr) ;
112  radius = new Val_domain(this) ;
113  radius->allocate_conf() ;
114  Index index (nbr_points) ;
115  do
116  radius->set(index) = ((*outer_radius)(index) - inner_radius)/2.* ((*coloc[0])(index(0))) + ((*outer_radius)(index) + inner_radius)/2. ;
117  while (index.inc()) ;
118  radius->std_r_base() ;
119 }
120 
121 // Destructor
122 Domain_shell_outer_adapted::~Domain_shell_outer_adapted() {
123 
124  delete outer_radius ;
125  if (outer_radius_term_eq != nullptr)
126  delete outer_radius_term_eq ;
127  if (rad_term_eq != nullptr)
128  delete rad_term_eq ;
129  if (der_rad_term_eq != nullptr)
130  delete der_rad_term_eq ;
131  if (normal_spher != nullptr)
132  delete normal_spher ;
133  if (normal_cart != nullptr)
134  delete normal_cart ;
135  if (dt_rad_term_eq != nullptr)
136  delete dt_rad_term_eq ;
137  if (dp_rad_term_eq != nullptr)
138  delete dp_rad_term_eq ;
139 }
140 
142  safe_delete(outer_radius_term_eq);
143  safe_delete(rad_term_eq);
144  safe_delete(der_rad_term_eq);
145  safe_delete(normal_spher);
146  safe_delete(normal_cart);
147  safe_delete(dt_rad_term_eq);
148  safe_delete(dp_rad_term_eq);
149 }
151 
152  int res = 0 ;
153  for (int k=0 ; k<nbr_coefs(2) ; k++)
154  if ((k!=1) && (k!=nbr_coefs(2)-1)) {
155  int mm = (k%2==0) ? int(k/2) : int ((k-1)/2) ;
156  int jmax = (mm%2==0) ? nbr_coefs(1) : nbr_coefs(1)-1 ;
157  int jmin = (k>=4) ? 1 : 0 ;
158  for (int j=jmin ; j<jmax ; j++)
159  res ++ ;
160  }
161  return res ;
162 }
163 
165 
166  if (outer_radius_term_eq != nullptr)
167  delete outer_radius_term_eq ;
168  Scalar val (sp) ;
170 
171  outer_radius_term_eq = new Term_eq (num_dom, val) ;
172  update() ;
173 }
174 
175 void Domain_shell_outer_adapted::affecte_coef(int& conte, int cc, bool& found) const {
176 
177  Val_domain auxi (this) ;
178  auxi.std_base() ;
179  auxi.set_in_coef() ;
180  auxi.allocate_coef() ;
181  *auxi.cf = 0 ;
182 
183  found = false ;
184 
185  for (int k=0 ; k<nbr_coefs(2) ; k++)
186  if ((k!=1) && (k!=nbr_coefs(2)-1)) {
187  int mm = (k%2==0) ? int(k/2) : int ((k-1)/2) ;
188  int jmax = (mm%2==0) ? nbr_coefs(1) : nbr_coefs(1)-1 ;
189  int jmin = (k>=4) ? 1 : 0 ;
190  for (int j=jmin ; j<jmax ; j++) {
191  if (conte==cc) {
192  Index pos_cf (nbr_coefs) ;
193  pos_cf.set(0) = 0 ;
194  pos_cf.set(1) = j ;
195  pos_cf.set(2) = k ;
196  auxi.cf->set(pos_cf) = 1 ;
197  if ((jmin==1) && (mm%2==0)) {
198  // Galerkin base COS EVEN
199  pos_cf.set(1) = 0 ;
200  auxi.cf->set(pos_cf) = -1 ;
201  }
202  if ((jmin==1) && (mm%2==1)) {
203  // Galerkin base SIN ODD
204  pos_cf.set(1) = 0 ;
205  auxi.cf->set(pos_cf) = -(2*j+1) ;
206  }
207  found = true ;
208  }
209  conte ++ ;
210  }
211  }
212 
213  if (found) {
214  Scalar auxi_scal (sp) ;
215  auxi_scal.set_domain(num_dom) = auxi ;
216  outer_radius_term_eq->set_der_t(auxi_scal) ;
217  }
218  else {
220  }
221  update() ;
222 }
223 
224 void Domain_shell_outer_adapted::xx_to_vars_from_adapted(Val_domain& new_outer_radius, const Array<double>& xx, int& pos) const {
225 
226  new_outer_radius.allocate_coef() ;
227  *new_outer_radius.cf = 0 ;
228 
229  Index pos_cf (nbr_coefs) ;
230  pos_cf.set(0) = 0 ;
231 
232  for (int k=0 ; k<nbr_coefs(2) ; k++)
233  if ((k!=1) && (k!=nbr_coefs(2)-1)) {
234  pos_cf.set(2) = k ;
235  int mm = (k%2==0) ? int(k/2) : int ((k-1)/2) ;
236  int jmax = (mm%2==0) ? nbr_coefs(1) : nbr_coefs(1)-1 ;
237  int jmin = (k>=4) ? 1 : 0 ;
238  for (int j=jmin ; j<jmax ; j++) {
239  pos_cf.set(1)= j ;
240  new_outer_radius.cf->set(pos_cf) -= xx(pos) ;
241  if ((jmin==1) && (mm%2==0)) {
242  // Galerkin basis COS EVEN
243  pos_cf.set(1) = 0 ;
244  new_outer_radius.cf->set(pos_cf) += xx(pos) ;
245  }
246  if ((jmin==1) && (mm%2==1)) {
247  // Galerkin basis SIN ODD
248  pos_cf.set(1) = 0 ;
249  new_outer_radius.cf->set(pos_cf) += (2*j+1)*xx(pos) ;
250  }
251 
252  pos ++ ;
253  }
254  }
255 
256  new_outer_radius.set_base() = outer_radius->get_base() ;
257 }
258 
260 
261  *outer_radius += cor ;
262  for (int l=0 ; l<ndim ; l++) {
263  if (absol[l] !=nullptr) delete absol[l] ;
264  if (cart[l] !=nullptr) delete cart[l] ;
265  if (cart_surr[l] !=nullptr) delete cart_surr[l] ;
266  absol[l] = nullptr ;
267  cart_surr[l] = nullptr ;
268  cart[l]= nullptr ;
269  }
270  if (radius !=nullptr)
271  delete radius ;
272  radius = nullptr ;
273  update() ;
274 }
275 
277 
278  *outer_radius = cor ;
279  for (int l=0 ; l<ndim ; l++) {
280  if (absol[l] !=nullptr) delete absol[l] ;
281  if (cart[l] !=nullptr) delete cart[l] ;
282  if (cart_surr[l] !=nullptr) delete cart_surr[l] ;
283  absol[l] = nullptr ;
284  cart_surr[l] = nullptr ;
285  cart[l]= nullptr ;
286  }
287  if (radius !=nullptr)
288  delete radius ;
289  radius = nullptr ;
290  vars_to_terms() ;
291 }
292 
293 void Domain_shell_outer_adapted::update_variable (const Val_domain& cor_outer_radius, const Scalar& old, Scalar& res) const {
294 
295  Val_domain dr (old(num_dom).der_r()) ;
296  if (dr.check_if_zero())
297  res.set_domain(num_dom) = 0 ;
298  else {
299 
300  Index pos(nbr_points) ;
302  do {
303  res.set_domain(num_dom).set(pos) = dr(pos) * (1+(*coloc[0])(pos(0))) / 2. ;
304  }
305  while (pos.inc()) ;
306 
307  res.set_domain(num_dom) = cor_outer_radius * res(num_dom) + old(num_dom) ;
308  res.set_domain(num_dom).set_base() = old(num_dom).get_base() ;
309  }
310 }
311 
313 
314  cout << "enter xx_to_ders_from_adapted" << endl ;
315 
316  Val_domain auxi (this) ;
317  auxi.std_base() ;
318  auxi.set_in_coef() ;
319  auxi.allocate_coef() ;
320  *auxi.cf = 0 ;
321 
322  Index pos_cf (nbr_coefs) ;
323  pos_cf.set(0) = 0 ;
324 
325  for (int k=0 ; k<nbr_coefs(2) ; k++)
326  if ((k!=1) && (k!=nbr_coefs(2)-1)) {
327  pos_cf.set(2) = k ;
328  int mm = (k%2==0) ? int(k/2) : int ((k-1)/2) ;
329  int jmax = (mm%2==0) ? nbr_coefs(1) : nbr_coefs(1)-1 ;
330  int jmin = (k>=4) ? 1 : 0 ;
331  for (int j=jmin ; j<jmax ; j++) {
332  pos_cf.set(1)= j ;
333  auxi.cf->set(pos_cf) = xx(pos) ;
334 
335  if ((jmin==1) && (mm%2==0)) {
336  // Galerkin basis COS EVEN
337  pos_cf.set(1) = 0 ;
338  auxi.cf->set(pos_cf) = -xx(pos) ;
339  }
340  if ((jmin==1) && (mm%2==1)) {
341  // Galerkin basis SIN ODD
342  pos_cf.set(1) = 0 ;
343  auxi.cf->set(pos_cf) = -(2*j+1)*xx(pos) ;
344  }
345  pos ++ ;
346  }
347  }
348  Scalar auxi_scal (sp) ;
349  auxi_scal.set_domain(num_dom) = auxi ;
350  outer_radius_term_eq->set_der_t(auxi_scal) ;
351  update() ;
352 }
353 
354 
356 
357  if (rad_term_eq != nullptr)
358  delete rad_term_eq ;
359  if (der_rad_term_eq != nullptr)
360  delete der_rad_term_eq ;
361  if (dt_rad_term_eq != nullptr)
362  delete dt_rad_term_eq ;
363  if (dp_rad_term_eq != nullptr)
364  delete dp_rad_term_eq ;
365 
366  // Computation of rad_term_eq
367  Scalar val_res (sp) ;
368  val_res.set_domain(num_dom).allocate_conf() ;
369  Index index (nbr_points) ;
370  do {
371  val_res.set_domain(num_dom).set(index) = (((*outer_radius_term_eq->val_t)()(num_dom))(index) - inner_radius)/2. * ((*coloc[0])(index(0))) +
372  (((*outer_radius_term_eq->val_t)()(num_dom))(index) + inner_radius)/2. ;
373  }
374  while (index.inc()) ;
375  val_res.set_domain(num_dom).std_r_base() ;
376 
377  bool doder = (outer_radius_term_eq->der_t ==nullptr) ? false : true ;
378  if (doder) {
379  Scalar der_res (sp) ;
380  if ((*outer_radius_term_eq->der_t)()(num_dom).check_if_zero()) {
381  der_res.set_domain(num_dom).set_zero() ;
382  }
383  else {
384  der_res.set_domain(num_dom).allocate_conf() ;
385  index.set_start() ;
386  do {
387  der_res.set_domain(num_dom).set(index) = ((*outer_radius_term_eq->der_t)()(num_dom))(index)/2. * ((*coloc[0])(index(0))) +
388  ((*outer_radius_term_eq->der_t)()(num_dom))(index)/2. ;
389  }
390  while (index.inc()) ;
391  der_res.set_domain(num_dom).std_r_base() ;
392  }
393  rad_term_eq = new Term_eq (num_dom, val_res, der_res) ;
394  }
395  else
396  rad_term_eq = new Term_eq (num_dom, val_res) ;
397 
398  // Computation of der_rad_term_eq which is dr / dxi
399  val_res.set_domain(num_dom) = ((*outer_radius_term_eq->val_t)()(num_dom) - inner_radius) / 2. ;
400  if (doder) {
401  Scalar der_res (sp) ;
402  der_res.set_domain(num_dom) = (*outer_radius_term_eq->der_t)()(num_dom) / 2. ;
403  der_rad_term_eq = new Term_eq (num_dom, val_res, der_res) ;
404  }
405  else
406  der_rad_term_eq = new Term_eq (num_dom, val_res) ;
407 
408  // Computation of dt_rad_term_eq which is dr / d theta
409  val_res.set_domain(num_dom) = (*rad_term_eq->val_t)()(num_dom).der_var(2) ;
410  if (doder) {
411  Scalar der_res (sp) ;
412  der_res.set_domain(num_dom) = (*rad_term_eq->der_t)()(num_dom).der_var(2) ;
413  dt_rad_term_eq = new Term_eq (num_dom, val_res, der_res) ;
414  }
415  else
416  dt_rad_term_eq = new Term_eq (num_dom, val_res) ;
417 
418  // Computation of dt_rad_term_eq which is dr / d phi
419  val_res.set_domain(num_dom) = (*rad_term_eq->val_t)()(num_dom).der_var(3) ;
420  if (doder) {
421  Scalar der_res (sp) ;
422  der_res.set_domain(num_dom) = (*rad_term_eq->der_t)()(num_dom).der_var(3) ;
423  dp_rad_term_eq = new Term_eq (num_dom, val_res, der_res) ;
424  }
425  else
426  dp_rad_term_eq = new Term_eq (num_dom, val_res) ;
427 
428  do_normal_cart() ;
429 }
430 
431 void Domain_shell_outer_adapted::save (FILE* fd) const {
432  nbr_points.save(fd) ;
433  nbr_coefs.save(fd) ;
434  fwrite_be (&ndim, sizeof(int), 1, fd) ;
435  fwrite_be (&type_base, sizeof(int), 1, fd) ;
436  center.save(fd) ;
437  fwrite_be (&inner_radius, sizeof(double), 1, fd) ;
438  outer_radius->save(fd) ;
439 }
440 
441 //ostream& operator<< (ostream& o, const Domain_shell_outer_adapted& so) {
442 ostream& Domain_shell_outer_adapted::print (ostream& o) const {
443  o << "Adapted shell on the outside boundary" << endl ;
444  o << "Center = " << center << endl ;
445  o << "Nbr pts = " << nbr_points << endl ;
446  o << "Inner radius " << inner_radius << endl ;
447  o << "Outer radius " << endl ;
448  o << *outer_radius << endl ;
449  o << endl ;
450  return o ;
451 }
452 
454  cerr << "Domain_shell_outer_adapted::der_normal not implemeted" << endl ;
455  abort() ;
456 }
457 
458 // Computes the cartesian coordinates
460  for (int i=0 ; i<3 ; i++)
461  assert (coloc[i] != nullptr) ;
462  for (int i=0 ; i<3 ; i++)
463  assert (absol[i] == nullptr) ;
464  for (int i=0 ; i<3 ; i++) {
465  absol[i] = new Val_domain(this) ;
466  absol[i]->allocate_conf() ;
467  }
468  Index index (nbr_points) ;
469  do {
470 
471  double rr = ((*outer_radius)(index)-inner_radius)/2. * ((*coloc[0])(index(0))) +
472  ((*outer_radius)(index)+inner_radius)/2. ;
473  absol[0]->set(index) = rr *
474  sin((*coloc[1])(index(1)))*cos((*coloc[2])(index(2))) + center(1);
475  absol[1]->set(index) = rr *
476  sin((*coloc[1])(index(1)))*sin((*coloc[2])(index(2))) + center(2) ;
477  absol[2]->set(index) = rr * cos((*coloc[1])(index(1))) + center(3) ;
478  }
479  while (index.inc()) ;
480 
481 }
482 
483 // Computes the cartesian coordinates
485  for (int i=0 ; i<3 ; i++)
486  assert (coloc[i] != nullptr) ;
487  for (int i=0 ; i<3 ; i++)
488  assert (cart[i] == nullptr) ;
489  for (int i=0 ; i<3 ; i++) {
490  cart[i] = new Val_domain(this) ;
491  cart[i]->allocate_conf() ;
492  }
493  Index index (nbr_points) ;
494  do {
495  double rr = ((*outer_radius)(index)-inner_radius)/2. * ((*coloc[0])(index(0))) +
496  ((*outer_radius)(index)+inner_radius)/2.;
497  cart[0]->set(index) = rr *
498  sin((*coloc[1])(index(1)))*cos((*coloc[2])(index(2))) + center(1);
499  cart[1]->set(index) = rr *
500  sin((*coloc[1])(index(1)))*sin((*coloc[2])(index(2))) + center(2) ;
501  cart[2]->set(index) = rr * cos((*coloc[1])(index(1))) + center(3) ;
502  }
503  while (index.inc()) ;
504 
505 }
506 
507 
508 // Computes the cartesian coordinates over the radius
510  for (int i=0 ; i<3 ; i++)
511  assert (coloc[i] != nullptr) ;
512  for (int i=0 ; i<3 ; i++)
513  assert (cart_surr[i] == nullptr) ;
514  for (int i=0 ; i<3 ; i++) {
515  cart_surr[i] = new Val_domain(this) ;
516  cart_surr[i]->allocate_conf() ;
517  }
518  Index index (nbr_points) ;
519  do {
520  cart_surr[0]->set(index) = sin((*coloc[1])(index(1)))*cos((*coloc[2])(index(2))) ;
521  cart_surr[1]->set(index) = sin((*coloc[1])(index(1)))*sin((*coloc[2])(index(2))) ;
522  cart_surr[2]->set(index) = cos((*coloc[1])(index(1))) ;
523  }
524  while (index.inc()) ;
525 
526 }
527 
528 
529 // Is a point inside this domain ?
530 bool Domain_shell_outer_adapted::is_in (const Point& xx, double prec) const {
531 
532  assert (xx.get_ndim()==3) ;
533  Point num (absol_to_num(xx)) ;
534  bool res = ((num(1)>-1-prec) && (num(1)<1+prec)) ? true : false ;
535  return res ;
536 }
537 
538 
539 // Convert absolute coordinates to numerical ones
541 
542  Point num(3) ;
543 
544  double x_loc = abs(1) - center(1) ;
545  double y_loc = abs(2) - center(2) ;
546  double z_loc = abs(3) - center(3) ;
547  double air = sqrt(x_loc*x_loc+y_loc*y_loc+z_loc*z_loc) ;
548  double rho = sqrt(x_loc*x_loc+y_loc*y_loc) ;
549 
550  if (rho==0) {
551  // Sur l'axe
552  num.set(2) = (z_loc>=0) ? 0 : M_PI ;
553  num.set(3) = 0 ;
554  }
555  else {
556  num.set(2) = atan(rho/z_loc) ;
557  num.set(3) = atan2 (y_loc, x_loc) ;
558  }
559 
560  if (num(2) <0)
561  num.set(2) = M_PI + num(2) ;
562 
563  // Get the boundary for those angles
564  num.set(1) = 1 ;
565  outer_radius->coef() ;
566  double outer = outer_radius->get_base().summation(num, outer_radius->get_coef()) ;
567  num.set(1) = (2./(outer-inner_radius)) * (air - (outer + inner_radius)/2.) ;
568 
569  return num ;
570 }
571 
572 
573 double coloc_leg(int, int) ;
575 
576  switch (type_base) {
577  case CHEB_TYPE:
579  nbr_coefs.set(2) += 2 ;
580  del_deriv() ;
581  for (int i=0 ; i<ndim ; i++)
582  coloc[i] = new Array<double> (nbr_points(i)) ;
583  for (int i=0 ; i<nbr_points(0) ; i++)
584  coloc[0]->set(i) = -cos(M_PI*i/(nbr_points(0)-1)) ;
585  for (int j=0 ; j<nbr_points(1) ; j++)
586  coloc[1]->set(j) = M_PI/2.*j/(nbr_points(1)-1) ;
587  for (int k=0 ; k<nbr_points(2) ; k++)
588  coloc[2]->set(k) = M_PI*2.*k/nbr_points(2) ;
589  break ;
590  case LEG_TYPE:
592  nbr_coefs.set(2) += 2 ;
593  del_deriv() ;
594  for (int i=0 ; i<ndim ; i++)
595  coloc[i] = new Array<double> (nbr_points(i)) ;
596  for (int i=0 ; i<nbr_points(0) ; i++)
597  coloc[0]->set(i) = coloc_leg(i, nbr_points(0)) ;
598  for (int j=0 ; j<nbr_points(1) ; j++)
599  coloc[1]->set(j) = M_PI/2.*j/(nbr_points(1)-1) ;
600  for (int k=0 ; k<nbr_points(2) ; k++)
601  coloc[2]->set(k) = M_PI*2.*k/nbr_points(2) ;
602  break ;
603  default :
604  cerr << "Unknown type of basis in Domain_shell_outer_adapted::do_coloc" << endl ;
605  abort() ;
606  }
607 }
608 
609 
610 // standard base for a symetric function in z, using Chebyshev
612 
613  int m ;
614 
615  assert (type_base == CHEB_TYPE) ;
616 
617  base.allocate(nbr_coefs) ;
618 
619  base.def =true ;
620  base.bases_1d[2]->set(0) = COSSIN ;
621 
622  Index index (base.bases_1d[0]->get_dimensions()) ;
623 
624  for (int k=0 ; k<nbr_coefs(2) ; k++) {
625  m = (k%2==0) ? k/2 : (k-1)/2 ;
626  base.bases_1d[1]->set(k) = (m%2==0) ? COS_EVEN : SIN_ODD ;
627  for (int j=0 ; j<nbr_coefs(1) ; j++) {
628  index.set(0) = j ; index.set(1) = k ;
629  base.bases_1d[0]->set(index) = CHEB ;
630  }
631  }
632 }
633 
635  set_cheb_base(base) ;
636 }
637 
639  set_legendre_base(base) ;
640 }
641 
642 // standard base for a anti-symetric function in z, using Chebyshev
644 
645  int m ;
646 
647  assert (type_base == CHEB_TYPE) ;
648 
649  base.allocate(nbr_coefs) ;
650 
651  base.def =true ;
652  base.bases_1d[2]->set(0) = COSSIN ;
653 
654  Index index (base.bases_1d[0]->get_dimensions()) ;
655 
656  for (int k=0 ; k<nbr_coefs(2) ; k++) {
657  m = (k%2==0) ? k/2 : (k-1)/2 ;
658  base.bases_1d[1]->set(k) = (m%2==0) ? COS_ODD : SIN_EVEN ;
659  for (int j=0 ; j<nbr_coefs(1) ; j++) {
660  index.set(0) = j ; index.set(1) = k ;
661  base.bases_1d[0]->set(index) = CHEB ;
662  }
663  }
664 }
665 
667 
668  int m ;
669 
670  assert (type_base == CHEB_TYPE) ;
671 
672  base.allocate(nbr_coefs) ;
673 
674  base.def =true ;
675  base.bases_1d[2]->set(0) = COSSIN ;
676 
677  Index index (base.bases_1d[0]->get_dimensions()) ;
678 
679  for (int k=0 ; k<nbr_coefs(2) ; k++) {
680  m = (k%2==0) ? k/2 : (k-1)/2 ;
681  base.bases_1d[1]->set(k) = (m%2==0) ? COS_EVEN : SIN_ODD ;
682  for (int j=0 ; j<nbr_coefs(1) ; j++) {
683  index.set(0) = j ; index.set(1) = k ;
684  base.bases_1d[0]->set(index) = CHEB ;
685  }
686  }
687 }
688 
690 
691  int m ;
692 
693  assert (type_base == CHEB_TYPE) ;
694 
695  base.allocate(nbr_coefs) ;
696 
697  base.def =true ;
698  base.bases_1d[2]->set(0) = COSSIN ;
699 
700  Index index (base.bases_1d[0]->get_dimensions()) ;
701 
702  for (int k=0 ; k<nbr_coefs(2) ; k++) {
703  m = (k%2==0) ? k/2 : (k-1)/2 ;
704  base.bases_1d[1]->set(k) = (m%2==0) ? SIN_EVEN : COS_ODD ;
705  for (int j=0 ; j<nbr_coefs(1) ; j++) {
706  index.set(0) = j ; index.set(1) = k ;
707  base.bases_1d[0]->set(index) = CHEB ;
708  }
709  }
710 }
711 
713 
714  int m ;
715 
716  assert (type_base == CHEB_TYPE) ;
717 
718  base.allocate(nbr_coefs) ;
719 
720  base.def =true ;
721  base.bases_1d[2]->set(0) = COSSIN ;
722 
723  Index index (base.bases_1d[0]->get_dimensions()) ;
724 
725  for (int k=0 ; k<nbr_coefs(2) ; k++) {
726  m = (k%2==0) ? k/2 : (k-1)/2 ;
727  base.bases_1d[1]->set(k) = (m%2==0) ? SIN_ODD : COS_EVEN ;
728  for (int j=0 ; j<nbr_coefs(1) ; j++) {
729  index.set(0) = j ; index.set(1) = k ;
730  base.bases_1d[0]->set(index) = CHEB ;
731  }
732  }
733 }
734 
735 // standard base for a symetric function in z, using Legendre
737 
738  int m ;
739 
740  assert (type_base == LEG_TYPE) ;
741  base.allocate(nbr_coefs) ;
742 
743  base.def = true ;
744  base.bases_1d[2]->set(0) = COSSIN ;
745 
746  Index index (base.bases_1d[0]->get_dimensions()) ;
747 
748  for (int k=0 ; k<nbr_coefs(2) ; k++) {
749  m = (k%2==0) ? k/2 : (k-1)/2 ;
750  base.bases_1d[1]->set(k) = (m%2==0) ? COS_EVEN : SIN_ODD ;
751  for (int j=0 ; j<nbr_coefs(1) ; j++) {
752  index.set(0) = j ; index.set(1) = k ;
753  base.bases_1d[0]->set(index) = LEG ;
754  }
755  }
756 }
757 
758 // standard base for a anti-symetric function in z, using Legendre
760 
761  int m ;
762  assert (type_base == LEG_TYPE) ;
763 
764  base.allocate(nbr_coefs) ;
765 
766  base.def = true ;
767  base.bases_1d[2]->set(0) = COSSIN ;
768 
769  Index index (base.bases_1d[0]->get_dimensions()) ;
770 
771  for (int k=0 ; k<nbr_coefs(2) ; k++) {
772  m = (k%2==0) ? k/2 : (k-1)/2 ;
773  base.bases_1d[1]->set(k) = (m%2==0) ? COS_ODD : SIN_EVEN ;
774  for (int j=0 ; j<nbr_coefs(1) ; j++) {
775  index.set(0) = j ; index.set(1) = k ;
776  base.bases_1d[0]->set(index) = LEG ;
777  }
778  }
779 }
780 
782 
783  int m ;
784 
785  assert (type_base == LEG_TYPE) ;
786 
787  base.allocate(nbr_coefs) ;
788 
789  base.def =true ;
790  base.bases_1d[2]->set(0) = COSSIN ;
791 
792  Index index (base.bases_1d[0]->get_dimensions()) ;
793 
794  for (int k=0 ; k<nbr_coefs(2) ; k++) {
795  m = (k%2==0) ? k/2 : (k-1)/2 ;
796  base.bases_1d[1]->set(k) = (m%2==0) ? COS_EVEN : SIN_ODD ;
797  for (int j=0 ; j<nbr_coefs(1) ; j++) {
798  index.set(0) = j ; index.set(1) = k ;
799  base.bases_1d[0]->set(index) = LEG ;
800  }
801  }
802 }
803 
805 
806  int m ;
807 
808  assert (type_base == LEG_TYPE) ;
809 
810  base.allocate(nbr_coefs) ;
811 
812  base.def =true ;
813  base.bases_1d[2]->set(0) = COSSIN ;
814 
815  Index index (base.bases_1d[0]->get_dimensions()) ;
816 
817  for (int k=0 ; k<nbr_coefs(2) ; k++) {
818  m = (k%2==0) ? k/2 : (k-1)/2 ;
819  base.bases_1d[1]->set(k) = (m%2==0) ? SIN_EVEN : COS_ODD ;
820  for (int j=0 ; j<nbr_coefs(1) ; j++) {
821  index.set(0) = j ; index.set(1) = k ;
822  base.bases_1d[0]->set(index) = LEG ;
823  }
824  }
825 }
826 
828 
829  int m ;
830 
831  assert (type_base == LEG_TYPE) ;
832 
833  base.allocate(nbr_coefs) ;
834 
835  base.def =true ;
836  base.bases_1d[2]->set(0) = COSSIN ;
837 
838  Index index (base.bases_1d[0]->get_dimensions()) ;
839 
840  for (int k=0 ; k<nbr_coefs(2) ; k++) {
841  m = (k%2==0) ? k/2 : (k-1)/2 ;
842  base.bases_1d[1]->set(k) = (m%2==0) ? SIN_ODD : COS_EVEN ;
843  for (int j=0 ; j<nbr_coefs(1) ; j++) {
844  index.set(0) = j ; index.set(1) = k ;
845  base.bases_1d[0]->set(index) = LEG ;
846  }
847  }
848 }
849 
850 // Computes the derivatives with respect to XYZ as a function of the numerical ones.
851 void Domain_shell_outer_adapted::do_der_abs_from_der_var(const Val_domain *const *const der_var, Val_domain **const der_abs) const {
852 
853  Val_domain rr (get_radius()) ;
854  Val_domain dr (*der_var[0] / (*der_rad_term_eq->val_t)()(num_dom)) ;
855  Val_domain dtsr ((*der_var[1] - rr.der_var(2) * dr) / rr);
856  dtsr.set_base() = der_var[1]->get_base() ;
857  Val_domain dpsr ((*der_var[2] - rr.der_var(3) * dr) / rr);
858  dpsr.set_base() = der_var[2]->get_base() ;
859 
860  // d/dx :
861  Val_domain sintdr (dr.mult_sin_theta()) ;
862  Val_domain costdtsr (dtsr.mult_cos_theta()) ;
863 
864  Val_domain dpsrssint (dpsr.div_sin_theta()) ;
865  der_abs[0] = new Val_domain ((sintdr+costdtsr).mult_cos_phi() - dpsrssint.mult_sin_phi()) ;
866 
867  // d/dy :
868  der_abs[1] = new Val_domain ((sintdr+costdtsr).mult_sin_phi() + dpsrssint.mult_cos_phi()) ;
869  // d/dz :
870  der_abs[2] = new Val_domain (dr.mult_cos_theta() - dtsr.mult_sin_theta()) ;
871 }
872 
873 // Rules for the multiplication of two basis.
875 
876  assert (a.ndim==3) ;
877  assert (b.ndim==3) ;
878 
879  Base_spectral res(3) ;
880  bool res_def = true ;
881 
882  if (!a.def)
883  res_def=false ;
884  if (!b.def)
885  res_def=false ;
886 
887  if (res_def) {
888 
889  // Base in phi :
890  res.bases_1d[2] = new Array<int> (a.bases_1d[2]->get_dimensions()) ;
891  switch ((*a.bases_1d[2])(0)) {
892  case COSSIN:
893  switch ((*b.bases_1d[2])(0)) {
894  case COSSIN:
895  res.bases_1d[2]->set(0) = COSSIN ;
896  break ;
897  default:
898  res_def = false ;
899  break ;
900  }
901  break ;
902  default:
903  res_def = false ;
904  break ;
905  }
906 
907  // Bases in theta :
908  // On check l'alternance :
909  Index index_1 (a.bases_1d[1]->get_dimensions()) ;
910  res.bases_1d[1] = new Array<int> (a.bases_1d[1]->get_dimensions()) ;
911  do {
912  switch ((*a.bases_1d[1])(index_1)) {
913  case COS_EVEN:
914  switch ((*b.bases_1d[1])(index_1)) {
915  case COS_EVEN:
916  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? COS_EVEN : SIN_ODD ;
917  break ;
918  case COS_ODD:
919  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? COS_ODD : SIN_EVEN ;
920  break ;
921  case SIN_EVEN:
922  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? SIN_EVEN : COS_ODD ;
923  break ;
924  case SIN_ODD:
925  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? SIN_ODD : COS_EVEN ;
926  break ;
927  default:
928  res_def = false ;
929  break ;
930  }
931  break ;
932  case COS_ODD:
933  switch ((*b.bases_1d[1])(index_1)) {
934  case COS_EVEN:
935  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? COS_ODD : SIN_EVEN ;
936  break ;
937  case COS_ODD:
938  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? COS_EVEN : SIN_ODD ;
939  break ;
940  case SIN_EVEN:
941  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? SIN_ODD : COS_EVEN ;
942  break ;
943  case SIN_ODD:
944  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? SIN_EVEN : COS_ODD ;
945  break ;
946  default:
947  res_def = false ;
948  break ;
949  }
950  break ;
951  case SIN_EVEN:
952  switch ((*b.bases_1d[1])(index_1)) {
953  case COS_EVEN:
954  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? SIN_EVEN : COS_ODD ;
955  break ;
956  case COS_ODD:
957  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? SIN_ODD : COS_EVEN ;
958  break ;
959  case SIN_EVEN:
960  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? COS_EVEN : SIN_ODD ;
961  break ;
962  case SIN_ODD:
963  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? COS_ODD : SIN_EVEN ;
964  break ;
965  default:
966  res_def = false ;
967  break ;
968  }
969  break ;
970  case SIN_ODD:
971  switch ((*b.bases_1d[1])(index_1)) {
972  case COS_EVEN:
973  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? SIN_ODD : COS_EVEN ;
974  break ;
975  case COS_ODD:
976  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? SIN_EVEN : COS_ODD ;
977  break ;
978  case SIN_EVEN:
979  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? COS_ODD : SIN_EVEN ;
980  break ;
981  case SIN_ODD:
982  res.bases_1d[1]->set(index_1) = (index_1(0)%4<2) ? COS_EVEN : SIN_ODD ;
983  break ;
984  default:
985  res_def = false ;
986  break ;
987  }
988  break ;
989  default:
990  res_def = false ;
991  break ;
992  }
993  }
994  while (index_1.inc()) ;
995 
996 
997  // Base in r :
998  Index index_0 (a.bases_1d[0]->get_dimensions()) ;
999  res.bases_1d[0] = new Array<int> (a.bases_1d[0]->get_dimensions()) ;
1000  do {
1001  switch ((*a.bases_1d[0])(index_0)) {
1002  case CHEB:
1003  switch ((*b.bases_1d[0])(index_0)) {
1004  case CHEB:
1005  res.bases_1d[0]->set(index_0) = CHEB ;
1006  break ;
1007  default:
1008  res_def = false ;
1009  break ;
1010  }
1011  break ;
1012  case LEG:
1013  switch ((*b.bases_1d[0])(index_0)) {
1014  case LEG:
1015  res.bases_1d[0]->set(index_0) = LEG ;
1016  break ;
1017  default:
1018  res_def = false ;
1019  break ;
1020  }
1021  break ;
1022  default:
1023  res_def = false ;
1024  break ;
1025  }
1026  }
1027  while (index_0.inc()) ;
1028  }
1029 
1030  if (!res_def)
1031  for (int dim=0 ; dim<a.ndim ; dim++)
1032  if (res.bases_1d[dim]!= nullptr) {
1033  delete res.bases_1d[dim] ;
1034  res.bases_1d[dim] = nullptr ;
1035  }
1036  res.def = res_def ;
1037  return res ;
1038 }
1039 
1041  int res = -1 ;
1042  if (strcmp(p,"R ")==0)
1043  res = 0 ;
1044  if (strcmp(p,"T ")==0)
1045  res = 1 ;
1046  if (strcmp(p,"P ")==0)
1047  res = 2 ;
1048  return res ;
1049 }
1050 
1051 
1052 void Domain_shell_outer_adapted::update_constante (const Val_domain& cor_outer_radius, const Scalar& old, Scalar& res) const {
1053 
1054  Point MM(3) ;
1055  Index pos(nbr_points) ;
1057  do {
1058 
1059  double rr = ((*outer_radius)(pos) + cor_outer_radius(pos) - inner_radius) * (*coloc[0])(pos(0)) / 2.
1060  + ((*outer_radius)(pos) + cor_outer_radius(pos) + inner_radius) / 2.;
1061  double theta = (*coloc[1])(pos(1)) ;
1062  double phi = (*coloc[2])(pos(2)) ;
1063 
1064  MM.set(1) = rr*sin(theta)*cos(phi) + center(1);
1065  MM.set(2) = rr*sin(theta)*sin(phi) + center(2) ;
1066  MM.set(3) = rr*cos(theta) + center(3) ;
1067 
1068  res.set_domain(num_dom).set(pos) = old.val_point(MM, -1) ;
1069 
1070  }
1071  while (pos.inc()) ;
1072 
1073  res.set_domain(num_dom).set_base() = old(num_dom).get_base() ;
1074 }
1075 }
1076 
reference set(const Index &pos)
Read/write of an element.
Definition: array.hpp:186
Class for storing the basis of decompositions of a field.
Bases_container bases_1d
Arrays containing the various basis of decomposition.
double summation(const Point &num, const Array< double > &tab) const
Computes the spectral summation.
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-like domain, having a symmetry with respect to the plane .
Definition: adapted.hpp:367
virtual void set_legendre_base_p_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual Val_domain mult_sin_phi(const Val_domain &) const
Multiplication by .
void set_mapping(const Val_domain &so) const
Affects the outer radius.
Domain_shell_outer_adapted(const Space &sp, int num, int ttype, double rin, double rout, const Point &cr, const Dim_array &nbr)
Constructor :
virtual void affecte_coef(int &, int, bool &) const
The variation of the functions describing the shape of the Domain are affected from the unknowns of t...
virtual void do_absol() const
Computes the absolute coordinates.
virtual void do_cart_surr() const
Computes the Cartesian coordinates over the radius.
virtual void set_cheb_base(Base_spectral &) const
Gives the standard base for Chebyshev polynomials.
Term_eq * outer_radius_term_eq
Pointer on the outer boundary , as a Term_eq.
Definition: adapted.hpp:375
virtual void do_coloc()
Computes the colocation points.
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
virtual void set_legendre_base_r_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the radial component of a vector.
Term_eq * dp_rad_term_eq
Pointer on the Term_eq containing the .
Definition: adapted.hpp:400
virtual Val_domain mult_cos_phi(const Val_domain &) const
Multiplication by .
Point center
Absolute coordinates of the center.
Definition: adapted.hpp:402
virtual void do_radius() const
Computes the generalized radius.
virtual int give_place_var(char *) const
Translates a name of a coordinate into its corresponding numerical name.
virtual void save(FILE *) const
Saving function.
void do_normal_cart() const
Computes the normal wrt the inner boundary, in Cartesian coordinates.
virtual void set_cheb_base_p_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_cheb_r_base(Base_spectral &) const
Gives the base using odd Chebyshev polynomials$ for the radius.
void update() const
Updates all the quantities that depend on the inner radius (like the normal vectors).
virtual void set_legendre_base_t_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the component of a vector.
Term_eq * normal_spher
Pointer on the Term_eq containing the normal vector to the outer boundary, in orthonormal spherical c...
Definition: adapted.hpp:380
void del_deriv() override
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
Term_eq * normal_cart
Pointer on the Term_eq containing the normal vector to the outer boundary, in Cartesian coordinates.
Definition: adapted.hpp:384
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
virtual int nbr_unknowns_from_adapted() const
Gives the number of unknowns coming from the variable shape of the domain.
virtual void set_cheb_base_t_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the component of a vector.
Term_eq * der_rad_term_eq
Pointer on the Term_eq containing the .
Definition: adapted.hpp:392
Val_domain * outer_radius
Pointer on the outer boundary , as a Val_domain.
Definition: adapted.hpp:374
virtual void update_variable(const Val_domain &, const Scalar &, Scalar &) const
Update the value of a scalar, after the shape of the Domain has been changed by the system.
virtual void update_constante(const Val_domain &, const Scalar &, Scalar &) const
Update the value of a scalar, after the shape of the Domain has been changed by the system.
virtual Val_domain der_r(const Val_domain &) const
Compute the radial derivative of a scalar field.
Term_eq * rad_term_eq
Pointer on the Term_eq containing the radius.
Definition: adapted.hpp:388
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...
virtual const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
double inner_radius
The inner radius .
Definition: adapted.hpp:376
virtual void xx_to_ders_from_adapted(const Array< double > &, int &) const
Affects the derivative part of variable a Domain from a set of values.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual void set_legendre_r_base(Base_spectral &) const
Gives the base using odd Legendre polynomials$ for the radius.
virtual void update_mapping(const Val_domain &)
Updates the variables parts of the Domain.
virtual void set_anti_legendre_base(Base_spectral &) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
Term_eq * dt_rad_term_eq
Pointer on the Term_eq containing the .
Definition: adapted.hpp:396
virtual void set_cheb_base_r_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the radial component of a vector.
virtual void vars_to_terms() const
The Term_eq describing the variable shape of the Domain are updated.
virtual void xx_to_vars_from_adapted(Val_domain &, const Array< double > &, int &) const
Computes the new boundary of a Domain from a set of values.
virtual void set_anti_cheb_base(Base_spectral &) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
virtual Val_domain der_normal(const Val_domain &, int) const
Normal derivative with respect to a given surface.
const Space & sp
The corresponding Space ; required for updating fields whene the mapping changes.
Definition: adapted.hpp:373
virtual void do_cart() const
Computes the Cartesian coordinates.
Abstract class that implements the fonctionnalities common to all the type of domains.
Definition: space.hpp:60
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
Memory_mapped_array< Val_domain * > cart_surr
Cartesian coordinates divided by the radius.
Definition: space.hpp:79
int num_dom
Number of the current domain (used by the Space)
Definition: space.hpp:63
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
void set_start()
Sets the position to zero in all dimensions.
Definition: index.hpp:88
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
void save(FILE *) const
Saving function.
Definition: point.cpp:33
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
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Definition: scalar.hpp:67
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
Definition: scalar.hpp:555
double val_point(const Point &xxx, int sens=-1) const
Computes the value of the field at a given point, by doing the spectral summation.
Definition: scalar.cpp:62
The Space class is an ensemble of domains describing the whole space of the computation.
Definition: space.hpp:1362
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
void set_der_t(Tensor)
Sets the tensorial variation (only the values in the pertinent Domain are copied).
Definition: term_eq.cpp:171
void set_der_zero()
Sets the variation of the approriate type to zero.
Definition: term_eq.cpp:187
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
Val_domain mult_sin_phi() const
Multiplication by .
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
void set_zero()
Sets the Val_domain to zero (logical state to zero and arrays destroyed).
Definition: val_domain.cpp:223
void allocate_coef()
Allocates the values in the coefficient space and destroys the values in the configuration space.
Definition: val_domain.cpp:216
bool check_if_zero() const
Check whether the logical state is zero or not.
Definition: val_domain.hpp:142
Val_domain mult_sin_theta() const
Multiplication by .
Val_domain mult_cos_phi() const
Multiplication by .
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
Definition: val_domain.hpp:77
void std_r_base()
Sets the basis for the radius.
Definition: val_domain.cpp:262
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
Definition: val_domain.cpp:171
void std_base()
Sets the standard basis of decomposition.
Definition: val_domain.cpp:246
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
Val_domain der_var(int i) const
Computes the derivative with respect to a numerical coordinate.
Definition: val_domain.cpp:670
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 allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.
Definition: val_domain.cpp:209
const Base_spectral & get_base() const
Returns the basis of decomposition.
Definition: val_domain.hpp:122