29char cmp_import_asymy_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_import_asymy.C,v 1.3 2014/10/13 08:52:47 j_novak Exp $" ;
69 int nz =
mp->get_mg()->get_nzone() ;
81 const Map* mp_d = cm_d.
mp ;
94 int align_rel = (
mp->get_bvect_cart()).get_align()
95 * (mp_d->get_bvect_cart()).get_align() ;
110 cout <<
"Cmp::import_asymy : unexpected value of align_rel : "
111 << align_rel << endl ;
131 if (cm_d.
etat == ETATZERO) {
136 const Map* mp_d = cm_d.
mp ;
140 int align = (
mp->get_bvect_cart()).get_align() ;
142 assert( align * (mp_d->get_bvect_cart()).get_align() == -1 ) ;
144 assert(cm_d.
etat == ETATQCQ) ;
148 "Cmp::import_anti_asymy : the dzpuis of the Cmp to be imported"
149 <<
" must be zero !" << endl ;
154 const Mg3d* mg_a =
mp->get_mg() ;
159 assert(nzet <= nz_a) ;
171 va.set_etat_c_qcq() ;
173 va.c->set_etat_qcq() ;
179 double xx_a, yy_a, zz_a ;
181 xx_a = mp_d->get_ori_x() -
mp->get_ori_x() ;
182 yy_a = mp_d->get_ori_y() -
mp->get_ori_y() ;
185 xx_a =
mp->get_ori_x() - mp_d->get_ori_x() ;
186 yy_a =
mp->get_ori_y() - mp_d->get_ori_y() ;
188 zz_a =
mp->get_ori_z() - mp_d->get_ori_z() ;
194 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
195 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
196 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
197 if ( (
mp->x).c == 0x0 ) (
mp->x).fait() ;
198 if ( (
mp->y).c == 0x0 ) (
mp->y).fait() ;
199 if ( (
mp->z).c == 0x0 ) (
mp->z).fait() ;
201 const Mtbl* mr_a = (
mp->r).c ;
202 const Mtbl* mtet_a = (
mp->tet).c ;
203 const Mtbl* mphi_a = (
mp->phi).c ;
204 const Mtbl* mx_a = (
mp->x).c ;
205 const Mtbl* my_a = (
mp->y).c ;
206 const Mtbl* mz_a = (
mp->z).c ;
211 double precis = 1e-15 ;
220 for (
int l=0; l < nzet; l++) {
222 int nr = mg_a->
get_nr(l) ;
223 int nt = mg_a->
get_nt(l) ;
224 int np = mg_a->
get_np(l) ;
227 const double* pr_a = mr_a->
t[l]->
t ;
228 const double* ptet_a = mtet_a->
t[l]->
t ;
229 const double* pphi_a = mphi_a->
t[l]->
t ;
230 const double* px_a = mx_a->
t[l]->
t ;
231 const double* py_a = my_a->
t[l]->
t ;
232 const double* pz_a = mz_a->
t[l]->
t ;
236 double* ptx = (
va.c->t[l])->t ;
244 for (
int i=0; i<ntnr; i++) {
257 for (
int k=1 ; k<np/2 ; k++) {
258 for (
int j=0 ; j<nt ; j++) {
259 for (
int i=0 ; i<nr ; i++) {
262 double rd, tetd, phid ;
263 if (
r == __infinity) {
266 phid = *pphi_a + M_PI ;
267 if (phid < 0) phid += 2*M_PI ;
272 double xd = - *px_a + xx_a ;
273 double yd = - *py_a + yy_a ;
274 double zd = *pz_a + zz_a ;
277 double rhod2 = xd*xd + yd*yd ;
278 double rhod =
sqrt( rhod2 ) ;
279 rd =
sqrt(rhod2 + zd*zd) ;
280 tetd = atan2(rhod, zd) ;
281 phid = atan2(yd, xd) ;
282 if (phid < 0) phid += 2*M_PI ;
295 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
314 for (
int i=0; i<ntnr; i++) {
330 for (
int k=np/2+1 ; k<np ; k++) {
334 double* ptx_symy = (
va.c->t[l])->t + (np-k)*nt*nr ;
337 for (
int j=0 ; j<nt ; j++) {
338 for (
int i=0 ; i<nr ; i++) {
339 *ptx = - (*ptx_symy) ;
374 if (cm_d.
etat == ETATZERO) {
379 const Map* mp_d = cm_d.
mp ;
383 int align = (
mp->get_bvect_cart()).get_align() ;
385 assert( align * (mp_d->get_bvect_cart()).get_align() == 1 ) ;
387 assert(cm_d.
etat == ETATQCQ) ;
391 "Cmp::import_align_asymy : the dzpuis of the Cmp to be imported"
392 <<
" must be zero !" << endl ;
397 const Mg3d* mg_a =
mp->get_mg() ;
401 assert(nzet <= nz_a) ;
413 va.set_etat_c_qcq() ;
415 va.c->set_etat_qcq() ;
421 double xx_a, yy_a, zz_a ;
423 xx_a =
mp->get_ori_x() - mp_d->get_ori_x() ;
424 yy_a =
mp->get_ori_y() - mp_d->get_ori_y() ;
427 xx_a = mp_d->get_ori_x() -
mp->get_ori_x() ;
428 yy_a = mp_d->get_ori_y() -
mp->get_ori_y() ;
430 zz_a =
mp->get_ori_z() - mp_d->get_ori_z() ;
436 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
437 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
438 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
439 if ( (
mp->x).c == 0x0 ) (
mp->x).fait() ;
440 if ( (
mp->y).c == 0x0 ) (
mp->y).fait() ;
441 if ( (
mp->z).c == 0x0 ) (
mp->z).fait() ;
443 const Mtbl* mr_a = (
mp->r).c ;
444 const Mtbl* mtet_a = (
mp->tet).c ;
445 const Mtbl* mphi_a = (
mp->phi).c ;
446 const Mtbl* mx_a = (
mp->x).c ;
447 const Mtbl* my_a = (
mp->y).c ;
448 const Mtbl* mz_a = (
mp->z).c ;
453 double precis = 1e-15 ;
462 for (
int l=0; l < nzet; l++) {
464 int nr = mg_a->
get_nr(l) ;
465 int nt = mg_a->
get_nt(l) ;
466 int np = mg_a->
get_np(l) ;
469 const double* pr_a = mr_a->
t[l]->
t ;
470 const double* ptet_a = mtet_a->
t[l]->
t ;
471 const double* pphi_a = mphi_a->
t[l]->
t ;
472 const double* px_a = mx_a->
t[l]->
t ;
473 const double* py_a = my_a->
t[l]->
t ;
474 const double* pz_a = mz_a->
t[l]->
t ;
478 double* ptx = (
va.c->t[l])->t ;
487 for (
int i=0; i<ntnr; i++) {
500 for (
int k=1 ; k<np/2 ; k++) {
501 for (
int j=0 ; j<nt ; j++) {
502 for (
int i=0 ; i<nr ; i++) {
505 double rd, tetd, phid ;
506 if (
r == __infinity) {
514 double xd = *px_a + xx_a ;
515 double yd = *py_a + yy_a ;
516 double zd = *pz_a + zz_a ;
519 double rhod2 = xd*xd + yd*yd ;
520 double rhod =
sqrt( rhod2 ) ;
521 rd =
sqrt(rhod2 + zd*zd) ;
522 tetd = atan2(rhod, zd) ;
523 phid = atan2(yd, xd) ;
524 if (phid < 0) phid += 2*M_PI ;
537 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
557 for (
int i=0; i<ntnr; i++) {
573 for (
int k=np/2+1 ; k<np ; k++) {
577 double* ptx_symy = (
va.c->t[l])->t + (np-k)*nt*nr ;
580 for (
int j=0 ; j<nt ; j++) {
581 for (
int i=0 ; i<nr ; i++) {
582 *ptx = - (*ptx_symy) ;
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 set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void import_anti_asymy(int nzet, const Cmp &ci)
Assignment to another Cmp defined on a different mapping, when the two mappings have anti-aligned Car...
void set_dzpuis(int)
Set a value to dzpuis.
void import_align_asymy(int nzet, const Cmp &ci)
Assignment to another Cmp defined on a different mapping, when the two mappings have aligned Cartesia...
void del_t()
Logical destructor.
void import_asymy(const Cmp &ci)
Assignment to another Cmp defined on a different mapping.
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.
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