20 #include "headcpp.hpp"
21 #include "spheric_symphi.hpp"
22 #include "array_math.hpp"
24 #include "tensor_impl.hpp"
43 cerr <<
"Unknown case in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
54 double fact_t, fact_r, fact_rt ;
57 int mquant, kmin, kmax ;
78 cerr <<
"Unknow phi basis in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
86 for (
int k=kmin ; k<=kmax ; k++) {
102 cerr <<
"Unknow phi basis in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
119 assert ((baser==LEG_EVEN) || (baser==CHEB_EVEN)) ;
122 if ((mquant==0) && (lquant==0)) {
124 sec.
set(pos_sec) = (*so.
cf)(pos_cf) ;
128 else if (mquant==0) {
129 if ((i!=0) && (i!=
nbr_coefs(0)-rlim+1)) {
132 pos_gal_r.
set(0) = 0 ;
135 fact_r = - 2 * pow(-1, i) ;
138 fact_r = -double(4*i+1) ;
139 for (
int t=0 ; t<i ; t++)
140 fact_r *= -
double(2*t+1)/double(2*t+2) ;
144 cerr <<
"Strange base in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
148 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) ;
152 else if ((j!=0) && (i!=0) && (i!=
nbr_coefs(0)-rlim+1)) {
155 pos_gal_r.
set(0) = 0 ;
157 pos_gal_t.
set(1) = 0 ;
158 pos_gal_rt = pos_cf ;
159 pos_gal_rt.
set(0) = 0 ;
160 pos_gal_rt.
set(1) = 0 ;
163 fact_r = -2*pow(-1, i) ;
165 fact_rt = 4*pow(-1, i) ;
169 for (
int t=0 ; t<i ; t++)
170 l0 *= -
double(2*t+1)/double(2*t+2) ;
171 fact_r = - l0 * double(4*i+1) ;
173 fact_rt = 2*double(4*i+1)*l0 ;
177 cerr <<
"Strange base in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
180 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) +
181 fact_t*(*so.
cf)(pos_gal_t) + fact_rt*(*so.
cf)(pos_gal_rt) ;
186 assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
190 if ((mquant==0) && (lquant<=1)) {
192 sec.
set(pos_sec) = (*so.
cf)(pos_cf) ;
196 if ((mquant==0) && (i!=0)) {
199 pos_gal_r.
set(0) = 0 ;
202 fact_r = - (2*i+1) * pow(-1, i) ;
205 fact_r = -double(4*i+3)/3. ;
206 for (
int t=0 ; t<i ; t++)
207 fact_r *= -
double(2*t+3)/double(2*t+2) ;
211 cerr <<
"Strange base in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
214 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) ;
217 else if ((j!=0) && (i!=0)) {
220 pos_gal_r.
set(0) = 0 ;
222 pos_gal_t.
set(1) = 0 ;
223 pos_gal_rt = pos_cf ;
224 pos_gal_rt.
set(0) = 0 ;
225 pos_gal_rt.
set(1) = 0 ;
228 fact_r = -pow(-1, i)*(2*i+1) ;
230 fact_rt = pow(-1, i)*(2*i+1) ;
234 for (
int t=0 ; t<i ; t++)
235 l0 *= -
double(2*t+3)/double(2*t+2) ;
236 fact_r = - l0 * double(4*i+3)/3. ;
238 fact_rt = l0*double(4*i+3)/3. ;
242 cerr <<
"Strange base in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
245 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) +
246 fact_t*(*so.
cf)(pos_gal_t) + fact_rt*(*so.
cf)(pos_gal_rt) ;
255 assert ((baser==CHEB_EVEN) || (baser==LEG_EVEN)) ;
257 if ((mquant<=1) && (lquant==0)) {
259 sec.
set(pos_sec) = (*so.
cf)(pos_cf) ;
263 if ((mquant<=1) && (i!=0)) {
266 pos_gal_r.
set(0) = 0 ;
269 fact_r = - 2 * pow(-1, i) ;
272 fact_r = -double(4*i+1) ;
273 for (
int t=0 ; t<i ; t++)
274 fact_r *= -
double(2*t+1)/double(2*t+2) ;
278 cerr <<
"Strange base in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
281 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) ;
285 if ((j!=1) && (i!=0)) {
288 pos_gal_r.
set(0) = 0 ;
290 pos_gal_t.
set(1) = 1 ;
291 pos_gal_rt = pos_cf ;
292 pos_gal_rt.
set(0) = 0 ;
293 pos_gal_rt.
set(1) = 1 ;
296 fact_r = -pow(-1, i) ;
298 fact_rt = pow(-1, i)*j ;
302 for (
int t=0 ; t<i ; t++)
303 l0 *= -
double(2*t+1)/double(2*t+2) ;
310 cerr <<
"Strange base in Domain_nucleus_symphi::affecte_tau_val_domain" << endl ;
313 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) +
314 fact_t*(*so.
cf)(pos_gal_t) + fact_rt*(*so.
cf)(pos_gal_rt) ;
324 assert ((baser==CHEB_ODD) || (baser==LEG_ODD)) ;
327 if ((mquant<=1) && (lquant<=1)) {
329 sec.
set(pos_sec) = (*so.
cf)(pos_cf) ;
333 if ((mquant<=1) && (i!=0)) {
336 pos_gal_r.
set(0) = 0 ;
339 fact_r = - (2*i+1) * pow(-1, i) ;
342 fact_r = -double(4*i+3)/3. ;
343 for (
int t=0 ; t<i ; t++)
344 fact_r *= -
double(2*t+3)/double(2*t+2) ;
348 cerr <<
"Strange base in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
351 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) ;
354 else if ((j!=0) && (i!=0)) {
357 pos_gal_r.
set(0) = 0 ;
359 pos_gal_t.
set(1) = 0 ;
360 pos_gal_rt = pos_cf ;
361 pos_gal_rt.
set(0) = 0 ;
362 pos_gal_rt.
set(1) = 0 ;
365 fact_r = -pow(-1, i)*(2*i+1) ;
367 fact_rt = pow(-1, i)*(2*i+1)*(2*j+1) ;
371 for (
int t=0 ; t<i ; t++)
372 l0 *= -
double(2*t+3)/double(2*t+2) ;
373 fact_r = - l0 * double(4*i+3)/3. ;
375 fact_rt = l0*double(4*i+3)/3.*(2*j+1) ;
379 cerr <<
"Strange base in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
382 sec.
set(pos_sec) = (*so.
cf)(pos_cf) + fact_r*(*so.
cf)(pos_gal_r) +
383 fact_t*(*so.
cf)(pos_gal_t) + fact_rt*(*so.
cf)(pos_gal_rt) ;
390 cerr <<
"Unknow theta basis in Domain_nucleus_symphi::export_tau_val_domain" << endl ;
415 else for (
int i=0 ; i<n_cmp ; i++) {
416 if ((*p_cmp[i])(0)==1)
418 if ((*p_cmp[i])(0)==2)
420 if ((*p_cmp[i])(0)==3)
427 cerr <<
"Unknown type of vector Domain_nucleus_symphi::export_tau" << endl ;
444 else for (
int i=0 ; i<n_cmp ; i++) {
445 if (((*p_cmp[i])(0)==1) && ((*p_cmp[i])(1)==1))
447 if (((*p_cmp[i])(0)==1) && ((*p_cmp[i])(1)==2))
449 if (((*p_cmp[i])(0)==1) && ((*p_cmp[i])(1)==3))
451 if (((*p_cmp[i])(0)==2) && ((*p_cmp[i])(1)==2))
453 if (((*p_cmp[i])(0)==2) && ((*p_cmp[i])(1)==3))
455 if (((*p_cmp[i])(0)==3) && ((*p_cmp[i])(1)==3))
473 else for (
int i=0 ; i<n_cmp ; i++) {
474 if (((*p_cmp[i])(0)==1) && ((*p_cmp[i])(1)==1))
476 if (((*p_cmp[i])(0)==1) && ((*p_cmp[i])(1)==2))
478 if (((*p_cmp[i])(0)==1) && ((*p_cmp[i])(1)==3))
480 if (((*p_cmp[i])(0)==2) && ((*p_cmp[i])(1)==1))
482 if (((*p_cmp[i])(0)==2) && ((*p_cmp[i])(1)==2))
484 if (((*p_cmp[i])(0)==2) && ((*p_cmp[i])(1)==3))
486 if (((*p_cmp[i])(0)==3) && ((*p_cmp[i])(1)==1))
488 if (((*p_cmp[i])(0)==3) && ((*p_cmp[i])(1)==2))
490 if (((*p_cmp[i])(0)==3) && ((*p_cmp[i])(1)==3))
496 cerr <<
"Unknown type of 2-tensor Domain_nucleus_symphi::export_tau" << endl ;
502 cerr <<
"Valence " << val <<
" not implemented in Domain_nucleus_symphi::export_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.
void export_tau_val_domain(const Val_domain &eq, int order, Array< double > &res, int &pos_res, int ncond) const
Exports a residual equation in the bulk.
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.
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.
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.
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.