| 1 |
/* |
| 2 |
* Draws the profile of a {\tt Cmp} along some radial axis determined by |
| 3 |
* a fixed value of $(\theta, \phi)$. |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright (c) 1999-2004 Eric Gourgoulhon |
| 8 |
* |
| 9 |
* This file is part of LORENE. |
| 10 |
* |
| 11 |
* LORENE is free software; you can redistribute it and/or modify |
| 12 |
* it under the terms of the GNU General Public License as published by |
| 13 |
* the Free Software Foundation; either version 2 of the License, or |
| 14 |
* (at your option) any later version. |
| 15 |
* |
| 16 |
* LORENE is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with LORENE; if not, write to the Free Software |
| 23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 |
* |
| 25 |
*/ |
| 26 |
|
| 27 |
|
| 28 |
char des_prof_cmp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_prof_cmp.C,v 1.8 2014/10/13 08:53:22 j_novak Exp $" ; |
| 29 |
|
| 30 |
|
| 31 |
/* |
| 32 |
* $Id: des_prof_cmp.C,v 1.8 2014/10/13 08:53:22 j_novak Exp $ |
| 33 |
* $Log: des_prof_cmp.C,v $ |
| 34 |
* Revision 1.8 2014/10/13 08:53:22 j_novak |
| 35 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 36 |
* |
| 37 |
* Revision 1.7 2014/10/06 15:16:05 j_novak |
| 38 |
* Modified #include directives to use c++ syntax. |
| 39 |
* |
| 40 |
* Revision 1.6 2008/08/19 06:42:00 j_novak |
| 41 |
* Minor modifications to avoid warnings with gcc 4.3. Most of them concern |
| 42 |
* cast-type operations, and constant strings that must be defined as const char* |
| 43 |
* |
| 44 |
* Revision 1.5 2004/03/25 10:29:25 j_novak |
| 45 |
* All LORENE's units are now defined in the namespace Unites (in file unites.h). |
| 46 |
* |
| 47 |
* Revision 1.4 2004/02/12 16:20:36 e_gourgoulhon |
| 48 |
* Functions des_profile for Scalar's are now in the new file |
| 49 |
* des_prof_scalar.C |
| 50 |
* |
| 51 |
* Revision 1.3 2004/02/04 14:28:14 p_grandclement |
| 52 |
* Ajout de la version Scalar de des_profile |
| 53 |
* |
| 54 |
* Revision 1.2 2003/06/03 09:59:35 e_gourgoulhon |
| 55 |
* Added a new des_profile with scale and nomx in arguments |
| 56 |
* |
| 57 |
* Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon |
| 58 |
* LORENE |
| 59 |
* |
| 60 |
* Revision 1.1 1999/12/09 16:38:31 eric |
| 61 |
* Initial revision |
| 62 |
* |
| 63 |
* |
| 64 |
* $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_prof_cmp.C,v 1.8 2014/10/13 08:53:22 j_novak Exp $ |
| 65 |
* |
| 66 |
*/ |
| 67 |
|
| 68 |
// Header C |
| 69 |
#include <cmath> |
| 70 |
|
| 71 |
|
| 72 |
// Header Lorene |
| 73 |
#include "cmp.h" |
| 74 |
#include "graphique.h" |
| 75 |
#include "unites.h" |
| 76 |
|
| 77 |
namespace Lorene { |
| 78 |
//****************************************************************************** |
| 79 |
|
| 80 |
void des_profile(const Cmp& uu, double r_min, double r_max, |
| 81 |
double theta, double phi, const char* nomy, const char* title) { |
| 82 |
|
| 83 |
using namespace Unites ; |
| 84 |
|
| 85 |
const int npt = 400 ; // Number of points along the axis |
| 86 |
|
| 87 |
float uutab[npt] ; // Value of uu at the npt points |
| 88 |
|
| 89 |
double hr = (r_max - r_min) / double(npt-1) ; |
| 90 |
|
| 91 |
for (int i=0; i<npt; i++) { |
| 92 |
|
| 93 |
double r = hr * i + r_min ; |
| 94 |
|
| 95 |
uutab[i] = float(uu.val_point(r, theta, phi)) ; |
| 96 |
|
| 97 |
} |
| 98 |
|
| 99 |
float xmin = float(r_min / km) ; |
| 100 |
float xmax = float(r_max / km) ; |
| 101 |
|
| 102 |
const char* nomx = "r [km]" ; |
| 103 |
|
| 104 |
if (title == 0x0) { |
| 105 |
title = "" ; |
| 106 |
} |
| 107 |
|
| 108 |
if (nomy == 0x0) { |
| 109 |
nomy = "" ; |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
des_profile(uutab, npt, xmin, xmax, nomx, nomy, title) ; |
| 114 |
|
| 115 |
} |
| 116 |
|
| 117 |
//****************************************************************************** |
| 118 |
|
| 119 |
void des_profile(const Cmp& uu, double r_min, double r_max, double scale, |
| 120 |
double theta, double phi, const char* nomx, const char* nomy, const char* title) { |
| 121 |
|
| 122 |
|
| 123 |
const int npt = 400 ; // Number of points along the axis |
| 124 |
|
| 125 |
float uutab[npt] ; // Value of uu at the npt points |
| 126 |
|
| 127 |
double hr = (r_max - r_min) / double(npt-1) ; |
| 128 |
|
| 129 |
for (int i=0; i<npt; i++) { |
| 130 |
|
| 131 |
double r = hr * i + r_min ; |
| 132 |
|
| 133 |
uutab[i] = float(uu.val_point(r, theta, phi)) ; |
| 134 |
|
| 135 |
} |
| 136 |
|
| 137 |
float xmin = float(r_min * scale) ; |
| 138 |
float xmax = float(r_max * scale) ; |
| 139 |
|
| 140 |
|
| 141 |
if (title == 0x0) { |
| 142 |
title = "" ; |
| 143 |
} |
| 144 |
|
| 145 |
if (nomx == 0x0) { |
| 146 |
nomx = "" ; |
| 147 |
} |
| 148 |
|
| 149 |
if (nomy == 0x0) { |
| 150 |
nomy = "" ; |
| 151 |
} |
| 152 |
|
| 153 |
|
| 154 |
des_profile(uutab, npt, xmin, xmax, nomx, nomy, title) ; |
| 155 |
|
| 156 |
} |
| 157 |
|
| 158 |
|
| 159 |
} |