des_coupe_y.C

00001 /*
00002  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   LORENE is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with LORENE; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 char des_coupe_y_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_y.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $" ;
00024 
00025 /*
00026  * $Id: des_coupe_y.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $
00027  * $Log: des_coupe_y.C,v $
00028  * Revision 1.4  2008/08/19 06:42:00  j_novak
00029  * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
00030  * cast-type operations, and constant strings that must be defined as const char*
00031  *
00032  * Revision 1.3  2004/03/25 10:29:24  j_novak
00033  * All LORENE's units are now defined in the namespace Unites (in file unites.h).
00034  *
00035  * Revision 1.2  2002/09/06 15:18:52  e_gourgoulhon
00036  * Changement du nom de la variable "hz" en "hza"
00037  * pour assurer la compatibilite avec le compilateur xlC_r
00038  * sur IBM Regatta (le preprocesseur de ce compilateur remplace
00039  * "hz" par "100").
00040  *
00041  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00042  * LORENE
00043  *
00044  * Revision 1.8  2000/02/12  11:18:59  eric
00045  * Ajout de la version avec determination automatique des bornes de la fenetre
00046  * graphique.
00047  *
00048  * Revision 1.7  2000/02/11  18:44:06  eric
00049  * Ajout de l'argument draw_bound.
00050  *
00051  * Revision 1.6  2000/02/11  16:53:25  eric
00052  * Utilisation des coordonnees cartesiennes abolues (X,Y,Z) et non plus
00053  * des coordonnees relatives (x,y,z).
00054  *
00055  * Revision 1.5  1999/12/28  09:02:30  eric
00056  * *** empty log message ***
00057  *
00058  * Revision 1.4  1999/12/27  12:18:43  eric
00059  * Ajout du dessin des frontieres de domains.
00060  *
00061  * Revision 1.3  1999/12/24  13:00:46  eric
00062  * On appelle desormais la routine des_surface_y pour le dessin de la
00063  *   surface.
00064  *
00065  * Revision 1.2  1999/12/23  16:16:26  eric
00066  * Ajout du dessin de la surface (argument defsurf).
00067  *
00068  * Revision 1.1  1999/12/09  16:38:10  eric
00069  * Initial revision
00070  *
00071  *
00072  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_y.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $
00073  *
00074  */
00075 
00076 // Header C
00077 #include <math.h>
00078 
00079 // Header Lorene
00080 #include "cmp.h"
00081 #include "graphique.h"
00082 #include "param.h"
00083 #include "utilitaires.h"
00084 #include "unites.h"
00085 
00086 //******************************************************************************
00087 
00088 void des_coupe_y(const Cmp& uu, double y0, int nzdes, const char* title, 
00089          const Cmp* defsurf, double zoom, bool draw_bound, 
00090          int ncour, int nx, int nz) {
00091              
00092     const Map& mp = *(uu.get_mp()) ; 
00093 
00094     double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;         
00095     double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;        
00096     double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;       
00097     double ray = mp.val_r(nzdes-1, 1., 0., 0.) ; 
00098     
00099     ray = ( a1 > ray ) ? a1 : ray ; 
00100     ray = ( a2 > ray ) ? a2 : ray ; 
00101     ray = ( a3 > ray ) ? a3 : ray ; 
00102              
00103     ray *= zoom ; 
00104     
00105     double x_min = mp.get_ori_x() - ray ; 
00106     double x_max = mp.get_ori_x() + ray ; 
00107     double z_min = mp.get_ori_z() - ray ; 
00108     double z_max = mp.get_ori_z() + ray ; 
00109 
00110     des_coupe_y(uu, y0, x_min, x_max, z_min, z_max, title, defsurf, draw_bound, 
00111         ncour, nx, nz) ;
00112 
00113 }
00114 
00115 //******************************************************************************
00116 
00117 void des_coupe_y(const Cmp& uu, double y0, double x_min, double x_max, 
00118          double z_min, double z_max, const char* title, const Cmp* defsurf,
00119          bool draw_bound, int ncour, int nx, int nz) {
00120         
00121   using namespace Unites ;
00122   
00123     const Map& mp = *(uu.get_mp()) ; 
00124 
00125     // Plot of isocontours
00126     // -------------------
00127               
00128     float* uutab = new float[nx*nz] ; 
00129     
00130     double hx = (x_max - x_min) / double(nx-1) ; 
00131     double hza = (z_max - z_min) / double(nz-1) ; 
00132     
00133 
00134 
00135     for (int j=0; j<nz; j++) {
00136     
00137     double z = z_min + hza * j ; 
00138     
00139     for (int i=0; i<nx; i++) {
00140     
00141         double x = x_min + hx * i ; 
00142         
00143         // Computation of (r,theta,phi) :       
00144         double r, theta, phi ; 
00145         mp.convert_absolute(x, y0, z, r, theta, phi) ; 
00146     
00147         uutab[nx*j+i] = float(uu.val_point(r, theta, phi)) ; 
00148     }
00149     }
00150     
00151     float xmin1 = float(x_min / km) ;
00152     float xmax1 = float(x_max / km) ;
00153     float zmin1 = float(z_min / km) ;
00154     float zmax1 = float(z_max / km) ;
00155     
00156     const char* nomx = "x [km]" ; 
00157     const char* nomz = "z [km]" ; 
00158     
00159     if (title == 0x0) {
00160     title = "" ;
00161     }
00162     
00163 
00164     const char* device = 0x0 ; 
00165     int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ; 
00166 
00167     des_equipot(uutab, nx, nz, xmin1, xmax1, zmin1, zmax1, ncour, nomx, nomz,
00168         title, device, newgraph) ;    
00169     
00170     // Plot of the surface
00171     // -------------------
00172     
00173     if (defsurf != 0x0) {
00174 
00175     assert(defsurf->get_mp() == uu.get_mp()) ; 
00176 
00177     newgraph = draw_bound ? 0 : 2 ;  
00178     
00179     des_surface_y(*defsurf, y0, device, newgraph) ; 
00180     
00181     }  // End of the surface drawing
00182 
00183     delete [] uutab ; 
00184 
00185     // Plot of the domains outer boundaries
00186     // ------------------------------------
00187     
00188     if (draw_bound) {
00189 
00190     int ndom = mp.get_mg()->get_nzone() ;  // total number of domains
00191     
00192     for (int l=0; l<ndom-1; l++) {  // loop on the domains (except the
00193                     //  last one)
00194 
00195         newgraph = (l == ndom-2) ? 2 : 0 ; 
00196     
00197         des_domaine_y(mp, l, y0, device, newgraph) ; 
00198     }
00199     }
00200 
00201     
00202 } 

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