20 #include "headcpp.hpp"
21 #include "spheric_symphi.hpp"
22 #include "array_math.hpp"
24 #include "tensor_impl.hpp"
41 double fact_t, fact_r, fact_rt ;
64 cerr <<
"Unknow phi basis in Domain_nucleus_symphi::affecte_tau_one_coef_val_domain" << endl ;
72 for (
int k=kmin ; k<=kmax ; k++) {
89 cerr <<
"Unknow phi basis in Domain_nucleus_symphi::affecte_tau_one_coef_val_domain" << endl ;
108 if ((mquant==0) && (lquant==0)) {
111 so.
cf->
set(pos_cf) = 1. ;
115 else if (mquant==0) {
121 pos_gal_r.
set(0) = 0 ;
124 fact_r = - pow(-1, i) ;
128 for (
int t=0 ; t<i ; t++)
129 fact_r *= -
double(2*t+1)/double(2*t+2) ;
133 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_one_coef_val_domain" << endl ;
136 so.
cf->
set(pos_cf) = 1 ;
137 so.
cf->
set(pos_gal_r) += fact_r ;
142 else if ((j!=0) && (i!=0)) {
147 pos_gal_r.
set(0) = 0 ;
149 pos_gal_t.
set(1) = 0 ;
150 pos_gal_rt = pos_cf ;
151 pos_gal_rt.
set(0) = 0 ;
152 pos_gal_rt.
set(1) = 0 ;
155 fact_r = -pow(-1, i) ;
157 fact_rt = pow(-1, i) ;
161 for (
int t=0 ; t<i ; t++)
162 l0 *= -
double(2*t+1)/double(2*t+2) ;
169 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_one_coef_val_domain" << endl ;
172 so.
cf->
set(pos_cf) = 1. ;
173 so.
cf->
set(pos_gal_r) = fact_r ;
174 so.
cf->
set(pos_gal_t) = fact_t ;
175 so.
cf->
set(pos_gal_rt) = fact_rt ;
183 if ((mquant==0) && (lquant<=1)) {
186 so.
cf->
set(pos_cf) = 1. ;
191 if ((mquant==0) && (i!=0)) {
195 pos_gal_r.
set(0) = 0 ;
198 fact_r = - (2*i+1) * pow(-1, i) ;
202 for (
int t=0 ; t<i ; t++)
203 fact_r *= -
double(2*t+3)/double(2*t+2) ;
207 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_one_coef_val_domain" << endl ;
211 so.
cf->
set(pos_cf) = 1. ;
212 so.
cf->
set(pos_gal_r) = fact_r ;
216 else if ((j!=0) && (i!=0)) {
221 pos_gal_r.
set(0) = 0 ;
223 pos_gal_t.
set(1) = 0 ;
224 pos_gal_rt = pos_cf ;
225 pos_gal_rt.
set(0) = 0 ;
226 pos_gal_rt.
set(1) = 0 ;
229 fact_r = -pow(-1, i)*(2*i+1) ;
231 fact_rt = pow(-1, i)*(2*i+1) ;
235 for (
int t=0 ; t<i ; t++)
236 l0 *= -
double(2*t+3)/double(2*t+2) ;
243 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_one_coef_val_domain" << endl ;
246 so.
cf->
set(pos_cf) = 1. ;
247 so.
cf->
set(pos_gal_r) = fact_r ;
248 so.
cf->
set(pos_gal_t) = fact_t ;
249 so.
cf->
set(pos_gal_rt) = fact_rt ;
259 if ((mquant<=1) && (lquant==0)) {
262 so.
cf->
set(pos_cf) = 1. ;
267 if ((mquant<=1) && (i!=0)) {
272 pos_gal_r.
set(0) = 0 ;
275 fact_r = - pow(-1, i) ;
279 for (
int t=0 ; t<i ; t++)
280 fact_r *= -
double(2*t+1)/double(2*t+2) ;
284 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_tau_val_domain" << endl ;
287 so.
cf->
set(pos_cf) = 1. ;
288 so.
cf->
set(pos_gal_r) = fact_r ;
294 if ((j!=1) && (i!=0)) {
300 pos_gal_r.
set(0) = 0 ;
302 pos_gal_t.
set(1) = 1 ;
303 pos_gal_rt = pos_cf ;
304 pos_gal_rt.
set(0) = 0 ;
305 pos_gal_rt.
set(1) = 1 ;
308 fact_r = -pow(-1, i) ;
310 fact_rt = pow(-1, i)*j ;
314 for (
int t=0 ; t<i ; t++)
315 l0 *= -
double(2*t+1)/double(2*t+2) ;
322 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_tau_val_domain" << endl ;
325 so.
cf->
set(pos_cf) = 1 ;
326 so.
cf->
set(pos_gal_r) = fact_r ;
327 so.
cf->
set(pos_gal_t) = fact_t ;
328 so.
cf->
set(pos_gal_rt) = fact_rt ;
339 if ((mquant<=1) && (lquant<=1)) {
342 so.
cf->
set(pos_cf) = 1. ;
347 if ((mquant<=1) && (i!=0)) {
351 pos_gal_r.
set(0) = 0 ;
354 fact_r = - (2*i+1) * pow(-1, i) ;
358 for (
int t=0 ; t<i ; t++)
359 fact_r *= -
double(2*t+3)/double(2*t+2) ;
363 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_one_coef_val_domain" << endl ;
367 so.
cf->
set(pos_cf) = 1. ;
368 so.
cf->
set(pos_gal_r) = fact_r ;
372 else if ((j!=0) && (i!=0)) {
377 pos_gal_r.
set(0) = 0 ;
379 pos_gal_t.
set(1) = 0 ;
380 pos_gal_rt = pos_cf ;
381 pos_gal_rt.
set(0) = 0 ;
382 pos_gal_rt.
set(1) = 0 ;
385 fact_r = -pow(-1, i)*(2*i+1) ;
387 fact_rt = pow(-1, i)*(2*i+1)*(2*j+1) ;
391 for (
int t=0 ; t<i ; t++)
392 l0 *= -
double(2*t+3)/double(2*t+2) ;
395 fact_rt = l0*(2*j+1) ;
399 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_one_coef_val_domain" << endl ;
402 so.
cf->
set(pos_cf) = 1. ;
403 so.
cf->
set(pos_gal_r) = fact_r ;
404 so.
cf->
set(pos_gal_t) = fact_t ;
405 so.
cf->
set(pos_gal_rt) = fact_rt ;
415 cerr <<
"Unknow theta basis in Domain_nucleus_symphi::affecte_coef_val_domain" << endl ;
447 cerr <<
"Unknown type of vector Domain_nucleus_symphi::affecte_tau_one_coef" << endl ;
478 cerr <<
"Unknown type of 2-tensor Domain_nucleus_symphi::affecte_tau_one_coef" << endl ;
484 cerr <<
"Valence " << val <<
" not implemented in Domain_nucleus_symphi::affecte_tau" << endl ;
reference set(const Index &pos)
Read/write of an element.
Bases_container bases_1d
Arrays containing the various basis of decomposition.
int get_basis(int nd) const
Read only the basis in a given domain.
virtual void affecte_tau_one_coef(Tensor &, int, int, int &) const
Sets at most one coefficient of a Tensor to 1.
void affecte_tau_one_coef_val_domain(Val_domain &so, int cc, int &pos_cf) const
Sets at most one coefficient of a Val_domain 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.
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.
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
const Base_tensor & get_basis() const
Returns the vectorial basis (triad) on which the components are defined.
int get_n_comp() const
Returns the number of stored components.
int get_valence() const
Returns the valence.
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.