20 #include "headcpp.hpp"
23 #include "array_math.hpp"
25 #include "tensor_impl.hpp"
40 double fact_t, fact_r, fact_rt ;
54 if ((mquant==0) && (lquant<=llim)) {
55 so.
cf->
set(pos_cf) += values(conte) ;
62 pos_gal_r.
set(0) = 0 ;
65 fact_r = - pow(-1, i) ;
69 for (
int t=0 ; t<i ; t++)
70 fact_r *= -
double(2*t+1)/double(2*t+2) ;
74 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
78 so.
cf->
set(pos_cf) += values(conte) ;
79 so.
cf->
set(pos_gal_r) += fact_r*values(conte) ;
83 else if ((j!=0) && (i!=0)) {
86 pos_gal_r.
set(0) = 0 ;
88 pos_gal_t.
set(1) = 0 ;
90 pos_gal_rt.
set(0) = 0 ;
91 pos_gal_rt.
set(1) = 0 ;
94 fact_r = -pow(-1, i) ;
96 fact_rt = pow(-1, i) ;
100 for (
int t=0 ; t<i ; t++)
101 l0 *= -
double(2*t+1)/double(2*t+2) ;
108 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
111 so.
cf->
set(pos_cf) += values(conte) ;
112 so.
cf->
set(pos_gal_r) += fact_r*values(conte) ;
113 so.
cf->
set(pos_gal_t) += fact_t*values(conte) ;
114 so.
cf->
set(pos_gal_rt) += fact_rt*values(conte) ;
121 if ((mquant==0) && (lquant<=llim+1)) {
122 so.
cf->
set(pos_cf) += values(conte) ;
126 if ((mquant==0) && (i!=0)) {
128 pos_gal_r.
set(0) = 0 ;
131 fact_r = - (2*i+1) * pow(-1, i) ;
135 for (
int t=0 ; t<i ; t++)
136 fact_r *= -
double(2*t+3)/double(2*t+2) ;
140 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
143 so.
cf->
set(pos_cf) += values(conte) ;
144 so.
cf->
set(pos_gal_r) += fact_r*values(conte) ;
147 else if ((j!=0) && (i!=0)) {
150 pos_gal_r.
set(0) = 0 ;
152 pos_gal_t.
set(1) = 0 ;
153 pos_gal_rt = pos_cf ;
154 pos_gal_rt.
set(0) = 0 ;
155 pos_gal_rt.
set(1) = 0 ;
158 fact_r = -pow(-1, i)*(2*i+1) ;
160 fact_rt = pow(-1, i)*(2*i+1) ;
164 for (
int t=0 ; t<i ; t++)
165 l0 *= -
double(2*t+3)/double(2*t+2) ;
172 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
175 so.
cf->
set(pos_cf) += values(conte) ;
176 so.
cf->
set(pos_gal_r) += fact_r*values(conte) ;
177 so.
cf->
set(pos_gal_t) += fact_t*values(conte) ;
178 so.
cf->
set(pos_gal_rt) += fact_rt*values(conte) ;
187 if ((mquant<=1) && (lquant<=llim)) {
188 so.
cf->
set(pos_cf) += values(conte) ;
192 if ((mquant<=1) && (i!=0)) {
195 pos_gal_r.
set(0) = 0 ;
198 fact_r = - pow(-1, i) ;
202 for (
int t=0 ; t<i ; t++)
203 fact_r *= -
double(2*t+1)/double(2*t+2) ;
207 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
210 so.
cf->
set(pos_cf) += values(conte) ;
211 so.
cf->
set(pos_gal_r) += fact_r*values(conte) ;
216 if ((j!=1) && (i!=0)) {
219 pos_gal_r.
set(0) = 0 ;
221 pos_gal_t.
set(1) = 1 ;
222 pos_gal_rt = pos_cf ;
223 pos_gal_rt.
set(0) = 0 ;
224 pos_gal_rt.
set(1) = 1 ;
227 fact_r = -pow(-1, i) ;
229 fact_rt = pow(-1, i)*j ;
233 for (
int t=0 ; t<i ; t++)
234 l0 *= -
double(2*t+1)/double(2*t+2) ;
241 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
244 so.
cf->
set(pos_cf) += values(conte) ;
245 so.
cf->
set(pos_gal_r) += fact_r*values(conte) ;
246 so.
cf->
set(pos_gal_t) += fact_t*values(conte) ;
247 so.
cf->
set(pos_gal_rt) += fact_rt*values(conte) ;
257 if ((mquant<=1) && (lquant<=llim+1)) {
258 so.
cf->
set(pos_cf) += values(conte) ;
262 if ((mquant<=1) && (i!=0)) {
264 pos_gal_r.
set(0) = 0 ;
267 fact_r = - (2*i+1) * pow(-1, i) ;
271 for (
int t=0 ; t<i ; t++)
272 fact_r *= -
double(2*t+3)/double(2*t+2) ;
276 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
279 so.
cf->
set(pos_cf) += values(conte) ;
280 so.
cf->
set(pos_gal_r) += fact_r*values(conte) ;
283 else if ((j!=0) && (i!=0)) {
286 pos_gal_r.
set(0) = 0 ;
288 pos_gal_t.
set(1) = 0 ;
289 pos_gal_rt = pos_cf ;
290 pos_gal_rt.
set(0) = 0 ;
291 pos_gal_rt.
set(1) = 0 ;
294 fact_r = -pow(-1, i)*(2*i+1) ;
296 fact_rt = pow(-1, i)*(2*i+1)*(2*j+1) ;
300 for (
int t=0 ; t<i ; t++)
301 l0 *= -
double(2*t+3)/double(2*t+2) ;
304 fact_rt = l0*(2*j+1) ;
308 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
311 so.
cf->
set(pos_cf) += values(conte) ;
312 so.
cf->
set(pos_gal_r) += fact_r*values(conte) ;
313 so.
cf->
set(pos_gal_t) += fact_t*values(conte) ;
314 so.
cf->
set(pos_gal_rt) += fact_rt*values(conte) ;
321 cerr <<
"Unknow theta basis in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
342 cerr <<
"Valence " << val <<
" not implemented in Domain_polar_nucleus::affecte_tau" << endl ;
reference set(const Index &pos)
Read/write of an element.
Bases_container bases_1d
Arrays containing the various basis of decomposition.
virtual void affecte_tau(Tensor &, int, const Array< double > &, int &) const
Affects some coefficients to a Tensor.
void affecte_tau_val_domain(Val_domain &so, int mquant, int llim, const Array< double > &cf, int &pos_cf) const
Affects some coefficients to a Val_domain.
Dim_array nbr_coefs
Number of coefficients.
Class that gives the position inside a multi-dimensional Array.
int & set(int i)
Read/write of the position in a given dimension.
int get_m_quant() const
Returns .
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
const Domain * get_domain(int i) const
returns a pointer on the domain.
const Param_tensor & get_parameters() const
Returns a pointer on the possible additional parameter.
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
int get_valence() const
Returns the valence.
bool is_m_quant_affected() const
Checks whether the additional parameter is affected (used for boson stars for instance).
const Space & get_space() const
Returns the Space.
Class for storing the basis of decompositions of a field and its values on both the configuration and...
void allocate_coef()
Allocates the values in the coefficient space and destroys the values in the configuration space.
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
const Base_spectral & get_base() const
Returns the basis of decomposition.