20 #include "headcpp.hpp"
22 #include "utilities.hpp"
23 #include "spheric.hpp"
25 #include "tensor_impl.hpp"
27 #include "term_eq.hpp"
30 Array<double> legendre_norme (
int,
int) ;
36 cerr <<
"Domain_shell::der_multipoles_sym only defined for a tensor" << endl ;
41 cerr <<
"Domain_shell::der_multipoles_sym only defined with respect to a component (i.e. valence must be 0)" << endl ;
44 assert ((bound==INNER_BC) || (bound==OUTER_BC)) ;
46 bool doder = (so.
der_t==0x0) ?
false :
true ;
58 int mm = (k%2==0) ?
int(k/2) : int((k-1)/2) ;
60 pos_bound.
set(2) = k ;
66 pos_bound.
set(1) = i ;
67 alm += passage(pos)*
val_boundary(bound, dval, pos_bound) ;
69 alm_der += passage(pos)*
val_boundary(bound, *pdder, pos_bound) ;
77 pos_bound.
set(1) = i ;
78 alm += passage(pos)*
val_boundary(bound, dval, pos_bound) ;
80 alm_der += passage(pos)*
val_boundary(bound, *pdder, pos_bound) ;
101 res.
set(pp) = (k%2==0) ? alm*cos(mm*phi(pp(2)))*leg(2*(j-
int(mm/2)), 2*pp(1)) :
102 alm*sin(mm*phi(pp(2)))*leg(2*(j-
int(mm/2)), 2*pp(1)) ;
104 der.
set(pp) = (k%2==0) ? alm_der*cos(mm*phi(pp(2)))*leg(2*(j-
int(mm/2)), 2*pp(1)) :
105 alm_der*sin(mm*phi(pp(2)))*leg(2*(j-
int(mm/2)), 2*pp(1)) ;
113 res.
set(pp) = (k%2==0) ? alm*cos(mm*phi(pp(2)))*leg(2*(j-
int((mm-1)/2)), 2*pp(1)) :
114 alm*sin(mm*phi(pp(2)))*leg(2*(j-
int((mm-1)/2)), 2*pp(1)) ;
116 der.
set(pp) = (k%2==0) ? alm_der*cos(mm*phi(pp(2)))*leg(2*(j-
int((mm-1)/2)), 2*pp(1)) :
118 alm_der*sin(mm*phi(pp(2)))*leg(2*(j-
int((mm-1)/2)), 2*pp(1)) ;
128 if (fabs(alm)<PRECISION)
130 if (fabs(alm_der)<PRECISION)
139 return Term_eq (dom, res_scal, der_scal) ;
142 return Term_eq (dom, res_scal) ;
150 cerr <<
"Domain_shell::der_multipoles_sym only defined for a tensor" << endl ;
155 cerr <<
"Domain_shell::der_multipoles_sym only defined with respect to a component (i.e. valence must be 0)" << endl ;
158 assert ((bound==INNER_BC) || (bound==OUTER_BC)) ;
160 bool doder = (so.
der_t==0x0) ?
false :
true ;
172 int mm = (k%2==0) ?
int(k/2) : int((k-1)/2) ;
174 pos_bound.
set(2) = k ;
180 pos_bound.
set(1) = i ;
181 alm += passage(pos)*
val_boundary(bound, dval, pos_bound) ;
183 alm_der += passage(pos)*
val_boundary(bound, *pdder, pos_bound) ;
191 pos_bound.
set(1) = i ;
192 alm += passage(pos)*
val_boundary(bound, dval, pos_bound) ;
194 alm_der += passage(pos)*
val_boundary(bound, *pdder, pos_bound) ;
215 res.
set(pp) = (k%2==0) ? alm*cos(mm*phi(pp(2)))*leg(2*(j-
int(mm/2))+1, 2*pp(1)) :
216 alm*sin(mm*phi(pp(2)))*leg(2*(j-
int(mm/2))+1, 2*pp(1)) ;
218 der.
set(pp) = (k%2==0) ? alm_der*cos(mm*phi(pp(2)))*leg(2*(j-
int(mm/2))+1, 2*pp(1)) :
219 alm_der*sin(mm*phi(pp(2)))*leg(2*(j-
int(mm/2))+1, 2*pp(1)) ;
227 res.
set(pp) = (k%2==0) ? alm*cos(mm*phi(pp(2)))*leg(2*(j-
int((mm+1)/2))+1, 2*pp(1)) :
228 alm*sin(mm*phi(pp(2)))*leg(2*(j-
int((mm+1)/2))+1, 2*pp(1)) ;
230 der.
set(pp) = (k%2==0) ? alm_der*cos(mm*phi(pp(2)))*leg(2*(j-
int((mm+1)/2))+1, 2*pp(1)) :
231 alm_der*sin(mm*phi(pp(2)))*leg(2*(j-
int((mm+1)/2))+1, 2*pp(1)) ;
241 if (fabs(alm)<PRECISION)
243 if (fabs(alm_der)<PRECISION)
252 return Term_eq (dom, res_scal, der_scal) ;
255 return Term_eq (dom, res_scal) ;
263 cerr <<
"Omega must be a double in Domain_shell::der_radial_part_sym" << endl ;
268 int mm = (k%2==0) ?
int(k/2) : int((k-1)/2) ;
269 int ll = (mm%2==0) ? 2*j : 2*j+1 ;
271 Term_eq fonction (fit(space, mm, ll, ome, parfit)) ;
278 bool doder = (fonction.
der_t == 0x0) ?
false :
true ;
282 return Term_eq (dom, resval, resder) ;
293 cerr <<
"Omega must be a double in Domain_shell::der_radial_part_sym" << endl ;
298 int mm = (k%2==0) ?
int(k/2) : int((k-1)/2) ;
299 int ll = (mm%2==0) ? 2*j+1 : 2*j ;
301 Term_eq fonction (fit(space, mm, ll, ome, parfit)) ;
308 bool doder = (fonction.
der_t == 0x0) ?
false :
true ;
312 return Term_eq (dom, resval, resder) ;
328 int mm = (k%2==0) ?
int(k/2) : int((k-1)/2) ;
330 for (
int j=
int(mm/2) ; j<
nbr_coefs(1) ; j++) {
344 for (
int j=
int((mm-1)/2) ; j<
nbr_coefs(1)-1 ; j++) {
371 int mm = (k%2==0) ?
int(k/2) : int((k-1)/2) ;
373 for (
int j=
int(mm/2) ; j<
nbr_coefs(1)-1 ; j++) {
387 for (
int j=
int((mm+1)/2) ; j<
nbr_coefs(1)-1 ; j++) {
Dim_array dimensions
Dimensions of the Array.
virtual Term_eq der_harmonics_sym(const Term_eq &, const Term_eq &, int, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &, const Array< double > &) const
Fit, spherical harmonic by spherical harmonic, for the radial derivative of a symmetric function.
virtual Term_eq der_multipoles_sym(int, int, int, const Term_eq &, const Array< double > &) const
Extraction of a given multipole, at some boundary, for the radial derivative a symmetric scalar funct...
virtual Term_eq der_harmonics_asym(const Term_eq &, const Term_eq &, int, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &, const Array< double > &) const
Fit, spherical harmonic by spherical harmonic, for the radial derivative of an anti-symmetric functio...
virtual Term_eq der_multipoles_asym(int, int, int, const Term_eq &, const Array< double > &) const
Extraction of a given multipole, at some boundary, for the radial derivative of an anti-symmetric sca...
virtual Term_eq der_radial_part_asym(const Space &, int, int, const Term_eq &, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param &), const Param &) const
Gives some radial fit for a given multipole, intended for the radial derivative of an anti-symmetric ...
virtual Term_eq der_radial_part_sym(const Space &, int, int, const Term_eq &, Term_eq(*f)(const Space &, int, int, const Term_eq &, const Param ¶m), const Param &) const
Gives some radial fit for a given multipole, intended for the radial derivative of a symmetric scalar...
virtual double val_boundary(int, const Val_domain &, const Index &) const
Computes the value of a field at a boundary.
Dim_array nbr_coefs
Number of coefficients.
Dim_array nbr_points
Number of colocation points.
Array< double > const & get_coloc(int) const
Returns the colocation points for a given variable.
Class that gives the position inside a multi-dimensional Array.
int & set(int i)
Read/write of the position in a given dimension.
bool inc(int increm, int var=0)
Increments the position of the Index.
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
The Space class is an ensemble of domains describing the whole space of the computation.
int get_valence() const
Returns the valence.
const Space & get_space() const
Returns the Space.
This class is intended to describe the manage objects appearing in the equations.
Tensor * der_t
Pointer on the variation, if the Term_eq is a Tensor.
const int type_data
Flag describing the type of data :
Tensor const & get_val_t() const
Tensor const & get_der_t() const
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Class for storing the basis of decompositions of a field and its values on both the configuration and...
void set_zero()
Sets the Val_domain to zero (logical state to zero and arrays destroyed).
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
Base_spectral & set_base()
Sets the basis of decomposition.
Array< double > * c
Pointer on the Array of the values in the configuration space.
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.