KADATH
domain_fourD_periodic_shell_ope.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 "fourD_periodic.hpp"
21 #include "val_domain.hpp"
22 #include "array_math.hpp"
23 namespace Kadath {
24 int mult_cos_1d (int, Array<double>&) ;
25 int mult_sin_1d (int, Array<double>&) ;
26 int div_sin_1d (int, Array<double>&) ;
27 int div_xm1_1d (int, Array<double>&) ;
28 
30  so.coef() ;
31  Val_domain res(this) ;
32 
33  res.base = so.base ;
34  res.cf = new Array<double> (so.base.ope_1d(mult_cos_1d, 2, *so.cf, res.base)) ;
35  res.in_coef = true ;
36  return res ;
37 }
38 
40  so.coef() ;
41  Val_domain res(this) ;
42 
43  res.base = so.base ;
44  res.cf = new Array<double> (so.base.ope_1d(mult_sin_1d, 2, *so.cf, res.base)) ;
45  res.in_coef = true ;
46  return res ;
47 }
48 
50  so.coef() ;
51  Val_domain res(this) ;
52  res.base = so.base ;
53  res.cf = new Array<double> (so.base.ope_1d(mult_cos_1d, 1, *so.cf, res.base)) ;
54  res.in_coef = true ;
55  return res ;
56 }
57 
59 
60  so.coef() ;
61  Val_domain res(this) ;
62 
63  res.base= so.base ;
64  res.cf = new Array<double> (so.base.ope_1d(mult_sin_1d, 1, *so.cf, res.base)) ;
65  res.in_coef = true ;
66  return res ;
67 }
68 
69 
71 
72  so.coef() ;
73  Val_domain res(this) ;
74 
75  res.base= so.base ;
76  res.cf = new Array<double> (so.base.ope_1d(div_sin_1d, 1, *so.cf, res.base)) ;
77  res.in_coef = true ;
78  return res ;
79 }
80 
82  so.coef() ;
83  Val_domain res(this) ;
84 
85  res.base= so.base ;
86 
87  res.cf = new Array<double> (so.base.ope_1d(div_xm1_1d, 0, *so.cf, res.base)) ;
88  res.in_coef = true ;
89  return res ;
90 }
91 
92 
94 
95  int ntime = get_nbr_coefs()(3) ;
96  Array<double> res(ntime);
97  res = 0. ;
98  so.coef();
99 
100  for (int l=0 ; l<ntime ; l++) {
101 
102  int baset((*so.base.bases_1d[1])(0,l));
103  if (baset == COS_EVEN) {
104 
105  //Loop on theta :
106  Index pos(get_nbr_coefs());
107  pos.set(2) = 0;
108  pos.set(3) = l ;
109  for (int j(0) ; j < nbr_coefs(1) ; ++j)
110  {
111  pos.set(1) = j;
112  double fact_tet(2.0/(1.0 - 4.0*j*j));
113  // Loop on r :
114  for (int i(0) ; i < nbr_coefs(0) ; ++i)
115  {
116  pos.set(0) = i;
117  res.set(l) += fact_tet*(*so.cf)(pos);
118  }
119  }
120  res.set(l) *= 2.0*M_PI;
121  }
122 }
123  return res ;
124 }
125 
126 }
reference set(const Index &pos)
Read/write of an element.
Definition: array.hpp:186
Bases_container bases_1d
Arrays containing the various basis of decomposition.
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
virtual Val_domain mult_cos_phi(const Val_domain &) const
Multiplication by .
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
virtual Val_domain div_sin_theta(const Val_domain &) const
Division by .
virtual Val_domain div_xm1(const Val_domain &) const
Division by .
virtual Val_domain mult_sin_phi(const Val_domain &) const
Multiplication by .
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
Array< double > integ_outer_boundary(const Val_domain &so) const
Computes the surface integral, at the outer boundary.
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
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
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Definition: val_domain.hpp:69
Base_spectral base
Spectral basis of the field.
Definition: val_domain.hpp:72
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
Definition: val_domain.hpp:77
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