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

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