des_bi_coupe.C

00001 /*
00002  *   Copyright (c) 2001 Jerome Novak
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_bi_coupe_c[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_bi_coupe.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $" ;
00024 
00025 /*
00026  * $Id: des_bi_coupe.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $
00027  * $Log: des_bi_coupe.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.1  2001/06/21  07:39:20  novak
00045  * Initial revision
00046  *
00047  *
00048  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_bi_coupe.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $
00049  *
00050  */
00051 
00052 // Header C
00053 #include <math.h>
00054 
00055 // Header Lorene
00056 #include "cmp.h"
00057 #include "graphique.h"
00058 #include "param.h"
00059 #include "utilitaires.h"
00060 #include "unites.h"
00061 
00062 //******************************************************************************
00063 
00064 void des_bi_coupe_y(const Cmp& uu, double y0, int nzdes, const char* title, 
00065             const Cmp* defsurf, const Cmp* defsurf2, double zoom, 
00066             bool draw_bound, int ncour, int nx, int nz) {
00067              
00068     const Map& mp = *(uu.get_mp()) ; 
00069 
00070     double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;         
00071     double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;        
00072     double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;       
00073     double ray = mp.val_r(nzdes-1, 1., 0., 0.) ; 
00074     
00075     ray = ( a1 > ray ) ? a1 : ray ; 
00076     ray = ( a2 > ray ) ? a2 : ray ; 
00077     ray = ( a3 > ray ) ? a3 : ray ; 
00078              
00079     ray *= zoom ; 
00080     
00081     double x_min = mp.get_ori_x() - ray ; 
00082     double x_max = mp.get_ori_x() + ray ; 
00083     double z_min = mp.get_ori_z() - ray ; 
00084     double z_max = mp.get_ori_z() + ray ; 
00085 
00086     des_bi_coupe_y(uu, y0, x_min, x_max, z_min, z_max, title, defsurf, 
00087            defsurf2, draw_bound, ncour, nx, nz) ;
00088 
00089 }
00090 
00091 //******************************************************************************
00092 
00093 void des_bi_coupe_y(const Cmp& uu, double y0, double x_min, double x_max, 
00094          double z_min, double z_max, const char* title, const Cmp* defsurf,
00095          const Cmp* defsurf2, bool draw_bound, int ncour, int nx, 
00096             int nz) {
00097         
00098   using namespace Unites ;
00099   
00100     const Map& mp = *(uu.get_mp()) ; 
00101 
00102     // Plot of isocontours
00103     // -------------------
00104               
00105     float* uutab = new float[nx*nz] ; 
00106     
00107     double hx = (x_max - x_min) / double(nx-1) ; 
00108     double hza = (z_max - z_min) / double(nz-1) ; 
00109     
00110 
00111 
00112     for (int j=0; j<nz; j++) {
00113     
00114     double z = z_min + hza * j ; 
00115     
00116     for (int i=0; i<nx; i++) {
00117     
00118         double x = x_min + hx * i ; 
00119         
00120         // Computation of (r,theta,phi) :       
00121         double r, theta, phi ; 
00122         mp.convert_absolute(x, y0, z, r, theta, phi) ; 
00123     
00124         uutab[nx*j+i] = float(uu.val_point(r, theta, phi)) ; 
00125     }
00126     }
00127     
00128     float xmin1 = float(x_min / km) ;
00129     float xmax1 = float(x_max / km) ;
00130     float zmin1 = float(z_min / km) ;
00131     float zmax1 = float(z_max / km) ;
00132     
00133     const char* nomx = "x [km]" ; 
00134     const char* nomz = "z [km]" ; 
00135     
00136     if (title == 0x0) {
00137     title = "" ;
00138     }
00139     
00140 
00141     const char* device = 0x0 ; 
00142     int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ; 
00143 
00144     des_equipot(uutab, nx, nz, xmin1, xmax1, zmin1, zmax1, ncour, nomx, nomz,
00145         title, device, newgraph) ;    
00146     
00147     // Plot of the surface
00148     // -------------------
00149     
00150     if (defsurf != 0x0) {
00151 
00152     assert(defsurf->get_mp() == uu.get_mp()) ; 
00153 
00154     newgraph = ( (defsurf2 != 0x0) || draw_bound ) ? 0 : 2 ; 
00155     
00156     des_surface_y(*defsurf, y0, device, newgraph) ; 
00157     
00158     }  // End of the surface drawing
00159 
00160     if (defsurf2 != 0x0) {
00161 
00162     assert(defsurf2->get_mp() == uu.get_mp()) ; 
00163 
00164     newgraph = draw_bound ? 0 : 2 ;  
00165     
00166     des_surface_y(*defsurf2, y0, device, newgraph) ; 
00167     
00168     }  // End of the surface drawing
00169 
00170     delete [] uutab ; 
00171 
00172     // Plot of the domains outer boundaries
00173     // ------------------------------------
00174     
00175     if (draw_bound) {
00176 
00177     int ndom = mp.get_mg()->get_nzone() ;  // total number of domains
00178     
00179     for (int l=0; l<ndom-1; l++) {  // loop on the domains (except the
00180                     //  last one)
00181 
00182         newgraph = (l == ndom-2) ? 2 : 0 ; 
00183     
00184         des_domaine_y(mp, l, y0, device, newgraph) ; 
00185     }
00186     }
00187 
00188     
00189 } 

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