cmp_import.C

00001 /*
00002  * Member function of the Cmp class for initiating a Cmp from a Cmp defined
00003  *  on another mapping.
00004  */
00005 
00006 /*
00007  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00008  *
00009  *   This file is part of LORENE.
00010  *
00011  *   LORENE is free software; you can redistribute it and/or modify
00012  *   it under the terms of the GNU General Public License as published by
00013  *   the Free Software Foundation; either version 2 of the License, or
00014  *   (at your option) any later version.
00015  *
00016  *   LORENE is distributed in the hope that it will be useful,
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *   GNU General Public License for more details.
00020  *
00021  *   You should have received a copy of the GNU General Public License
00022  *   along with LORENE; if not, write to the Free Software
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *
00025  */
00026 
00027 
00028 char cmp_import_C[] = "$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_import.C,v 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon Exp $" ;
00029 
00030 /*
00031  * $Id: cmp_import.C,v 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon Exp $
00032  * $Log: cmp_import.C,v $
00033  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00034  * LORENE
00035  *
00036  * Revision 1.4  2000/02/28  16:46:42  eric
00037  * Version entierement refondue: utilisation de align.
00038  *
00039  * Revision 1.3  2000/02/07  12:32:39  eric
00040  * L'appel d'annule n'est effectue que si nzet < nz_a.
00041  *
00042  * Revision 1.2  1999/12/16  14:33:04  eric
00043  * L'argument precis de Map::val_lax est desormais un Param et non plus
00044  *   un Tbl.
00045  *
00046  * Revision 1.1  1999/12/08  12:38:51  eric
00047  * Initial revision
00048  *
00049  *
00050  * $Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_import.C,v 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon Exp $
00051  *
00052  */
00053 
00054 // Headers C
00055 #include <math.h>
00056 
00057 // Headers Lorene
00058 #include "cmp.h"
00059 #include "param.h"
00060 #include "nbr_spx.h"
00061 
00062             //-------------------------------//
00063             //  Importation in all domains   //
00064             //-------------------------------//
00065 
00066 void Cmp::import(const Cmp& ci) {
00067     
00068     int nz = mp->get_mg()->get_nzone() ; 
00069     
00070     import(nz, ci) ; 
00071         
00072 }
00073 
00074             //--------------------------------------//
00075             //  Importation in inner domains only   //
00076             //--------------------------------------//
00077 
00078 void Cmp::import(int nzet, const Cmp& cm_d) {
00079     
00080     const Map* mp_d = cm_d.mp ; // Departure mapping
00081 
00082     // Trivial case : mappings identical !
00083     // -----------------------------------
00084     
00085     if (mp_d == mp) {
00086     *this = cm_d ; 
00087     return ; 
00088     }
00089     
00090     // Relative orientation of the two mappings
00091     // ----------------------------------------
00092  
00093     int align_rel = (mp->get_bvect_cart()).get_align()  
00094             * (mp_d->get_bvect_cart()).get_align() ;
00095             
00096     switch (align_rel) {
00097 
00098     case 1 : {  // the two mappings have aligned Cartesian axis
00099         import_align(nzet, cm_d) ; 
00100         break ; 
00101     }
00102 
00103     case -1 : {  // the two mappings have anti-aligned Cartesian axis
00104         import_anti(nzet, cm_d) ; 
00105         break ; 
00106     }
00107 
00108     case 0 : {  // general case 
00109         import_gal(nzet, cm_d) ; 
00110         break ; 
00111     }
00112 
00113     default : {  
00114         cout << "Cmp::import : unexpected value of align_rel : " 
00115          << align_rel << endl ; 
00116         abort() ; 
00117         break ; 
00118     }
00119 
00120     }
00121     
00122 }    
00123 
00124             //--------------------------------------//
00125             //     General case (axis not aligned)  //
00126             //--------------------------------------//
00127 
00128 
00129 void Cmp::import_gal(int nzet, const Cmp& cm_d) {
00130     
00131     const Map* mp_d = cm_d.mp ; // Departure mapping
00132 
00133     // Trivial case : mappings identical !
00134     // -----------------------------------
00135     
00136     if (mp_d == mp) {
00137     *this = cm_d ; 
00138     return ; 
00139     }
00140     
00141     // Another trivial case : null Cmp
00142     // -------------------------------
00143     
00144     if (cm_d.etat == ETATZERO) {
00145     set_etat_zero() ; 
00146     return ; 
00147     }
00148 
00149     // Protections
00150     // -----------
00151     
00152     assert(cm_d.etat != ETATNONDEF) ; 
00153 
00154     if (cm_d.dzpuis != 0) {
00155     cout << 
00156     "Cmp::import : the dzpuis of the Cmp to be imported must be zero !"
00157          << endl ; 
00158     abort() ; 
00159     }
00160 
00161 
00162     const Mg3d* mg_a = mp->get_mg() ; 
00163     int nz_a = mg_a->get_nzone() ; 
00164     assert(nzet <= nz_a) ;     
00165 
00166 
00167     // General case :
00168     // -------------
00169     assert(cm_d.etat == ETATQCQ) ;
00170     const Valeur& va_d = cm_d.va ; 
00171     va_d.coef() ;       // The coefficients are required
00172     
00173 
00174     // Preparations for storing the result in *this 
00175     // --------------------------------------------
00176     del_t() ;   // delete all previously computed derived quantities
00177     
00178     set_etat_qcq() ;        // Set the state to ETATQCQ
00179     
00180     va.set_etat_c_qcq() ;   // Allocates the memory for the Mtbl va.c
00181                 //  if it does not exist already
00182     va.c->set_etat_qcq() ;  // Allocates the memory for the Tbl's in each
00183                 //  domain if they do not exist already
00184 
00185 
00186     // Absolute coordinates of the origin of the Departure mapping 
00187     double xo_d = mp_d->get_ori_x() ;     
00188     double yo_d = mp_d->get_ori_y() ;     
00189     double zo_d = mp_d->get_ori_z() ;     
00190 
00191     // Orientation relative to the Absolute frame of the Departure mapping
00192     double rot_phi_d = mp_d->get_rot_phi() ; 
00193 
00194     // Orientation relative to the Absolute frame of the Arrival mapping
00195     double rot_phi_a = mp->get_rot_phi() ; 
00196     
00197     // r, theta, phi, X, Y and Z on the Arrival mapping 
00198     //  update of the corresponding Coord's if necessary
00199     
00200     if ( (mp->r).c == 0x0 ) (mp->r).fait() ; 
00201     if ( (mp->tet).c == 0x0 ) (mp->tet).fait() ; 
00202     if ( (mp->phi).c == 0x0 ) (mp->phi).fait() ; 
00203     if ( (mp->xa).c == 0x0 ) (mp->xa).fait() ; 
00204     if ( (mp->ya).c == 0x0 ) (mp->ya).fait() ; 
00205     if ( (mp->za).c == 0x0 ) (mp->za).fait() ; 
00206 
00207     const Mtbl* mr_a = (mp->r).c ; 
00208     const Mtbl* mtet_a = (mp->tet).c ; 
00209     const Mtbl* mphi_a = (mp->phi).c ; 
00210     const Mtbl* mxa_a = (mp->xa).c ;
00211     const Mtbl* mya_a = (mp->ya).c ;
00212     const Mtbl* mza_a = (mp->za).c ;
00213 
00214     Param par_precis ;      // Required precision in the method Map::val_lx
00215     int nitermax = 100 ;    // Maximum number of iteration in the secant method
00216     int niter ; 
00217     double precis = 1e-15 ; // Absolute precision in the secant method
00218     par_precis.add_int(nitermax) ;  
00219     par_precis.add_int_mod(niter) ; 
00220     par_precis.add_double(precis) ; 
00221 
00222 
00223     // Loop of the Arrival domains where the computation is to be performed
00224     // --------------------------------------------------------------------
00225     
00226     for (int l=0; l < nzet; l++) {
00227     
00228     int nr = mg_a->get_nr(l) ;
00229     int nt = mg_a->get_nt(l) ;
00230     int np = mg_a->get_np(l) ;
00231     
00232     
00233     const double* pr_a = mr_a->t[l]->t ;      // Pointer on the values of r
00234     const double* ptet_a = mtet_a->t[l]->t ;  // Pointer on the values of theta
00235     const double* pphi_a = mphi_a->t[l]->t ;  // Pointer on the values of phi
00236     const double* pxa_a = mxa_a->t[l]->t ;    // Pointer on the values of X
00237     const double* pya_a = mya_a->t[l]->t ;    // Pointer on the values of Y
00238     const double* pza_a = mza_a->t[l]->t ;    // Pointer on the values of Z
00239     
00240     (va.c->t[l])->set_etat_qcq() ;       // Allocates the array of double to
00241                          //  store the result 
00242     double* ptx = (va.c->t[l])->t ;      // Pointer on the allocated array
00243     
00244     
00245     // Loop on all the grid points in the considered arrival domain:
00246         
00247     for (int k=0 ; k<np ; k++) {
00248         for (int j=0 ; j<nt ; j++) {
00249         for (int i=0 ; i<nr ; i++) {
00250 
00251             double r = *pr_a ; 
00252             double rd, tetd, phid ;
00253             if (r == __infinity) {
00254             rd = r ;
00255             tetd = *ptet_a ;
00256             phid = *pphi_a + rot_phi_a - rot_phi_d ;
00257             if (phid < 0) phid += 2*M_PI ;
00258             }
00259             else {
00260             // Coordinates in a Cartesian frame centered on
00261             //  the Departure mapping and whose axes are
00262             //  parallel to those of the Absolue Frame
00263             double xd = *pxa_a - xo_d ;
00264             double yd = *pya_a - yo_d ;
00265             double zd = *pza_a - zo_d ;
00266             
00267             // Spherical coordinates on the Departure mapping
00268             double rhod2 = xd*xd + yd*yd ; 
00269             double rhod = sqrt( rhod2 ) ;
00270             rd = sqrt(rhod2 + zd*zd) ;
00271             tetd = atan2(rhod, zd) ;
00272             phid = atan2(yd, xd) - rot_phi_d ; // (rotation)
00273             if (phid < 0) phid += 2*M_PI ;
00274             }           
00275 
00276 
00277             // NB: to increase the efficiency, the method Cmp::val_point
00278             //  is not invoked; the method Mtbl_cf::val_point is 
00279             //  called directly instead. 
00280 
00281             // Value of the grid coordinates (l,xi) corresponding to
00282             //  (rd,tetd,phid) :
00283             
00284             int ld ;        // domain index
00285             double xxd ;    // radial coordinate xi in [0,1] or [-1,1]
00286             mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
00287 
00288             // Value of the Departure Cmp at the obtained point:
00289             *ptx = va_d.c_cf->val_point(ld, xxd, tetd, phid) ;
00290 
00291             // Next point : 
00292             ptx++ ;   
00293             pr_a++ ;  
00294             ptet_a++ ;  
00295             pphi_a++ ; 
00296             pxa_a++ ;  
00297             pya_a++ ;  
00298             pza_a++ ;  
00299 
00300         }
00301         }
00302     }   
00303     
00304         
00305     }   // End of the loop on the Arrival domains
00306     
00307     // In the remaining domains, *this is set to zero:
00308     // ----------------------------------------------
00309     
00310     if (nzet < nz_a) {
00311     annule(nzet, nz_a - 1) ; 
00312     }
00313     
00314     // Treatment of dzpuis
00315     // -------------------
00316     
00317     
00318     set_dzpuis(0) ; 
00319 
00320 }
00321 
00322 
00323         //-----------------------------------------//
00324         //   Case of Cartesian axis anti-aligned   //
00325         //-----------------------------------------//
00326 
00327 
00328 void Cmp::import_anti(int nzet, const Cmp& cm_d) {
00329     
00330     // Trivial case : null Cmp
00331     // ------------------------
00332     
00333     if (cm_d.etat == ETATZERO) {
00334     set_etat_zero() ; 
00335     return ; 
00336     }
00337 
00338     const Map* mp_d = cm_d.mp ; // Departure mapping
00339 
00340     // Protections
00341     // -----------
00342     int align = (mp->get_bvect_cart()).get_align() ;
00343 
00344     assert( align  * (mp_d->get_bvect_cart()).get_align() == -1 ) ; 
00345     
00346     assert(cm_d.etat == ETATQCQ) ;
00347 
00348     if (cm_d.dzpuis != 0) {
00349     cout << 
00350     "Cmp::import : the dzpuis of the Cmp to be imported must be zero !"
00351          << endl ; 
00352     abort() ; 
00353     }
00354 
00355 
00356     const Mg3d* mg_a = mp->get_mg() ; 
00357     int nz_a = mg_a->get_nzone() ; 
00358     assert(nzet <= nz_a) ;     
00359 
00360     const Valeur& va_d = cm_d.va ; 
00361     va_d.coef() ;       // The coefficients are required
00362     
00363 
00364     // Preparations for storing the result in *this 
00365     // --------------------------------------------
00366     del_t() ;   // delete all previously computed derived quantities
00367     
00368     set_etat_qcq() ;        // Set the state to ETATQCQ
00369     
00370     va.set_etat_c_qcq() ;   // Allocates the memory for the Mtbl va.c
00371                 //  if it does not exist already
00372     va.c->set_etat_qcq() ;  // Allocates the memory for the Tbl's in each
00373                 //  domain if they do not exist already
00374 
00375 
00376     // Departure (x,y,z) coordinates of the origin of the Arrival mapping :
00377 
00378     double xx_a, yy_a, zz_a ; 
00379     if (align == 1) {
00380     xx_a = mp_d->get_ori_x() - mp->get_ori_x() ; 
00381     yy_a = mp_d->get_ori_y() - mp->get_ori_y() ; 
00382     }
00383     else {
00384     xx_a = mp->get_ori_x() - mp_d->get_ori_x() ; 
00385     yy_a = mp->get_ori_y() - mp_d->get_ori_y() ; 
00386     }
00387     zz_a = mp->get_ori_z() - mp_d->get_ori_z() ; 
00388 
00389     
00390     // r, theta, phi, x, y and z on the Arrival mapping 
00391     //  update of the corresponding Coord's if necessary
00392     
00393     if ( (mp->r).c == 0x0 ) (mp->r).fait() ; 
00394     if ( (mp->tet).c == 0x0 ) (mp->tet).fait() ; 
00395     if ( (mp->phi).c == 0x0 ) (mp->phi).fait() ; 
00396     if ( (mp->x).c == 0x0 ) (mp->x).fait() ; 
00397     if ( (mp->y).c == 0x0 ) (mp->y).fait() ; 
00398     if ( (mp->z).c == 0x0 ) (mp->z).fait() ; 
00399 
00400     const Mtbl* mr_a = (mp->r).c ; 
00401     const Mtbl* mtet_a = (mp->tet).c ; 
00402     const Mtbl* mphi_a = (mp->phi).c ; 
00403     const Mtbl* mx_a = (mp->x).c ;
00404     const Mtbl* my_a = (mp->y).c ;
00405     const Mtbl* mz_a = (mp->z).c ;
00406 
00407     Param par_precis ;      // Required precision in the method Map::val_lx
00408     int nitermax = 100 ;    // Maximum number of iteration in the secant method
00409     int niter ; 
00410     double precis = 1e-15 ; // Absolute precision in the secant method
00411     par_precis.add_int(nitermax) ;  
00412     par_precis.add_int_mod(niter) ; 
00413     par_precis.add_double(precis) ; 
00414 
00415 
00416     // Loop of the Arrival domains where the computation is to be performed
00417     // --------------------------------------------------------------------
00418     
00419     for (int l=0; l < nzet; l++) {
00420     
00421     int nr = mg_a->get_nr(l) ;
00422     int nt = mg_a->get_nt(l) ;
00423     int np = mg_a->get_np(l) ;
00424     
00425     
00426     const double* pr_a = mr_a->t[l]->t ;      // Pointer on the values of r
00427     const double* ptet_a = mtet_a->t[l]->t ;  // Pointer on the values of theta
00428     const double* pphi_a = mphi_a->t[l]->t ;  // Pointer on the values of phi
00429     const double* px_a = mx_a->t[l]->t ;      // Pointer on the values of X
00430     const double* py_a = my_a->t[l]->t ;      // Pointer on the values of Y
00431     const double* pz_a = mz_a->t[l]->t ;      // Pointer on the values of Z
00432     
00433     (va.c->t[l])->set_etat_qcq() ;       // Allocates the array of double to
00434                          //  store the result 
00435     double* ptx = (va.c->t[l])->t ;      // Pointer on the allocated array
00436     
00437     
00438     // Loop on all the grid points in the considered arrival domain:
00439         
00440     for (int k=0 ; k<np ; k++) {
00441         for (int j=0 ; j<nt ; j++) {
00442         for (int i=0 ; i<nr ; i++) {
00443 
00444             double r = *pr_a ; 
00445             double rd, tetd, phid ;
00446             if (r == __infinity) {
00447             rd = r ;
00448             tetd = *ptet_a ;
00449             phid = *pphi_a + M_PI ;
00450             if (phid < 0) phid += 2*M_PI ;
00451             }
00452             else {
00453 
00454             // Cartesian coordinates on the Departure mapping
00455             double xd = - *px_a + xx_a ; 
00456             double yd = - *py_a + yy_a ; 
00457             double zd = *pz_a + zz_a ; 
00458 
00459             // Spherical coordinates on the Departure mapping
00460             double rhod2 = xd*xd + yd*yd ; 
00461             double rhod = sqrt( rhod2 ) ;
00462             rd = sqrt(rhod2 + zd*zd) ;
00463             tetd = atan2(rhod, zd) ;
00464             phid = atan2(yd, xd) ; 
00465             if (phid < 0) phid += 2*M_PI ;
00466             }           
00467 
00468 
00469             // NB: to increase the efficiency, the method Cmp::val_point
00470             //  is not invoked; the method Mtbl_cf::val_point is 
00471             //  called directly instead. 
00472 
00473             // Value of the grid coordinates (l,xi) corresponding to
00474             //  (rd,tetd,phid) :
00475             
00476             int ld ;        // domain index
00477             double xxd ;    // radial coordinate xi in [0,1] or [-1,1]
00478             mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
00479 
00480             // Value of the Departure Cmp at the obtained point:
00481             *ptx = va_d.c_cf->val_point(ld, xxd, tetd, phid) ;
00482 
00483             // Next point : 
00484             ptx++ ;   
00485             pr_a++ ;  
00486             ptet_a++ ;  
00487             pphi_a++ ; 
00488             px_a++ ;  
00489             py_a++ ;  
00490             pz_a++ ;  
00491 
00492         }
00493         }
00494     }   
00495     
00496         
00497     }   // End of the loop on the Arrival domains
00498     
00499     // In the remaining domains, *this is set to zero:
00500     // ----------------------------------------------
00501     
00502     if (nzet < nz_a) {
00503     annule(nzet, nz_a - 1) ; 
00504     }
00505     
00506     // Treatment of dzpuis
00507     // -------------------
00508     
00509     
00510     set_dzpuis(0) ; 
00511 
00512 }
00513 
00514 
00515         //-------------------------------------//
00516         //   Case of aligned Cartesian axis    //
00517         //-------------------------------------//
00518 
00519 
00520 void Cmp::import_align(int nzet, const Cmp& cm_d) {
00521     
00522     // Trivial case : null Cmp
00523     // ------------------------
00524     
00525     if (cm_d.etat == ETATZERO) {
00526     set_etat_zero() ; 
00527     return ; 
00528     }
00529 
00530     const Map* mp_d = cm_d.mp ; // Departure mapping
00531 
00532     // Protections
00533     // -----------
00534     int align = (mp->get_bvect_cart()).get_align() ;
00535 
00536     assert( align  * (mp_d->get_bvect_cart()).get_align() == 1 ) ; 
00537     
00538     assert(cm_d.etat == ETATQCQ) ;
00539 
00540     if (cm_d.dzpuis != 0) {
00541     cout << 
00542     "Cmp::import : the dzpuis of the Cmp to be imported must be zero !"
00543          << endl ; 
00544     abort() ; 
00545     }
00546 
00547 
00548     const Mg3d* mg_a = mp->get_mg() ; 
00549     int nz_a = mg_a->get_nzone() ; 
00550     assert(nzet <= nz_a) ;     
00551 
00552     const Valeur& va_d = cm_d.va ; 
00553     va_d.coef() ;       // The coefficients are required
00554     
00555 
00556     // Preparations for storing the result in *this 
00557     // --------------------------------------------
00558     del_t() ;   // delete all previously computed derived quantities
00559     
00560     set_etat_qcq() ;        // Set the state to ETATQCQ
00561     
00562     va.set_etat_c_qcq() ;   // Allocates the memory for the Mtbl va.c
00563                 //  if it does not exist already
00564     va.c->set_etat_qcq() ;  // Allocates the memory for the Tbl's in each
00565                 //  domain if they do not exist already
00566 
00567 
00568     // Departure (x,y,z) coordinates of the origin of the Arrival mapping :
00569 
00570     double xx_a, yy_a, zz_a ; 
00571     if (align == 1) {
00572     xx_a = mp->get_ori_x() - mp_d->get_ori_x() ; 
00573     yy_a = mp->get_ori_y() - mp_d->get_ori_y() ; 
00574     }
00575     else {
00576     xx_a = mp_d->get_ori_x() - mp->get_ori_x() ; 
00577     yy_a = mp_d->get_ori_y() - mp->get_ori_y() ; 
00578     }
00579     zz_a = mp->get_ori_z() - mp_d->get_ori_z() ; 
00580 
00581     
00582     // r, theta, phi, x, y and z on the Arrival mapping 
00583     //  update of the corresponding Coord's if necessary
00584     
00585     if ( (mp->r).c == 0x0 ) (mp->r).fait() ; 
00586     if ( (mp->tet).c == 0x0 ) (mp->tet).fait() ; 
00587     if ( (mp->phi).c == 0x0 ) (mp->phi).fait() ; 
00588     if ( (mp->x).c == 0x0 ) (mp->x).fait() ; 
00589     if ( (mp->y).c == 0x0 ) (mp->y).fait() ; 
00590     if ( (mp->z).c == 0x0 ) (mp->z).fait() ; 
00591 
00592     const Mtbl* mr_a = (mp->r).c ; 
00593     const Mtbl* mtet_a = (mp->tet).c ; 
00594     const Mtbl* mphi_a = (mp->phi).c ; 
00595     const Mtbl* mx_a = (mp->x).c ;
00596     const Mtbl* my_a = (mp->y).c ;
00597     const Mtbl* mz_a = (mp->z).c ;
00598 
00599     Param par_precis ;      // Required precision in the method Map::val_lx
00600     int nitermax = 100 ;    // Maximum number of iteration in the secant method
00601     int niter ; 
00602     double precis = 1e-15 ; // Absolute precision in the secant method
00603     par_precis.add_int(nitermax) ;  
00604     par_precis.add_int_mod(niter) ; 
00605     par_precis.add_double(precis) ; 
00606 
00607 
00608     // Loop of the Arrival domains where the computation is to be performed
00609     // --------------------------------------------------------------------
00610     
00611     for (int l=0; l < nzet; l++) {
00612     
00613     int nr = mg_a->get_nr(l) ;
00614     int nt = mg_a->get_nt(l) ;
00615     int np = mg_a->get_np(l) ;
00616     
00617     
00618     const double* pr_a = mr_a->t[l]->t ;      // Pointer on the values of r
00619     const double* ptet_a = mtet_a->t[l]->t ;  // Pointer on the values of theta
00620     const double* pphi_a = mphi_a->t[l]->t ;  // Pointer on the values of phi
00621     const double* px_a = mx_a->t[l]->t ;      // Pointer on the values of X
00622     const double* py_a = my_a->t[l]->t ;      // Pointer on the values of Y
00623     const double* pz_a = mz_a->t[l]->t ;      // Pointer on the values of Z
00624     
00625     (va.c->t[l])->set_etat_qcq() ;       // Allocates the array of double to
00626                          //  store the result 
00627     double* ptx = (va.c->t[l])->t ;      // Pointer on the allocated array
00628     
00629     
00630     // Loop on all the grid points in the considered arrival domain:
00631         
00632     for (int k=0 ; k<np ; k++) {
00633         for (int j=0 ; j<nt ; j++) {
00634         for (int i=0 ; i<nr ; i++) {
00635 
00636             double r = *pr_a ; 
00637             double rd, tetd, phid ;
00638             if (r == __infinity) {
00639             rd = r ;
00640             tetd = *ptet_a ;
00641             phid = *pphi_a ;
00642             }
00643             else {
00644 
00645             // Cartesian coordinates on the Departure mapping
00646             double xd = *px_a + xx_a ; 
00647             double yd = *py_a + yy_a ; 
00648             double zd = *pz_a + zz_a ; 
00649 
00650             // Spherical coordinates on the Departure mapping
00651             double rhod2 = xd*xd + yd*yd ; 
00652             double rhod = sqrt( rhod2 ) ;
00653             rd = sqrt(rhod2 + zd*zd) ;
00654             tetd = atan2(rhod, zd) ;
00655             phid = atan2(yd, xd) ; 
00656             if (phid < 0) phid += 2*M_PI ;
00657             }           
00658 
00659 
00660             // NB: to increase the efficiency, the method Cmp::val_point
00661             //  is not invoked; the method Mtbl_cf::val_point is 
00662             //  called directly instead. 
00663 
00664             // Value of the grid coordinates (l,xi) corresponding to
00665             //  (rd,tetd,phid) :
00666             
00667             int ld ;        // domain index
00668             double xxd ;    // radial coordinate xi in [0,1] or [-1,1]
00669             mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
00670 
00671             // Value of the Departure Cmp at the obtained point:
00672             *ptx = va_d.c_cf->val_point(ld, xxd, tetd, phid) ;
00673 
00674             // Next point : 
00675             ptx++ ;   
00676             pr_a++ ;  
00677             ptet_a++ ;  
00678             pphi_a++ ; 
00679             px_a++ ;  
00680             py_a++ ;  
00681             pz_a++ ;  
00682 
00683         }
00684         }
00685     }   
00686     
00687         
00688     }   // End of the loop on the Arrival domains
00689     
00690     // In the remaining domains, *this is set to zero:
00691     // ----------------------------------------------
00692     
00693     if (nzet < nz_a) {
00694     annule(nzet, nz_a - 1) ; 
00695     }
00696     
00697     // Treatment of dzpuis
00698     // -------------------
00699     
00700     
00701     set_dzpuis(0) ; 
00702 
00703 }

Generated on Tue Feb 7 01:35:15 2012 for LORENE by  doxygen 1.4.6