20 #include "headcpp.hpp"
23 #include "array_math.hpp"
25 #include "tensor_impl.hpp"
48 cerr <<
"Unknown case in Domain_polar_nucleus_export_tau_val_domain" << endl ;
58 double fact_t, fact_r, fact_rt ;
71 assert ((baser==LEG_EVEN) || (baser==CHEB_EVEN)) ;
74 if ((mquant==0) && (lquant<=llim)) {
76 sec.
set(pos_sec) = (*so.
cf)(pos_cf) ;
84 pos_gal_r.
set(0) = 0 ;
87 fact_r = - 2 * pow(-1, i) ;
90 fact_r = -double(4*i+1) ;
91 for (
int t=0 ; t<i ; t++)
92 fact_r *= -
double(2*t+1)/double(2*t+2) ;
96 cerr <<
"Strange base in Domain_polar_nucleus:export_tau_inside" << endl ;
100 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) ;
104 else if ((j!=0) && (i!=0) && (i!=
nbr_coefs(0)-rlim+1)) {
107 pos_gal_r.
set(0) = 0 ;
109 pos_gal_t.
set(1) = 0 ;
110 pos_gal_rt = pos_cf ;
111 pos_gal_rt.
set(0) = 0 ;
112 pos_gal_rt.
set(1) = 0 ;
115 fact_r = -2*pow(-1, i) ;
117 fact_rt = 4*pow(-1, i) ;
121 for (
int t=0 ; t<i ; t++)
122 l0 *= -
double(2*t+1)/double(2*t+2) ;
123 fact_r = - l0 * double(4*i+1) ;
125 fact_rt = 2*double(4*i+1)*l0 ;
129 cerr <<
"Strange base in Domain_polar_nucleus:export_tau_inside" << endl ;
132 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) +
133 fact_t*(*so.
cf)(pos_gal_t) + fact_rt*(*so.
cf)(pos_gal_rt) ;
138 assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
142 if ((mquant==0) && (lquant<=llim+1)) {
144 sec.
set(pos_sec) = (*so.
cf)(pos_cf) ;
148 if ((mquant==0) && (i!=0)) {
151 pos_gal_r.
set(0) = 0 ;
154 fact_r = - (2*i+1) * pow(-1, i) ;
157 fact_r = -double(4*i+3)/3. ;
158 for (
int t=0 ; t<i ; t++)
159 fact_r *= -
double(2*t+3)/double(2*t+2) ;
163 cerr <<
"Strange base in Domain_polar_nucleus:export_tau_inside" << endl ;
166 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) ;
169 else if ((j!=0) && (i!=0)) {
172 pos_gal_r.
set(0) = 0 ;
174 pos_gal_t.
set(1) = 0 ;
175 pos_gal_rt = pos_cf ;
176 pos_gal_rt.
set(0) = 0 ;
177 pos_gal_rt.
set(1) = 0 ;
180 fact_r = -pow(-1, i)*(2*i+1) ;
182 fact_rt = pow(-1, i)*(2*i+1) ;
186 for (
int t=0 ; t<i ; t++)
187 l0 *= -
double(2*t+3)/double(2*t+2) ;
188 fact_r = - l0 * double(4*i+3)/3. ;
190 fact_rt = l0*double(4*i+3)/3. ;
194 cerr <<
"Strange base in Domain_polar_nucleus:export_tau_inside" << endl ;
197 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) +
198 fact_t*(*so.
cf)(pos_gal_t) + fact_rt*(*so.
cf)(pos_gal_rt) ;
207 assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
209 if ((mquant<=1) && (lquant<=llim)) {
211 sec.
set(pos_sec) = (*so.
cf)(pos_cf) ;
215 if ((mquant<=1) && (i!=0)) {
218 pos_gal_r.
set(0) = 0 ;
221 fact_r = - 2 * pow(-1, i) ;
224 fact_r = -double(4*i+1) ;
225 for (
int t=0 ; t<i ; t++)
226 fact_r *= -
double(2*t+1)/double(2*t+2) ;
230 cerr <<
"Strange base in Domain_polar_nucleus::export_tau_val_domain" << endl ;
233 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) ;
237 if ((j!=1) && (i!=0)) {
240 pos_gal_r.
set(0) = 0 ;
242 pos_gal_t.
set(1) = 1 ;
243 pos_gal_rt = pos_cf ;
244 pos_gal_rt.
set(0) = 0 ;
245 pos_gal_rt.
set(1) = 1 ;
248 fact_r = -pow(-1, i) ;
250 fact_rt = pow(-1, i)*j ;
254 for (
int t=0 ; t<i ; t++)
255 l0 *= -
double(2*t+1)/double(2*t+2) ;
262 cerr <<
"Strange base in Domain_polar_nucleus::affecte_tau_val_domain" << endl ;
265 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) +
266 fact_t*(*so.
cf)(pos_gal_t) + fact_rt*(*so.
cf)(pos_gal_rt) ;
276 assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
279 if ((mquant<=1) && (lquant<=llim+1)) {
281 sec.
set(pos_sec) = (*so.
cf)(pos_cf) ;
285 if ((mquant<=1) && (i!=0)) {
288 pos_gal_r.
set(0) = 0 ;
291 fact_r = - (2*i+1) * pow(-1, i) ;
294 fact_r = -double(4*i+3)/3. ;
295 for (
int t=0 ; t<i ; t++)
296 fact_r *= -
double(2*t+3)/double(2*t+2) ;
300 cerr <<
"Strange base in Domain_polar_nucleus::export_tau_val_domain" << endl ;
303 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) ;
306 else if ((j!=0) && (i!=0)) {
309 pos_gal_r.
set(0) = 0 ;
311 pos_gal_t.
set(1) = 0 ;
312 pos_gal_rt = pos_cf ;
313 pos_gal_rt.
set(0) = 0 ;
314 pos_gal_rt.
set(1) = 0 ;
317 fact_r = -pow(-1, i)*(2*i+1) ;
319 fact_rt = pow(-1, i)*(2*i+1)*(2*j+1) ;
323 for (
int t=0 ; t<i ; t++)
324 l0 *= -
double(2*t+3)/double(2*t+2) ;
325 fact_r = - l0 * double(4*i+3)/3. ;
327 fact_rt = l0*double(4*i+3)/3.*(2*j+1) ;
331 cerr <<
"Strange base in Domain_polar_nucleus::export_tau_val_domain" << endl ;
334 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) +
335 fact_t*(*so.
cf)(pos_gal_t) + fact_rt*(*so.
cf)(pos_gal_rt) ;
342 cerr <<
"Unknow theta basis in Domain_polar_nucleus::export_tau_inside" << endl ;
363 cerr <<
"Valence " << val <<
" not implemented in Domain_polar_nucleus::export_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 export_tau(const Tensor &, int, int, Array< double > &, int &, const Array< int > &, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to a tensorial one in the bulk.
void export_tau_val_domain(const Val_domain &eq, int mquant, int llim, int order, Array< double > &res, int &pos_res, int ncond) const
Exports a residual equation in the bulk.
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 .
const Param_tensor & get_parameters() const
Returns a pointer on the possible additional parameter.
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).
Class for storing the basis of decompositions of a field and its values on both the configuration and...
bool check_if_zero() const
Check whether the logical state is zero or not.
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
void coef() const
Computes the coefficients.
const Base_spectral & get_base() const
Returns the basis of decomposition.