des_coupe_z.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_z_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_z.C,v 1.3 2008/08/19 06:42:00 j_novak Exp $" ;
00024 
00025 /*
00026  * $Id: des_coupe_z.C,v 1.3 2008/08/19 06:42:00 j_novak Exp $
00027  * $Log: des_coupe_z.C,v $
00028  * Revision 1.3  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.2  2004/03/25 10:29:25  j_novak
00033  * All LORENE's units are now defined in the namespace Unites (in file unites.h).
00034  *
00035  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00036  * LORENE
00037  *
00038  * Revision 1.8  2000/02/12  11:19:20  eric
00039  * Ajout de la version avec determination automatique des bornes de la fenetre
00040  * graphique.
00041  *
00042  * Revision 1.7  2000/02/11  18:44:13  eric
00043  * Ajout de l'argument draw_bound.
00044  *
00045  * Revision 1.6  2000/02/11  16:53:36  eric
00046  * Utilisation des coordonnees cartesiennes abolues (X,Y,Z) et non plus
00047  * des coordonnees relatives (x,y,z).
00048  *
00049  * Revision 1.5  1999/12/28  09:02:38  eric
00050  * *** empty log message ***
00051  *
00052  * Revision 1.4  1999/12/27  12:18:51  eric
00053  * Ajout du dessin des frontieres de domains.
00054  *
00055  * Revision 1.3  1999/12/24  13:01:02  eric
00056  * On appelle desormais la routine des_surface_y pour le dessin de la
00057  *   surface.
00058  *
00059  * Revision 1.2  1999/12/23  16:16:16  eric
00060  * Ajout du dessin de la surface (argument defsurf).
00061  *
00062  * Revision 1.1  1999/12/09  16:38:18  eric
00063  * Initial revision
00064  *
00065  *
00066  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_z.C,v 1.3 2008/08/19 06:42:00 j_novak Exp $
00067  *
00068  */
00069 
00070 // Header C
00071 #include <math.h>
00072 
00073 // Header Lorene
00074 #include "cmp.h"
00075 #include "graphique.h"
00076 #include "param.h"
00077 #include "utilitaires.h"
00078 #include "unites.h"
00079 
00080 //******************************************************************************
00081 
00082 void des_coupe_z(const Cmp& uu, double z0, int nzdes, const char* title, 
00083          const Cmp* defsurf, double zoom, bool draw_bound, 
00084          int ncour, int nx, int ny) {
00085              
00086     const Map& mp = *(uu.get_mp()) ; 
00087 
00088     double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;         
00089     double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;        
00090     double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;       
00091     double ray = mp.val_r(nzdes-1, 1., 0., 0.) ; 
00092     
00093     ray = ( a1 > ray ) ? a1 : ray ; 
00094     ray = ( a2 > ray ) ? a2 : ray ; 
00095     ray = ( a3 > ray ) ? a3 : ray ; 
00096              
00097     ray *= zoom ; 
00098     
00099     double x_min = mp.get_ori_x() - ray ; 
00100     double x_max = mp.get_ori_x() + ray ; 
00101     double y_min = mp.get_ori_y() - ray ; 
00102     double y_max = mp.get_ori_y() + ray ; 
00103 
00104     des_coupe_z(uu, z0, x_min, x_max, y_min, y_max, title, defsurf, draw_bound, 
00105         ncour, nx, ny) ;
00106 
00107 }
00108 //******************************************************************************
00109 
00110 
00111 void des_coupe_z(const Cmp& uu, double z0, double x_min, double x_max, 
00112          double y_min, double y_max, const char* title, const Cmp* defsurf, 
00113          bool draw_bound, int ncour, int nx, int ny) {
00114         
00115   using namespace Unites ;
00116   
00117     const Map& mp = *(uu.get_mp()) ; 
00118 
00119     // Plot of isocontours
00120     // -------------------
00121        
00122     float* uutab = new float[ny*nx] ; 
00123     
00124     double hy = (y_max - y_min) / double(ny-1) ; 
00125     double hx = (x_max - x_min) / double(nx-1) ; 
00126 
00127     for (int j=0; j<ny; j++) {
00128     
00129     double y = y_min + hy * j ; 
00130     
00131     for (int i=0; i<nx; i++) {
00132     
00133         double x = x_min + hx * i ; 
00134         
00135         // Computation of (r,theta,phi) :       
00136         double r, theta, phi ; 
00137         mp.convert_absolute(x, y, z0, r, theta, phi) ; 
00138         
00139         uutab[nx*j+i] = float(uu.val_point(r, theta, phi)) ; 
00140     }
00141     }
00142     
00143     float ymin1 = float(y_min / km) ;
00144     float ymax1 = float(y_max / km) ;
00145     float xmin1 = float(x_min / km) ;
00146     float xmax1 = float(x_max / km) ;
00147     
00148     const char* nomy = "y [km]" ; 
00149     const char* nomx = "x [km]" ; 
00150     
00151     if (title == 0x0) {
00152     title = "" ;
00153     }
00154     
00155     const char* device = 0x0 ; 
00156     int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ; 
00157     
00158     des_equipot(uutab, nx, ny, xmin1, xmax1, ymin1, ymax1, ncour, nomx, nomy,
00159         title, device, newgraph) ;    
00160 
00161     delete [] uutab ; 
00162     
00163         
00164     // Plot of the surface
00165     // -------------------
00166     
00167     if (defsurf != 0x0) {
00168 
00169     assert(defsurf->get_mp() == uu.get_mp()) ; 
00170 
00171     newgraph = draw_bound ? 0 : 2 ;  
00172     
00173     des_surface_z(*defsurf, z0, device, newgraph) ; 
00174     
00175     }  // End of the surface drawing
00176 
00177     // Plot of the domains outer boundaries
00178     // ------------------------------------
00179     
00180     if (draw_bound) {
00181 
00182     int ndom = mp.get_mg()->get_nzone() ;  // total number of domains
00183     
00184     for (int l=0; l<ndom-1; l++) {  // loop on the domains (except the
00185                     //  last one)
00186 
00187         newgraph = (l == ndom-2) ? 2 : 0 ; 
00188     
00189         des_domaine_z(mp, l, z0, device, newgraph) ; 
00190     }
00191     }
00192 
00193 
00194 } 

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