77 int nz =
mp->get_mg()->get_nzone() ;
102 int align_rel = (
mp->get_bvect_cart()).get_align()
103 * (mp_d->get_bvect_cart()).get_align() ;
118 cout <<
"Scalar::import_asymy : unexpected value of align_rel : "
119 << align_rel << endl ;
152 int align = (
mp->get_bvect_cart()).get_align() ;
154 assert( align * (mp_d->get_bvect_cart()).get_align() == -1 ) ;
156 assert(cm_d.
get_etat() == ETATQCQ) ;
160 "Scalar::import_anti_asymy : the dzpuis of the Scalar to be imported"
161 <<
" must be zero !" << endl ;
166 const Mg3d* mg_a =
mp->get_mg() ;
171 assert(nzet <= nz_a) ;
183 va.set_etat_c_qcq() ;
185 va.c->set_etat_qcq() ;
191 double xx_a, yy_a, zz_a ;
193 xx_a = mp_d->get_ori_x() -
mp->get_ori_x() ;
194 yy_a = mp_d->get_ori_y() -
mp->get_ori_y() ;
197 xx_a =
mp->get_ori_x() - mp_d->get_ori_x() ;
198 yy_a =
mp->get_ori_y() - mp_d->get_ori_y() ;
200 zz_a =
mp->get_ori_z() - mp_d->get_ori_z() ;
206 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
207 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
208 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
209 if ( (
mp->x).c == 0x0 ) (
mp->x).fait() ;
210 if ( (
mp->y).c == 0x0 ) (
mp->y).fait() ;
211 if ( (
mp->z).c == 0x0 ) (
mp->z).fait() ;
213 const Mtbl* mr_a = (
mp->r).c ;
214 const Mtbl* mtet_a = (
mp->tet).c ;
215 const Mtbl* mphi_a = (
mp->phi).c ;
216 const Mtbl* mx_a = (
mp->x).c ;
217 const Mtbl* my_a = (
mp->y).c ;
218 const Mtbl* mz_a = (
mp->z).c ;
223 double precis = 1e-15 ;
232 for (
int l=0; l < nzet; l++) {
234 int nr = mg_a->
get_nr(l) ;
235 int nt = mg_a->
get_nt(l) ;
236 int np = mg_a->
get_np(l) ;
239 const double* pr_a = mr_a->
t[l]->
t ;
240 const double* ptet_a = mtet_a->
t[l]->
t ;
241 const double* pphi_a = mphi_a->
t[l]->
t ;
242 const double* px_a = mx_a->
t[l]->
t ;
243 const double* py_a = my_a->
t[l]->
t ;
244 const double* pz_a = mz_a->
t[l]->
t ;
248 double* ptx = (
va.c->t[l])->t ;
256 for (
int i=0; i<ntnr; i++) {
269 for (
int k=1 ; k<np/2 ; k++) {
270 for (
int j=0 ; j<nt ; j++) {
271 for (
int i=0 ; i<nr ; i++) {
274 double rd, tetd, phid ;
275 if (
r == __infinity) {
278 phid = *pphi_a + M_PI ;
279 if (phid < 0) phid += 2*M_PI ;
284 double xd = - *px_a + xx_a ;
285 double yd = - *py_a + yy_a ;
286 double zd = *pz_a + zz_a ;
289 double rhod2 = xd*xd + yd*yd ;
290 double rhod =
sqrt( rhod2 ) ;
291 rd =
sqrt(rhod2 + zd*zd) ;
292 tetd = atan2(rhod, zd) ;
293 phid = atan2(yd, xd) ;
294 if (phid < 0) phid += 2*M_PI ;
307 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
326 for (
int i=0; i<ntnr; i++) {
342 for (
int k=np/2+1 ; k<np ; k++) {
346 double* ptx_symy = (
va.c->t[l])->t + (np-k)*nt*nr ;
349 for (
int j=0 ; j<nt ; j++) {
350 for (
int i=0 ; i<nr ; i++) {
351 *ptx = - (*ptx_symy) ;
399 int align = (
mp->get_bvect_cart()).get_align() ;
401 assert( align * (mp_d->get_bvect_cart()).get_align() == 1 ) ;
403 assert(cm_d.
get_etat() == ETATQCQ) ;
407 "Scalar::import_align_asymy : the dzpuis of the Scalar to be imported"
408 <<
" must be zero !" << endl ;
413 const Mg3d* mg_a =
mp->get_mg() ;
417 assert(nzet <= nz_a) ;
429 va.set_etat_c_qcq() ;
431 va.c->set_etat_qcq() ;
437 double xx_a, yy_a, zz_a ;
439 xx_a =
mp->get_ori_x() - mp_d->get_ori_x() ;
440 yy_a =
mp->get_ori_y() - mp_d->get_ori_y() ;
443 xx_a = mp_d->get_ori_x() -
mp->get_ori_x() ;
444 yy_a = mp_d->get_ori_y() -
mp->get_ori_y() ;
446 zz_a =
mp->get_ori_z() - mp_d->get_ori_z() ;
452 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
453 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
454 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
455 if ( (
mp->x).c == 0x0 ) (
mp->x).fait() ;
456 if ( (
mp->y).c == 0x0 ) (
mp->y).fait() ;
457 if ( (
mp->z).c == 0x0 ) (
mp->z).fait() ;
459 const Mtbl* mr_a = (
mp->r).c ;
460 const Mtbl* mtet_a = (
mp->tet).c ;
461 const Mtbl* mphi_a = (
mp->phi).c ;
462 const Mtbl* mx_a = (
mp->x).c ;
463 const Mtbl* my_a = (
mp->y).c ;
464 const Mtbl* mz_a = (
mp->z).c ;
469 double precis = 1e-15 ;
478 for (
int l=0; l < nzet; l++) {
480 int nr = mg_a->
get_nr(l) ;
481 int nt = mg_a->
get_nt(l) ;
482 int np = mg_a->
get_np(l) ;
485 const double* pr_a = mr_a->
t[l]->
t ;
486 const double* ptet_a = mtet_a->
t[l]->
t ;
487 const double* pphi_a = mphi_a->
t[l]->
t ;
488 const double* px_a = mx_a->
t[l]->
t ;
489 const double* py_a = my_a->
t[l]->
t ;
490 const double* pz_a = mz_a->
t[l]->
t ;
494 double* ptx = (
va.c->t[l])->t ;
503 for (
int i=0; i<ntnr; i++) {
516 for (
int k=1 ; k<np/2 ; k++) {
517 for (
int j=0 ; j<nt ; j++) {
518 for (
int i=0 ; i<nr ; i++) {
521 double rd, tetd, phid ;
522 if (
r == __infinity) {
530 double xd = *px_a + xx_a ;
531 double yd = *py_a + yy_a ;
532 double zd = *pz_a + zz_a ;
535 double rhod2 = xd*xd + yd*yd ;
536 double rhod =
sqrt( rhod2 ) ;
537 rd =
sqrt(rhod2 + zd*zd) ;
538 tetd = atan2(rhod, zd) ;
539 phid = atan2(yd, xd) ;
540 if (phid < 0) phid += 2*M_PI ;
553 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
573 for (
int i=0; i<ntnr; i++) {
589 for (
int k=np/2+1 ; k<np ; k++) {
593 double* ptx_symy = (
va.c->t[l])->t + (np-k)*nt*nr ;
596 for (
int j=0 ; j<nt ; j++) {
597 for (
int i=0 ; i<nr ; i++) {
598 *ptx = - (*ptx_symy) ;
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
int get_type_p() const
Returns the type of sampling in the direction: SYM : : symmetry with respect to the transformatio...
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
int get_nzone() const
Returns the number of domains.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
double val_point_asymy(int l, double x, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point, by means of the spectral ...
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
void add_double(const double &x, int position=0)
Adds the the address of a new double to the list.
void add_int_mod(int &n, int position=0)
Adds the address of a new modifiable int to the list.
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
void set_etat_one()
Sets the logical state to ETATUN (one).
void import_asymy(const Scalar &ci)
Assignment to another Scalar defined on a different mapping.
int get_dzpuis() const
Returns dzpuis.
void import_anti_asymy(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have anti-aligned ...
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
Scalar(const Map &mpi)
Constructor from mapping.
const Valeur & get_spectral_va() const
Returns va (read only version).
void del_t()
Logical destructor.
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
void set_dzpuis(int)
Modifies the dzpuis flag.
Valeur va
The numerical value of the Scalar.
friend Scalar sqrt(const Scalar &)
Square root.
void import_align_asymy(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have aligned Carte...
double * t
The array of double.
Values and coefficients of a (real-value) function.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void coef() const
Computes the coeffcients of *this.
const Map & get_mp() const
Returns the mapping.
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord r
r coordinate centered on the grid