20 #include "headcpp.hpp"
23 #include "array_math.hpp"
25 #include "tensor_impl.hpp"
43 double fact_t, fact_r, fact_rt ;
57 if ((mquant==0) && (lquant<=llim)) {
60 so.
cf->
set(pos_cf) = 1. ;
70 pos_gal_r.
set(0) = 0 ;
73 fact_r = - pow(-1, i) ;
77 for (
int t=0 ; t<i ; t++)
78 fact_r *= -
double(2*t+1)/double(2*t+2) ;
82 cerr <<
"Strange base in Domain_polar_nucleus::affecte_one_coef_val_domain" << endl ;
85 so.
cf->
set(pos_cf) = 1 ;
86 so.
cf->
set(pos_gal_r) += fact_r ;
91 else if ((j!=0) && (i!=0)) {
96 pos_gal_r.
set(0) = 0 ;
98 pos_gal_t.
set(1) = 0 ;
100 pos_gal_rt.
set(0) = 0 ;
101 pos_gal_rt.
set(1) = 0 ;
104 fact_r = -pow(-1, i) ;
106 fact_rt = pow(-1, i) ;
110 for (
int t=0 ; t<i ; t++)
111 l0 *= -
double(2*t+1)/double(2*t+2) ;
118 cerr <<
"Strange base in Domain_polar_nucleus::affecte_one_coef_val_domain" << endl ;
121 so.
cf->
set(pos_cf) = 1. ;
122 so.
cf->
set(pos_gal_r) = fact_r ;
123 so.
cf->
set(pos_gal_t) = fact_t ;
124 so.
cf->
set(pos_gal_rt) = fact_rt ;
132 if ((mquant==0) && (lquant<=llim+1)) {
135 so.
cf->
set(pos_cf) = 1. ;
140 if ((mquant==0) && (i!=0)) {
144 pos_gal_r.
set(0) = 0 ;
147 fact_r = - (2*i+1) * pow(-1, i) ;
151 for (
int t=0 ; t<i ; t++)
152 fact_r *= -
double(2*t+3)/double(2*t+2) ;
156 cerr <<
"Strange base in Domain_polar_nucleus::affecte_one_coef_val_domain" << endl ;
160 so.
cf->
set(pos_cf) = 1. ;
161 so.
cf->
set(pos_gal_r) = fact_r ;
165 else if ((j!=0) && (i!=0)) {
170 pos_gal_r.
set(0) = 0 ;
172 pos_gal_t.
set(1) = 0 ;
173 pos_gal_rt = pos_cf ;
174 pos_gal_rt.
set(0) = 0 ;
175 pos_gal_rt.
set(1) = 0 ;
178 fact_r = -pow(-1, i)*(2*i+1) ;
180 fact_rt = pow(-1, i)*(2*i+1) ;
184 for (
int t=0 ; t<i ; t++)
185 l0 *= -
double(2*t+3)/double(2*t+2) ;
192 cerr <<
"Strange base in Domain_polar_nucleus::affecte_one_coef_val_domain" << endl ;
195 so.
cf->
set(pos_cf) = 1. ;
196 so.
cf->
set(pos_gal_r) = fact_r ;
197 so.
cf->
set(pos_gal_t) = fact_t ;
198 so.
cf->
set(pos_gal_rt) = fact_rt ;
208 if ((mquant<=1) && (lquant<=llim)) {
211 so.
cf->
set(pos_cf) = 1. ;
216 if ((mquant<=1) && (i!=0)) {
221 pos_gal_r.
set(0) = 0 ;
224 fact_r = - pow(-1, i) ;
228 for (
int t=0 ; t<i ; t++)
229 fact_r *= -
double(2*t+1)/double(2*t+2) ;
233 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
236 so.
cf->
set(pos_cf) = 1. ;
237 so.
cf->
set(pos_gal_r) = fact_r ;
243 if ((j!=1) && (i!=0)) {
249 pos_gal_r.
set(0) = 0 ;
251 pos_gal_t.
set(1) = 1 ;
252 pos_gal_rt = pos_cf ;
253 pos_gal_rt.
set(0) = 0 ;
254 pos_gal_rt.
set(1) = 1 ;
257 fact_r = -pow(-1, i) ;
259 fact_rt = pow(-1, i)*j ;
263 for (
int t=0 ; t<i ; t++)
264 l0 *= -
double(2*t+1)/double(2*t+2) ;
271 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
274 so.
cf->
set(pos_cf) = 1 ;
275 so.
cf->
set(pos_gal_r) = fact_r ;
276 so.
cf->
set(pos_gal_t) = fact_t ;
277 so.
cf->
set(pos_gal_rt) = fact_rt ;
288 if ((mquant<=1) && (lquant<=llim+1)) {
291 so.
cf->
set(pos_cf) = 1. ;
296 if ((mquant<=1) && (i!=0)) {
300 pos_gal_r.
set(0) = 0 ;
303 fact_r = - (2*i+1) * pow(-1, i) ;
307 for (
int t=0 ; t<i ; t++)
308 fact_r *= -
double(2*t+3)/double(2*t+2) ;
312 cerr <<
"Strange base in Domain_polar_nucleus::affecte_one_coef_val_domain" << endl ;
316 so.
cf->
set(pos_cf) = 1. ;
317 so.
cf->
set(pos_gal_r) = fact_r ;
321 else if ((j!=0) && (i!=0)) {
326 pos_gal_r.
set(0) = 0 ;
328 pos_gal_t.
set(1) = 0 ;
329 pos_gal_rt = pos_cf ;
330 pos_gal_rt.
set(0) = 0 ;
331 pos_gal_rt.
set(1) = 0 ;
334 fact_r = -pow(-1, i)*(2*i+1) ;
336 fact_rt = pow(-1, i)*(2*i+1)*(2*j+1) ;
340 for (
int t=0 ; t<i ; t++)
341 l0 *= -
double(2*t+3)/double(2*t+2) ;
344 fact_rt = l0*(2*j+1) ;
348 cerr <<
"Strange base in Domain_polar_nucleus::affecte_one_coef_val_domain" << endl ;
351 so.
cf->
set(pos_cf) = 1. ;
352 so.
cf->
set(pos_gal_r) = fact_r ;
353 so.
cf->
set(pos_gal_t) = fact_t ;
354 so.
cf->
set(pos_gal_rt) = fact_rt ;
362 cerr <<
"Unknow theta basis in Domain_polar_nucleus::affecte_coef_val_domain" << endl ;
387 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.
void affecte_tau_one_coef_val_domain(Val_domain &so, int mquant, int llim, int cc, int &pos_cf) const
Sets at most one coefficient of a Val_domain to 1.
virtual void affecte_tau_one_coef(Tensor &, int, int, int &) const
Sets at most one coefficient of a Tensor to 1.
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 set_zero()
Sets the Val_domain to zero (logical state to zero and arrays destroyed).
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.
bool is_zero
Indicator used for null fields (for speed issues).
const Base_spectral & get_base() const
Returns the basis of decomposition.