00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #include <math.h>
00072
00073
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
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
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
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 }
00176
00177
00178
00179
00180 if (draw_bound) {
00181
00182 int ndom = mp.get_mg()->get_nzone() ;
00183
00184 for (int l=0; l<ndom-1; l++) {
00185
00186
00187 newgraph = (l == ndom-2) ? 2 : 0 ;
00188
00189 des_domaine_z(mp, l, z0, device, newgraph) ;
00190 }
00191 }
00192
00193
00194 }