map_af_radius.C

00001 /*
00002  *  Methods of the class Map_af relative to the function
00003  *      r = R_l(xi, theta', phi')
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 map_af_radius_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_af_radius.C,v 1.6 2008/09/01 08:12:03 j_novak Exp $" ;
00029 
00030 /*
00031  * $Id: map_af_radius.C,v 1.6 2008/09/01 08:12:03 j_novak Exp $
00032  * $Log: map_af_radius.C,v $
00033  * Revision 1.6  2008/09/01 08:12:03  j_novak
00034  * Improved test on the [rmin, rmax] interval.
00035  *
00036  * Revision 1.5  2007/12/11 15:28:14  jl_cornou
00037  * Jacobi(0,2) polynomials partially implemented
00038  *
00039  * Revision 1.4  2006/09/13 13:59:21  j_novak
00040  * Higher tolerance thereshold for Map_af::val_lx
00041  *
00042  * Revision 1.3  2006/07/10 07:44:51  j_novak
00043  * Correction of the comparison between rmin and rr (now has to be greater than
00044  * some threshold).
00045  *
00046  * Revision 1.2  2006/07/05 12:36:51  n_vasset
00047  * Added a test on rmin to see whether the point lies in the computational domains.
00048  *
00049  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00050  * LORENE
00051  *
00052  * Revision 1.5  1999/12/16  14:19:08  eric
00053  * Introduction de l'argument const Param& par dans val_lx et val_lx_jk.
00054  * (en remplacement de l'argument Tbl& param).
00055  *
00056  * Revision 1.4  1999/12/07  14:51:37  eric
00057  * val_r_kj --> val_r_jk
00058  * val_lx_kj -->val_lx_jk
00059  * Changement ordre des arguments val_r, val_lx
00060  *
00061  * Revision 1.3  1999/12/06  16:47:21  eric
00062  * Surcharge de val_lx avec la version sans param.
00063  *
00064  * Revision 1.2  1999/12/06  15:34:06  eric
00065  * Ajout des fonctions val_r_kj et val_lx_kj.
00066  *
00067  * Revision 1.1  1999/12/06  13:12:16  eric
00068  * Initial revision
00069  *
00070  *
00071  * $Header: /cvsroot/Lorene/C++/Source/Map/map_af_radius.C,v 1.6 2008/09/01 08:12:03 j_novak Exp $
00072  *
00073  */
00074 
00075 #include<math.h>
00076 
00077 // Headers Lorene
00078 #include "map.h"
00079 
00080             //------------------------------// 
00081             //      val_r       //
00082             //------------------------------// 
00083 
00084  
00085 double Map_af::val_r(int l, double xi, double, double) const {
00086 
00087     assert( l>=0 ) ; 
00088     assert( l<mg->get_nzone() ) ; 
00089     
00090     double resu ; 
00091 
00092     switch( mg->get_type_r(l) ) {
00093 
00094     case FIN: case RARE: case FINJAC : {
00095         resu = alpha[l] * xi + beta[l] ;
00096         break ;
00097     }
00098     
00099     case UNSURR: {
00100         resu = double(1) / ( alpha[l] * xi + beta[l] ) ;
00101         break ;
00102     }
00103 
00104     default: {
00105         cout << "Map_af::val_r: unknown type_r ! " << endl ;
00106         abort () ;
00107     }      
00108     }
00109              
00110     return resu ;    
00111 }
00112             
00113             //------------------------------// 
00114             //      val_lx      //
00115             //------------------------------// 
00116 
00117 void Map_af::val_lx(double rr, double, double, int& lz, double& xi) const {
00118                
00119     // In which domain is located r ? 
00120     // ----------------------------
00121     int nz = mg->get_nzone() ;
00122     lz = - 1 ;
00123     
00124     for (int l=0; l<nz; l++) {
00125         
00126     double rmax = alpha[l] + beta[l] ;
00127     double rmin = beta[l] - alpha[l] ;
00128     if (mg->get_type_r(l) == RARE) rmin = 0. ;
00129     if (mg->get_type_r(l) == UNSURR) {
00130         rmin = double(1)/rmin ; 
00131         rmax = double(1)/rmax ; 
00132     }       
00133     if ((rr - rmin >= -1.e-14*fabs(rmin)) && ( rr <= rmax )) { 
00134         lz = l ;
00135         break ; 
00136     }   
00137     }       // fin de la boucle sur les zones
00138     
00139     if (lz == -1) {         // On n'a pas trouve la zone 
00140     cout.precision(16);
00141     cout.setf(ios::showpoint);
00142     cout << "Map_af::val_lx: the domain containing r = " << rr <<
00143          " has not been found ! " 
00144           << endl ;
00145     for (int l=0; l<nz; l++) {
00146         double rmin = -alpha[l] + beta[l] ; 
00147         if (mg->get_type_r(l) == UNSURR) rmin = double(1)/rmin ; 
00148         if (mg->get_type_r(l) == RARE) rmin = 0. ;
00149         cout << "domain " << l << " :  r_min = " << rmin ; 
00150         double rmax = alpha[l] + beta[l] ;  
00151         if (mg->get_type_r(l) == UNSURR) rmax = double(1)/rmax ; 
00152         cout << " :  r_max = " << rmax << endl ; 
00153     }
00154     abort () ;
00155     }
00156 
00157     // Computation of xi
00158     // ----------------- 
00159 
00160     switch( mg->get_type_r(lz) ) {
00161 
00162     case FIN: case RARE: case FINJAC : {
00163         xi = ( rr - beta[lz] ) / alpha[lz]  ;
00164         break ;
00165     }
00166     
00167     case UNSURR: {
00168         xi = ( double(1)/rr - beta[lz] ) / alpha[lz]  ;
00169         break ;
00170     }
00171 
00172     default: {
00173         cout << "Map_af::val_lx: unknown type_r ! " << endl ;
00174         abort () ;
00175     }      
00176     }
00177 
00178 } 
00179 
00180 
00181 void Map_af::val_lx(double rr, double, double, const Param&,  
00182                 int& lz, double& xi) const {
00183 
00184     val_lx(rr, 0., 0., lz, xi) ;
00185 
00186 }
00187 
00188 
00189             //------------------------------// 
00190             //      val_r_jk        //
00191             //------------------------------// 
00192 
00193  
00194 double Map_af::val_r_jk(int l, double xi, int, int) const {
00195 
00196     return val_r(l, xi, 0., 0.) ; 
00197     
00198 }
00199             
00200             //------------------------------// 
00201             //      val_lx_jk       //
00202             //------------------------------// 
00203 
00204 void Map_af::val_lx_jk(double rr, int, int, const Param& par, 
00205                 int& l, double& xi) const {
00206                
00207     val_lx(rr, 0., 0., par, l, xi) ; 
00208 
00209 } 
00210 
00211 

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