des_prof_cmp.C

00001 /*
00002  * Draws the profile of a {\tt Cmp} along some radial axis determined by
00003  *  a fixed value of $(\theta, \phi)$.
00004  */
00005 
00006 /*
00007  *   Copyright (c) 1999-2004 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 des_prof_cmp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_prof_cmp.C,v 1.6 2008/08/19 06:42:00 j_novak Exp $" ;
00029 
00030 
00031 /*
00032  * $Id: des_prof_cmp.C,v 1.6 2008/08/19 06:42:00 j_novak Exp $
00033  * $Log: des_prof_cmp.C,v $
00034  * Revision 1.6  2008/08/19 06:42:00  j_novak
00035  * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
00036  * cast-type operations, and constant strings that must be defined as const char*
00037  *
00038  * Revision 1.5  2004/03/25 10:29:25  j_novak
00039  * All LORENE's units are now defined in the namespace Unites (in file unites.h).
00040  *
00041  * Revision 1.4  2004/02/12 16:20:36  e_gourgoulhon
00042  * Functions des_profile for Scalar's are now in the new file
00043  *  des_prof_scalar.C
00044  *
00045  * Revision 1.3  2004/02/04 14:28:14  p_grandclement
00046  * Ajout de la version Scalar de des_profile
00047  *
00048  * Revision 1.2  2003/06/03 09:59:35  e_gourgoulhon
00049  * Added a new des_profile with scale and nomx in arguments
00050  *
00051  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00052  * LORENE
00053  *
00054  * Revision 1.1  1999/12/09  16:38:31  eric
00055  * Initial revision
00056  *
00057  *
00058  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_prof_cmp.C,v 1.6 2008/08/19 06:42:00 j_novak Exp $
00059  *
00060  */
00061 
00062 // Header C
00063 #include <math.h>
00064 
00065 
00066 // Header Lorene
00067 #include "cmp.h"
00068 #include "graphique.h"
00069 #include "unites.h"
00070 
00071 //******************************************************************************
00072 
00073 void des_profile(const Cmp& uu, double r_min, double r_max, 
00074              double theta, double phi, const char* nomy, const char* title) {
00075         
00076 using namespace Unites ;  
00077 
00078     const int npt = 400 ;   // Number of points along the axis
00079     
00080     float uutab[npt] ;      // Value of uu at the npt points
00081     
00082     double hr = (r_max - r_min) / double(npt-1) ; 
00083     
00084     for (int i=0; i<npt; i++) {
00085     
00086     double r = hr * i + r_min ; 
00087     
00088     uutab[i] = float(uu.val_point(r, theta, phi)) ; 
00089     
00090     }
00091     
00092     float xmin = float(r_min / km) ;
00093     float xmax = float(r_max / km) ;
00094     
00095     const char* nomx = "r [km]" ; 
00096     
00097     if (title == 0x0) {
00098     title = "" ;
00099     }
00100 
00101     if (nomy == 0x0) {
00102     nomy = "" ;
00103     }
00104     
00105     
00106     des_profile(uutab, npt, xmin, xmax, nomx, nomy, title) ; 
00107     
00108 } 
00109 
00110 //******************************************************************************
00111 
00112 void des_profile(const Cmp& uu, double r_min, double r_max, double scale,
00113              double theta, double phi, const char* nomx, const char* nomy, const char* title) {
00114         
00115 
00116     const int npt = 400 ;   // Number of points along the axis
00117     
00118     float uutab[npt] ;      // Value of uu at the npt points
00119     
00120     double hr = (r_max - r_min) / double(npt-1) ; 
00121     
00122     for (int i=0; i<npt; i++) {
00123     
00124     double r = hr * i + r_min ; 
00125     
00126     uutab[i] = float(uu.val_point(r, theta, phi)) ; 
00127     
00128     }
00129     
00130     float xmin = float(r_min * scale) ;
00131     float xmax = float(r_max * scale) ;
00132     
00133     
00134     if (title == 0x0) {
00135     title = "" ;
00136     }
00137 
00138     if (nomx == 0x0) {
00139     nomx = "" ;
00140     }
00141     
00142     if (nomy == 0x0) {
00143     nomy = "" ;
00144     }
00145     
00146     
00147     des_profile(uutab, npt, xmin, xmax, nomx, nomy, title) ; 
00148     
00149 } 
00150 
00151 

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