| 1 |
/* |
| 2 |
* Copyright (c) 1999-2001 Eric Gourgoulhon |
| 3 |
* |
| 4 |
* This file is part of LORENE. |
| 5 |
* |
| 6 |
* LORENE is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation; either version 2 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* LORENE is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with LORENE; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 |
* |
| 20 |
*/ |
| 21 |
|
| 22 |
|
| 23 |
char des_coupe_z_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_z.C,v 1.5 2014/10/13 08:53:22 j_novak Exp $" ; |
| 24 |
|
| 25 |
/* |
| 26 |
* $Id: des_coupe_z.C,v 1.5 2014/10/13 08:53:22 j_novak Exp $ |
| 27 |
* $Log: des_coupe_z.C,v $ |
| 28 |
* Revision 1.5 2014/10/13 08:53:22 j_novak |
| 29 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 30 |
* |
| 31 |
* Revision 1.4 2014/10/06 15:16:04 j_novak |
| 32 |
* Modified #include directives to use c++ syntax. |
| 33 |
* |
| 34 |
* Revision 1.3 2008/08/19 06:42:00 j_novak |
| 35 |
* Minor modifications to avoid warnings with gcc 4.3. Most of them concern |
| 36 |
* cast-type operations, and constant strings that must be defined as const char* |
| 37 |
* |
| 38 |
* Revision 1.2 2004/03/25 10:29:25 j_novak |
| 39 |
* All LORENE's units are now defined in the namespace Unites (in file unites.h). |
| 40 |
* |
| 41 |
* Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon |
| 42 |
* LORENE |
| 43 |
* |
| 44 |
* Revision 1.8 2000/02/12 11:19:20 eric |
| 45 |
* Ajout de la version avec determination automatique des bornes de la fenetre |
| 46 |
* graphique. |
| 47 |
* |
| 48 |
* Revision 1.7 2000/02/11 18:44:13 eric |
| 49 |
* Ajout de l'argument draw_bound. |
| 50 |
* |
| 51 |
* Revision 1.6 2000/02/11 16:53:36 eric |
| 52 |
* Utilisation des coordonnees cartesiennes abolues (X,Y,Z) et non plus |
| 53 |
* des coordonnees relatives (x,y,z). |
| 54 |
* |
| 55 |
* Revision 1.5 1999/12/28 09:02:38 eric |
| 56 |
* *** empty log message *** |
| 57 |
* |
| 58 |
* Revision 1.4 1999/12/27 12:18:51 eric |
| 59 |
* Ajout du dessin des frontieres de domains. |
| 60 |
* |
| 61 |
* Revision 1.3 1999/12/24 13:01:02 eric |
| 62 |
* On appelle desormais la routine des_surface_y pour le dessin de la |
| 63 |
* surface. |
| 64 |
* |
| 65 |
* Revision 1.2 1999/12/23 16:16:16 eric |
| 66 |
* Ajout du dessin de la surface (argument defsurf). |
| 67 |
* |
| 68 |
* Revision 1.1 1999/12/09 16:38:18 eric |
| 69 |
* Initial revision |
| 70 |
* |
| 71 |
* |
| 72 |
* $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_z.C,v 1.5 2014/10/13 08:53:22 j_novak Exp $ |
| 73 |
* |
| 74 |
*/ |
| 75 |
|
| 76 |
// Header C |
| 77 |
#include <cmath> |
| 78 |
|
| 79 |
// Header Lorene |
| 80 |
#include "cmp.h" |
| 81 |
#include "graphique.h" |
| 82 |
#include "param.h" |
| 83 |
#include "utilitaires.h" |
| 84 |
#include "unites.h" |
| 85 |
|
| 86 |
namespace Lorene { |
| 87 |
//****************************************************************************** |
| 88 |
|
| 89 |
void des_coupe_z(const Cmp& uu, double z0, int nzdes, const char* title, |
| 90 |
const Cmp* defsurf, double zoom, bool draw_bound, |
| 91 |
int ncour, int nx, int ny) { |
| 92 |
|
| 93 |
const Map& mp = *(uu.get_mp()) ; |
| 94 |
|
| 95 |
double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ; |
| 96 |
double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ; |
| 97 |
double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ; |
| 98 |
double ray = mp.val_r(nzdes-1, 1., 0., 0.) ; |
| 99 |
|
| 100 |
ray = ( a1 > ray ) ? a1 : ray ; |
| 101 |
ray = ( a2 > ray ) ? a2 : ray ; |
| 102 |
ray = ( a3 > ray ) ? a3 : ray ; |
| 103 |
|
| 104 |
ray *= zoom ; |
| 105 |
|
| 106 |
double x_min = mp.get_ori_x() - ray ; |
| 107 |
double x_max = mp.get_ori_x() + ray ; |
| 108 |
double y_min = mp.get_ori_y() - ray ; |
| 109 |
double y_max = mp.get_ori_y() + ray ; |
| 110 |
|
| 111 |
des_coupe_z(uu, z0, x_min, x_max, y_min, y_max, title, defsurf, draw_bound, |
| 112 |
ncour, nx, ny) ; |
| 113 |
|
| 114 |
} |
| 115 |
//****************************************************************************** |
| 116 |
|
| 117 |
|
| 118 |
void des_coupe_z(const Cmp& uu, double z0, double x_min, double x_max, |
| 119 |
double y_min, double y_max, const char* title, const Cmp* defsurf, |
| 120 |
bool draw_bound, int ncour, int nx, int ny) { |
| 121 |
|
| 122 |
using namespace Unites ; |
| 123 |
|
| 124 |
const Map& mp = *(uu.get_mp()) ; |
| 125 |
|
| 126 |
// Plot of isocontours |
| 127 |
// ------------------- |
| 128 |
|
| 129 |
float* uutab = new float[ny*nx] ; |
| 130 |
|
| 131 |
double hy = (y_max - y_min) / double(ny-1) ; |
| 132 |
double hx = (x_max - x_min) / double(nx-1) ; |
| 133 |
|
| 134 |
for (int j=0; j<ny; j++) { |
| 135 |
|
| 136 |
double y = y_min + hy * j ; |
| 137 |
|
| 138 |
for (int i=0; i<nx; i++) { |
| 139 |
|
| 140 |
double x = x_min + hx * i ; |
| 141 |
|
| 142 |
// Computation of (r,theta,phi) : |
| 143 |
double r, theta, phi ; |
| 144 |
mp.convert_absolute(x, y, z0, r, theta, phi) ; |
| 145 |
|
| 146 |
uutab[nx*j+i] = float(uu.val_point(r, theta, phi)) ; |
| 147 |
} |
| 148 |
} |
| 149 |
|
| 150 |
float ymin1 = float(y_min / km) ; |
| 151 |
float ymax1 = float(y_max / km) ; |
| 152 |
float xmin1 = float(x_min / km) ; |
| 153 |
float xmax1 = float(x_max / km) ; |
| 154 |
|
| 155 |
const char* nomy = "y [km]" ; |
| 156 |
const char* nomx = "x [km]" ; |
| 157 |
|
| 158 |
if (title == 0x0) { |
| 159 |
title = "" ; |
| 160 |
} |
| 161 |
|
| 162 |
const char* device = 0x0 ; |
| 163 |
int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ; |
| 164 |
|
| 165 |
des_equipot(uutab, nx, ny, xmin1, xmax1, ymin1, ymax1, ncour, nomx, nomy, |
| 166 |
title, device, newgraph) ; |
| 167 |
|
| 168 |
delete [] uutab ; |
| 169 |
|
| 170 |
|
| 171 |
// Plot of the surface |
| 172 |
// ------------------- |
| 173 |
|
| 174 |
if (defsurf != 0x0) { |
| 175 |
|
| 176 |
assert(defsurf->get_mp() == uu.get_mp()) ; |
| 177 |
|
| 178 |
newgraph = draw_bound ? 0 : 2 ; |
| 179 |
|
| 180 |
des_surface_z(*defsurf, z0, device, newgraph) ; |
| 181 |
|
| 182 |
} // End of the surface drawing |
| 183 |
|
| 184 |
// Plot of the domains outer boundaries |
| 185 |
// ------------------------------------ |
| 186 |
|
| 187 |
if (draw_bound) { |
| 188 |
|
| 189 |
int ndom = mp.get_mg()->get_nzone() ; // total number of domains |
| 190 |
|
| 191 |
for (int l=0; l<ndom-1; l++) { // loop on the domains (except the |
| 192 |
// last one) |
| 193 |
|
| 194 |
newgraph = (l == ndom-2) ? 2 : 0 ; |
| 195 |
|
| 196 |
des_domaine_z(mp, l, z0, device, newgraph) ; |
| 197 |
} |
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
} |
| 202 |
} |