29char cmp_import_symy_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_import_symy.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_symy : 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_symy : the dzpuis of the Cmp to be imported"
149 <<
" must be zero !" << endl ;
154 const Mg3d* mg_a =
mp->get_mg() ;
158 assert(nzet <= nz_a) ;
170 va.set_etat_c_qcq() ;
172 va.c->set_etat_qcq() ;
178 double xx_a, yy_a, zz_a ;
180 xx_a = mp_d->get_ori_x() -
mp->get_ori_x() ;
181 yy_a = mp_d->get_ori_y() -
mp->get_ori_y() ;
184 xx_a =
mp->get_ori_x() - mp_d->get_ori_x() ;
185 yy_a =
mp->get_ori_y() - mp_d->get_ori_y() ;
187 zz_a =
mp->get_ori_z() - mp_d->get_ori_z() ;
193 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
194 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
195 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
196 if ( (
mp->x).c == 0x0 ) (
mp->x).fait() ;
197 if ( (
mp->y).c == 0x0 ) (
mp->y).fait() ;
198 if ( (
mp->z).c == 0x0 ) (
mp->z).fait() ;
200 const Mtbl* mr_a = (
mp->r).c ;
201 const Mtbl* mtet_a = (
mp->tet).c ;
202 const Mtbl* mphi_a = (
mp->phi).c ;
203 const Mtbl* mx_a = (
mp->x).c ;
204 const Mtbl* my_a = (
mp->y).c ;
205 const Mtbl* mz_a = (
mp->z).c ;
210 double precis = 1e-15 ;
219 for (
int l=0; l < nzet; l++) {
221 int nr = mg_a->
get_nr(l) ;
222 int nt = mg_a->
get_nt(l) ;
223 int np = mg_a->
get_np(l) ;
226 const double* pr_a = mr_a->
t[l]->
t ;
227 const double* ptet_a = mtet_a->
t[l]->
t ;
228 const double* pphi_a = mphi_a->
t[l]->
t ;
229 const double* px_a = mx_a->
t[l]->
t ;
230 const double* py_a = my_a->
t[l]->
t ;
231 const double* pz_a = mz_a->
t[l]->
t ;
235 double* ptx = (
va.c->t[l])->t ;
242 for (
int k=0 ; k<np/2+1 ; k++) {
243 for (
int j=0 ; j<nt ; j++) {
244 for (
int i=0 ; i<nr ; i++) {
247 double rd, tetd, phid ;
248 if (
r == __infinity) {
251 phid = *pphi_a + M_PI ;
252 if (phid < 0) phid += 2*M_PI ;
257 double xd = - *px_a + xx_a ;
258 double yd = - *py_a + yy_a ;
259 double zd = *pz_a + zz_a ;
262 double rhod2 = xd*xd + yd*yd ;
263 double rhod =
sqrt( rhod2 ) ;
264 rd =
sqrt(rhod2 + zd*zd) ;
265 tetd = atan2(rhod, zd) ;
266 phid = atan2(yd, xd) ;
267 if (phid < 0) phid += 2*M_PI ;
280 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
301 for (
int k=np/2+1 ; k<np ; k++) {
305 double* ptx_symy = (
va.c->t[l])->t + (np-k)*nt*nr ;
308 for (
int j=0 ; j<nt ; j++) {
309 for (
int i=0 ; i<nr ; i++) {
345 if (cm_d.
etat == ETATZERO) {
350 const Map* mp_d = cm_d.
mp ;
354 int align = (
mp->get_bvect_cart()).get_align() ;
356 assert( align * (mp_d->get_bvect_cart()).get_align() == 1 ) ;
358 assert(cm_d.
etat == ETATQCQ) ;
362 "Cmp::import_align_symy : the dzpuis of the Cmp to be imported"
363 <<
" must be zero !" << endl ;
368 const Mg3d* mg_a =
mp->get_mg() ;
372 assert(nzet <= nz_a) ;
384 va.set_etat_c_qcq() ;
386 va.c->set_etat_qcq() ;
392 double xx_a, yy_a, zz_a ;
394 xx_a =
mp->get_ori_x() - mp_d->get_ori_x() ;
395 yy_a =
mp->get_ori_y() - mp_d->get_ori_y() ;
398 xx_a = mp_d->get_ori_x() -
mp->get_ori_x() ;
399 yy_a = mp_d->get_ori_y() -
mp->get_ori_y() ;
401 zz_a =
mp->get_ori_z() - mp_d->get_ori_z() ;
407 if ( (
mp->r).c == 0x0 ) (
mp->r).fait() ;
408 if ( (
mp->tet).c == 0x0 ) (
mp->tet).fait() ;
409 if ( (
mp->phi).c == 0x0 ) (
mp->phi).fait() ;
410 if ( (
mp->x).c == 0x0 ) (
mp->x).fait() ;
411 if ( (
mp->y).c == 0x0 ) (
mp->y).fait() ;
412 if ( (
mp->z).c == 0x0 ) (
mp->z).fait() ;
414 const Mtbl* mr_a = (
mp->r).c ;
415 const Mtbl* mtet_a = (
mp->tet).c ;
416 const Mtbl* mphi_a = (
mp->phi).c ;
417 const Mtbl* mx_a = (
mp->x).c ;
418 const Mtbl* my_a = (
mp->y).c ;
419 const Mtbl* mz_a = (
mp->z).c ;
424 double precis = 1e-15 ;
433 for (
int l=0; l < nzet; l++) {
435 int nr = mg_a->
get_nr(l) ;
436 int nt = mg_a->
get_nt(l) ;
437 int np = mg_a->
get_np(l) ;
440 const double* pr_a = mr_a->
t[l]->
t ;
441 const double* ptet_a = mtet_a->
t[l]->
t ;
442 const double* pphi_a = mphi_a->
t[l]->
t ;
443 const double* px_a = mx_a->
t[l]->
t ;
444 const double* py_a = my_a->
t[l]->
t ;
445 const double* pz_a = mz_a->
t[l]->
t ;
449 double* ptx = (
va.c->t[l])->t ;
457 for (
int k=0 ; k<np/2+1 ; k++) {
458 for (
int j=0 ; j<nt ; j++) {
459 for (
int i=0 ; i<nr ; i++) {
462 double rd, tetd, phid ;
463 if (
r == __infinity) {
471 double xd = *px_a + xx_a ;
472 double yd = *py_a + yy_a ;
473 double zd = *pz_a + zz_a ;
476 double rhod2 = xd*xd + yd*yd ;
477 double rhod =
sqrt( rhod2 ) ;
478 rd =
sqrt(rhod2 + zd*zd) ;
479 tetd = atan2(rhod, zd) ;
480 phid = atan2(yd, xd) ;
481 if (phid < 0) phid += 2*M_PI ;
494 mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
516 for (
int k=np/2+1 ; k<np ; k++) {
520 double* ptx_symy = (
va.c->t[l])->t + (np-k)*nt*nr ;
523 for (
int j=0 ; j<nt ; j++) {
524 for (
int i=0 ; i<nr ; i++) {
const Map * mp
Reference mapping.
Cmp(const Map &map)
Constructor from mapping.
void import_align_symy(int nzet, const Cmp &ci)
Assignment to another Cmp defined on a different mapping, when the two mappings have aligned Cartesia...
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 set_dzpuis(int)
Set a value to dzpuis.
void import_symy(const Cmp &ci)
Assignment to another Cmp defined on a different mapping.
void del_t()
Logical destructor.
void import_anti_symy(int nzet, const Cmp &ci)
Assignment to another Cmp defined on a different mapping, when the two mappings have anti-aligned Car...
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_symy(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