28char cmp_import_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_import.C,v 1.3 2014/10/13 08:52:47 j_novak Exp $" ;
75 int nz =
mp->get_mg()->get_nzone() ;
87 const Map* mp_d = cm_d.
mp ;
100 int align_rel = (
mp->get_bvect_cart()).get_align()
101 * (mp_d->get_bvect_cart()).get_align() ;
121 cout <<
"Cmp::import : unexpected value of align_rel : "
122 << align_rel << endl ;
138 const Map* mp_d = cm_d.
mp ;
151 if (cm_d.
etat == ETATZERO) {
159 assert(cm_d.
etat != ETATNONDEF) ;
163 "Cmp::import : the dzpuis of the Cmp to be imported must be zero !"
169 const Mg3d* mg_a =
mp->get_mg() ;
171 assert(nzet <= nz_a) ;
176 assert(cm_d.
etat == ETATQCQ) ;
187 va.set_etat_c_qcq() ;
189 va.c->set_etat_qcq() ;
194 double xo_d = mp_d->get_ori_x() ;
195 double yo_d = mp_d->get_ori_y() ;
196 double zo_d = mp_d->get_ori_z() ;
199 double rot_phi_d = mp_d->get_rot_phi() ;
202 double rot_phi_a =
mp->get_rot_phi() ;
207 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
208 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
209 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
210 if ( (
mp->xa).c == 0x0 ) (
mp->xa).fait() ;
211 if ( (
mp->ya).c == 0x0 ) (
mp->ya).fait() ;
212 if ( (
mp->za).c == 0x0 ) (
mp->za).fait() ;
214 const Mtbl* mr_a = (
mp->r).c ;
215 const Mtbl* mtet_a = (
mp->tet).c ;
216 const Mtbl* mphi_a = (
mp->phi).c ;
217 const Mtbl* mxa_a = (
mp->xa).c ;
218 const Mtbl* mya_a = (
mp->ya).c ;
219 const Mtbl* mza_a = (
mp->za).c ;
224 double precis = 1e-15 ;
233 for (
int l=0; l < nzet; l++) {
235 int nr = mg_a->
get_nr(l) ;
236 int nt = mg_a->
get_nt(l) ;
237 int np = mg_a->
get_np(l) ;
240 const double* pr_a = mr_a->
t[l]->
t ;
241 const double* ptet_a = mtet_a->
t[l]->
t ;
242 const double* pphi_a = mphi_a->
t[l]->
t ;
243 const double* pxa_a = mxa_a->
t[l]->
t ;
244 const double* pya_a = mya_a->
t[l]->
t ;
245 const double* pza_a = mza_a->
t[l]->
t ;
249 double* ptx = (
va.c->t[l])->t ;
254 for (
int k=0 ; k<np ; k++) {
255 for (
int j=0 ; j<nt ; j++) {
256 for (
int i=0 ; i<nr ; i++) {
259 double rd, tetd, phid ;
260 if (
r == __infinity) {
263 phid = *pphi_a + rot_phi_a - rot_phi_d ;
264 if (phid < 0) phid += 2*M_PI ;
270 double xd = *pxa_a - xo_d ;
271 double yd = *pya_a - yo_d ;
272 double zd = *pza_a - zo_d ;
275 double rhod2 = xd*xd + yd*yd ;
276 double rhod =
sqrt( rhod2 ) ;
277 rd =
sqrt(rhod2 + zd*zd) ;
278 tetd = atan2(rhod, zd) ;
279 phid = atan2(yd, xd) - rot_phi_d ;
280 if (phid < 0) phid += 2*M_PI ;
293 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
340 if (cm_d.
etat == ETATZERO) {
345 const Map* mp_d = cm_d.
mp ;
349 int align = (
mp->get_bvect_cart()).get_align() ;
351 assert( align * (mp_d->get_bvect_cart()).get_align() == -1 ) ;
353 assert(cm_d.
etat == ETATQCQ) ;
357 "Cmp::import : the dzpuis of the Cmp to be imported must be zero !"
363 const Mg3d* mg_a =
mp->get_mg() ;
365 assert(nzet <= nz_a) ;
377 va.set_etat_c_qcq() ;
379 va.c->set_etat_qcq() ;
385 double xx_a, yy_a, zz_a ;
387 xx_a = mp_d->get_ori_x() -
mp->get_ori_x() ;
388 yy_a = mp_d->get_ori_y() -
mp->get_ori_y() ;
391 xx_a =
mp->get_ori_x() - mp_d->get_ori_x() ;
392 yy_a =
mp->get_ori_y() - mp_d->get_ori_y() ;
394 zz_a =
mp->get_ori_z() - mp_d->get_ori_z() ;
400 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
401 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
402 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
403 if ( (
mp->x).c == 0x0 ) (
mp->x).fait() ;
404 if ( (
mp->y).c == 0x0 ) (
mp->y).fait() ;
405 if ( (
mp->z).c == 0x0 ) (
mp->z).fait() ;
407 const Mtbl* mr_a = (
mp->r).c ;
408 const Mtbl* mtet_a = (
mp->tet).c ;
409 const Mtbl* mphi_a = (
mp->phi).c ;
410 const Mtbl* mx_a = (
mp->x).c ;
411 const Mtbl* my_a = (
mp->y).c ;
412 const Mtbl* mz_a = (
mp->z).c ;
417 double precis = 1e-15 ;
426 for (
int l=0; l < nzet; l++) {
428 int nr = mg_a->
get_nr(l) ;
429 int nt = mg_a->
get_nt(l) ;
430 int np = mg_a->
get_np(l) ;
433 const double* pr_a = mr_a->
t[l]->
t ;
434 const double* ptet_a = mtet_a->
t[l]->
t ;
435 const double* pphi_a = mphi_a->
t[l]->
t ;
436 const double* px_a = mx_a->
t[l]->
t ;
437 const double* py_a = my_a->
t[l]->
t ;
438 const double* pz_a = mz_a->
t[l]->
t ;
442 double* ptx = (
va.c->t[l])->t ;
447 for (
int k=0 ; k<np ; k++) {
448 for (
int j=0 ; j<nt ; j++) {
449 for (
int i=0 ; i<nr ; i++) {
452 double rd, tetd, phid ;
453 if (
r == __infinity) {
456 phid = *pphi_a + M_PI ;
457 if (phid < 0) phid += 2*M_PI ;
462 double xd = - *px_a + xx_a ;
463 double yd = - *py_a + yy_a ;
464 double zd = *pz_a + zz_a ;
467 double rhod2 = xd*xd + yd*yd ;
468 double rhod =
sqrt( rhod2 ) ;
469 rd =
sqrt(rhod2 + zd*zd) ;
470 tetd = atan2(rhod, zd) ;
471 phid = atan2(yd, xd) ;
472 if (phid < 0) phid += 2*M_PI ;
485 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
532 if (cm_d.
etat == ETATZERO) {
537 const Map* mp_d = cm_d.
mp ;
541 int align = (
mp->get_bvect_cart()).get_align() ;
543 assert( align * (mp_d->get_bvect_cart()).get_align() == 1 ) ;
545 assert(cm_d.
etat == ETATQCQ) ;
549 "Cmp::import : the dzpuis of the Cmp to be imported must be zero !"
555 const Mg3d* mg_a =
mp->get_mg() ;
557 assert(nzet <= nz_a) ;
569 va.set_etat_c_qcq() ;
571 va.c->set_etat_qcq() ;
577 double xx_a, yy_a, zz_a ;
579 xx_a =
mp->get_ori_x() - mp_d->get_ori_x() ;
580 yy_a =
mp->get_ori_y() - mp_d->get_ori_y() ;
583 xx_a = mp_d->get_ori_x() -
mp->get_ori_x() ;
584 yy_a = mp_d->get_ori_y() -
mp->get_ori_y() ;
586 zz_a =
mp->get_ori_z() - mp_d->get_ori_z() ;
592 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
593 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
594 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
595 if ( (
mp->x).c == 0x0 ) (
mp->x).fait() ;
596 if ( (
mp->y).c == 0x0 ) (
mp->y).fait() ;
597 if ( (
mp->z).c == 0x0 ) (
mp->z).fait() ;
599 const Mtbl* mr_a = (
mp->r).c ;
600 const Mtbl* mtet_a = (
mp->tet).c ;
601 const Mtbl* mphi_a = (
mp->phi).c ;
602 const Mtbl* mx_a = (
mp->x).c ;
603 const Mtbl* my_a = (
mp->y).c ;
604 const Mtbl* mz_a = (
mp->z).c ;
609 double precis = 1e-15 ;
618 for (
int l=0; l < nzet; l++) {
620 int nr = mg_a->
get_nr(l) ;
621 int nt = mg_a->
get_nt(l) ;
622 int np = mg_a->
get_np(l) ;
625 const double* pr_a = mr_a->
t[l]->
t ;
626 const double* ptet_a = mtet_a->
t[l]->
t ;
627 const double* pphi_a = mphi_a->
t[l]->
t ;
628 const double* px_a = mx_a->
t[l]->
t ;
629 const double* py_a = my_a->
t[l]->
t ;
630 const double* pz_a = mz_a->
t[l]->
t ;
634 double* ptx = (
va.c->t[l])->t ;
639 for (
int k=0 ; k<np ; k++) {
640 for (
int j=0 ; j<nt ; j++) {
641 for (
int i=0 ; i<nr ; i++) {
644 double rd, tetd, phid ;
645 if (
r == __infinity) {
653 double xd = *px_a + xx_a ;
654 double yd = *py_a + yy_a ;
655 double zd = *pz_a + zz_a ;
658 double rhod2 = xd*xd + yd*yd ;
659 double rhod =
sqrt( rhod2 ) ;
660 rd =
sqrt(rhod2 + zd*zd) ;
661 tetd = atan2(rhod, zd) ;
662 phid = atan2(yd, xd) ;
663 if (phid < 0) phid += 2*M_PI ;
676 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
void import(const Cmp &ci)
Assignment to another Cmp defined on a different mapping.
const Map * mp
Reference mapping.
Cmp(const Map &map)
Constructor from mapping.
int dzpuis
Power of r by which the quantity represented by this must be divided in the external compactified z...
Valeur va
The numerical value of the Cmp.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void annule(int l)
Sets the Cmp to zero in a given domain.
void import_anti(int nzet, const Cmp &ci)
Assignment to another Cmp defined on a different mapping, when the two mappings have anti-aligned Car...
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void set_dzpuis(int)
Set a value to dzpuis.
void import_align(int nzet, const Cmp &ci)
Assignment to another Cmp defined on a different mapping, when the two mappings have aligned Cartesia...
void import_gal(int nzet, const Cmp &ci)
Assignment to another Cmp defined on a different mapping, when the two mappings do not have a particu...
void del_t()
Logical destructor.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
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(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.
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.
Cmp sqrt(const Cmp &)
Square root.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord r
r coordinate centered on the grid