23char des_coupe_scalar_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coupe_scalar.C,v 1.4 2014/10/13 08:53:21 j_novak Exp $" ;
53#include "utilitaires.h"
58void des_coupe_x(
const Scalar& uu,
double x0,
int nzdes,
const char* title,
59 const Scalar* defsurf,
double zoom,
bool draw_bound,
60 int ncour,
int ny,
int nz) {
62 const Map& mp = uu.get_mp() ;
64 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
65 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
66 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
67 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
69 ray = ( a1 > ray ) ? a1 : ray ;
70 ray = ( a2 > ray ) ? a2 : ray ;
71 ray = ( a3 > ray ) ? a3 : ray ;
75 double y_min = mp.get_ori_y() - ray ;
76 double y_max = mp.get_ori_y() + ray ;
77 double z_min = mp.get_ori_z() - ray ;
78 double z_max = mp.get_ori_z() + ray ;
80 des_coupe_x(uu, x0, y_min, y_max, z_min, z_max, title, defsurf, draw_bound,
87void des_coupe_x(
const Scalar& uu,
double x0,
double y_min,
double y_max,
88 double z_min,
double z_max,
const char* title,
const Scalar* defsurf,
89 bool draw_bound,
int ncour,
int ny,
int nz) {
91using namespace Unites ;
93 const Map& mp = uu.get_mp() ;
98 float* uutab =
new float[ny*nz] ;
100 double hy = (y_max - y_min) /
double(ny-1) ;
101 double hza = (z_max - z_min) /
double(nz-1) ;
103 for (
int j=0; j<nz; j++) {
105 double z = z_min + hza * j ;
107 for (
int i=0; i<ny; i++) {
109 double y = y_min + hy * i ;
112 double r, theta,
phi ;
113 mp.convert_absolute(x0,
y,
z,
r, theta,
phi) ;
115 uutab[ny*j+i] = float(uu.val_point(
r, theta,
phi)) ;
119 float ymin1 = float(y_min / km) ;
120 float ymax1 = float(y_max / km) ;
121 float zmin1 = float(z_min / km) ;
122 float zmax1 = float(z_max / km) ;
124 const char* nomy =
"y [km]" ;
125 const char* nomz =
"z [km]" ;
131 const char* device = 0x0 ;
132 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
134 des_equipot(uutab, ny, nz, ymin1, ymax1, zmin1, zmax1, ncour, nomy, nomz,
135 title, device, newgraph) ;
142 if (defsurf != 0x0) {
144 assert( &(defsurf->get_mp()) == &mp ) ;
146 newgraph = draw_bound ? 0 : 2 ;
148 des_surface_x(*defsurf, x0, device, newgraph) ;
158 int ndom = mp.get_mg()->get_nzone() ;
160 for (
int l=0; l<ndom-1; l++) {
163 newgraph = (l == ndom-2) ? 2 : 0 ;
165 des_domaine_x(mp, l, x0, device, newgraph) ;
175void des_coupe_y(
const Scalar& uu,
double y0,
int nzdes,
const char* title,
176 const Scalar* defsurf,
double zoom,
bool draw_bound,
177 int ncour,
int nx,
int nz) {
179 const Map& mp = uu.get_mp() ;
181 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
182 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
183 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
184 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
186 ray = ( a1 > ray ) ? a1 : ray ;
187 ray = ( a2 > ray ) ? a2 : ray ;
188 ray = ( a3 > ray ) ? a3 : ray ;
192 double x_min = mp.get_ori_x() - ray ;
193 double x_max = mp.get_ori_x() + ray ;
194 double z_min = mp.get_ori_z() - ray ;
195 double z_max = mp.get_ori_z() + ray ;
197 des_coupe_y(uu, y0, x_min, x_max, z_min, z_max, title, defsurf, draw_bound,
204void des_coupe_y(
const Scalar& uu,
double y0,
double x_min,
double x_max,
205 double z_min,
double z_max,
const char* title,
const Scalar* defsurf,
206 bool draw_bound,
int ncour,
int nx,
int nz) {
208 using namespace Unites ;
210 const Map& mp = uu.get_mp() ;
215 float* uutab =
new float[nx*nz] ;
217 double hx = (x_max - x_min) /
double(nx-1) ;
218 double hza = (z_max - z_min) /
double(nz-1) ;
222 for (
int j=0; j<nz; j++) {
224 double z = z_min + hza * j ;
226 for (
int i=0; i<nx; i++) {
228 double x = x_min + hx * i ;
231 double r, theta,
phi ;
232 mp.convert_absolute(
x, y0,
z,
r, theta,
phi) ;
234 uutab[nx*j+i] = float(uu.val_point(
r, theta,
phi)) ;
238 float xmin1 = float(x_min / km) ;
239 float xmax1 = float(x_max / km) ;
240 float zmin1 = float(z_min / km) ;
241 float zmax1 = float(z_max / km) ;
243 const char* nomx =
"x [km]" ;
244 const char* nomz =
"z [km]" ;
251 const char* device = 0x0 ;
252 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
254 des_equipot(uutab, nx, nz, xmin1, xmax1, zmin1, zmax1, ncour, nomx, nomz,
255 title, device, newgraph) ;
260 if (defsurf != 0x0) {
262 assert( &(defsurf->get_mp()) == &mp ) ;
264 newgraph = draw_bound ? 0 : 2 ;
266 des_surface_y(*defsurf, y0, device, newgraph) ;
277 int ndom = mp.get_mg()->get_nzone() ;
279 for (
int l=0; l<ndom-1; l++) {
282 newgraph = (l == ndom-2) ? 2 : 0 ;
284 des_domaine_y(mp, l, y0, device, newgraph) ;
294void des_coupe_z(
const Scalar& uu,
double z0,
int nzdes,
const char* title,
295 const Scalar* defsurf,
double zoom,
bool draw_bound,
296 int ncour,
int nx,
int ny) {
298 const Map& mp = uu.get_mp() ;
300 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
301 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
302 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
303 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
305 ray = ( a1 > ray ) ? a1 : ray ;
306 ray = ( a2 > ray ) ? a2 : ray ;
307 ray = ( a3 > ray ) ? a3 : ray ;
311 double x_min = mp.get_ori_x() - ray ;
312 double x_max = mp.get_ori_x() + ray ;
313 double y_min = mp.get_ori_y() - ray ;
314 double y_max = mp.get_ori_y() + ray ;
316 des_coupe_z(uu, z0, x_min, x_max, y_min, y_max, title, defsurf, draw_bound,
324void des_coupe_z(
const Scalar& uu,
double z0,
double x_min,
double x_max,
325 double y_min,
double y_max,
const char* title,
const Scalar* defsurf,
326 bool draw_bound,
int ncour,
int nx,
int ny) {
328 using namespace Unites ;
330 const Map& mp = uu.get_mp() ;
335 float* uutab =
new float[ny*nx] ;
337 double hy = (y_max - y_min) /
double(ny-1) ;
338 double hx = (x_max - x_min) /
double(nx-1) ;
340 for (
int j=0; j<ny; j++) {
342 double y = y_min + hy * j ;
344 for (
int i=0; i<nx; i++) {
346 double x = x_min + hx * i ;
349 double r, theta,
phi ;
350 mp.convert_absolute(
x,
y, z0,
r, theta,
phi) ;
352 uutab[nx*j+i] = float(uu.val_point(
r, theta,
phi)) ;
356 float ymin1 = float(y_min / km) ;
357 float ymax1 = float(y_max / km) ;
358 float xmin1 = float(x_min / km) ;
359 float xmax1 = float(x_max / km) ;
361 const char* nomy =
"y [km]" ;
362 const char* nomx =
"x [km]" ;
368 const char* device = 0x0 ;
369 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
371 des_equipot(uutab, nx, ny, xmin1, xmax1, ymin1, ymax1, ncour, nomx, nomy,
372 title, device, newgraph) ;
380 if (defsurf != 0x0) {
382 assert( &(defsurf->get_mp()) == &mp ) ;
384 newgraph = draw_bound ? 0 : 2 ;
386 des_surface_z(*defsurf, z0, device, newgraph) ;
395 int ndom = mp.get_mg()->get_nzone() ;
397 for (
int l=0; l<ndom-1; l++) {
400 newgraph = (l == ndom-2) ? 2 : 0 ;
402 des_domaine_z(mp, l, z0, device, newgraph) ;
Tensor field of valence 0 (or component of a tensorial field).
Coord z
z coordinate centered on the grid
Coord y
y coordinate centered on the grid
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord phi
coordinate centered on the grid
Coord x
x coordinate centered on the grid
Coord r
r coordinate centered on the grid