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 $" ;
87 const Map* mp_d = cm_d.
mp ;
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 !"
171 assert(nzet <= nz_a) ;
176 assert(cm_d.
etat == ETATQCQ) ;
207 if ( (
mp->
r).c == 0x0 ) (
mp->
r).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() ;
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 ;
353 assert(cm_d.
etat == ETATQCQ) ;
357 "Cmp::import : the dzpuis of the Cmp to be imported must be zero !"
365 assert(nzet <= nz_a) ;
385 double xx_a, yy_a, zz_a ;
400 if ( (
mp->
r).c == 0x0 ) (
mp->
r).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() ;
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 ;
545 assert(cm_d.
etat == ETATQCQ) ;
549 "Cmp::import : the dzpuis of the Cmp to be imported must be zero !"
557 assert(nzet <= nz_a) ;
577 double xx_a, yy_a, zz_a ;
592 if ( (
mp->
r).c == 0x0 ) (
mp->
r).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() ;
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) ;
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
void import(const Cmp &ci)
Assignment to another Cmp defined on a different mapping.
const Map * mp
Reference 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.
Base class for coordinate mappings.
double get_ori_z() const
Returns the z coordinate of the origin.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping,...
Coord y
y coordinate centered on the grid
Coord ya
Absolute y coordinate.
Coord r
r coordinate centered on the grid
double get_ori_y() const
Returns the y coordinate of the origin.
Coord za
Absolute z coordinate.
Coord tet
coordinate centered on the grid
virtual void val_lx(double rr, double theta, double pphi, int &l, double &xi) const =0
Computes the domain index l and the value of corresponding to a point given by its physical coordina...
Coord z
z coordinate centered on the grid
double get_ori_x() const
Returns the x coordinate of the origin.
Coord x
x coordinate centered on the grid
Coord phi
coordinate centered on the grid
double get_rot_phi() const
Returns the angle between the x –axis and X –axis.
Coord xa
Absolute x coordinate.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
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 set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
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.
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c ).
Mtbl * c
Values of the function at the points of the multi-grid
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.