56#include "utilitaires.h"
61void des_coupe_x(
const Scalar& uu,
double x0,
int nzdes,
const char* title,
62 const Scalar* defsurf,
double zoom,
bool draw_bound,
63 int ncour,
int ny,
int nz) {
65 const Map& mp = uu.get_mp() ;
67 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
68 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
69 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
70 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
72 ray = ( a1 > ray ) ? a1 : ray ;
73 ray = ( a2 > ray ) ? a2 : ray ;
74 ray = ( a3 > ray ) ? a3 : ray ;
78 double y_min = mp.get_ori_y() - ray ;
79 double y_max = mp.get_ori_y() + ray ;
80 double z_min = mp.get_ori_z() - ray ;
81 double z_max = mp.get_ori_z() + ray ;
83 des_coupe_x(uu, x0, y_min, y_max, z_min, z_max, title, defsurf, draw_bound,
90void des_coupe_x(
const Scalar& uu,
double x0,
double y_min,
double y_max,
91 double z_min,
double z_max,
const char* title,
const Scalar* defsurf,
92 bool draw_bound,
int ncour,
int ny,
int nz) {
94using namespace Unites ;
96 const Map& mp = uu.get_mp() ;
101 float* uutab =
new float[ny*nz] ;
103 double hy = (y_max - y_min) /
double(ny-1) ;
104 double hza = (z_max - z_min) /
double(nz-1) ;
106 for (
int j=0; j<nz; j++) {
108 double z = z_min + hza * j ;
110 for (
int i=0; i<ny; i++) {
112 double y = y_min + hy * i ;
115 double r, theta,
phi ;
116 mp.convert_absolute(x0,
y,
z,
r, theta,
phi) ;
118 uutab[ny*j+i] = float(uu.val_point(
r, theta,
phi)) ;
122 float ymin1 = float(y_min / km) ;
123 float ymax1 = float(y_max / km) ;
124 float zmin1 = float(z_min / km) ;
125 float zmax1 = float(z_max / km) ;
127 const char* nomy =
"y [km]" ;
128 const char* nomz =
"z [km]" ;
134 const char* device = 0x0 ;
135 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
137 des_equipot(uutab, ny, nz, ymin1, ymax1, zmin1, zmax1, ncour, nomy, nomz,
138 title, device, newgraph) ;
145 if (defsurf != 0x0) {
147 assert( &(defsurf->get_mp()) == &mp ) ;
149 newgraph = draw_bound ? 0 : 2 ;
151 des_surface_x(*defsurf, x0, device, newgraph) ;
161 int ndom = mp.get_mg()->get_nzone() ;
163 for (
int l=0; l<ndom-1; l++) {
166 newgraph = (l == ndom-2) ? 2 : 0 ;
168 des_domaine_x(mp, l, x0, device, newgraph) ;
178void des_coupe_y(
const Scalar& uu,
double y0,
int nzdes,
const char* title,
179 const Scalar* defsurf,
double zoom,
bool draw_bound,
180 int ncour,
int nx,
int nz) {
182 const Map& mp = uu.get_mp() ;
184 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
185 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
186 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
187 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
189 ray = ( a1 > ray ) ? a1 : ray ;
190 ray = ( a2 > ray ) ? a2 : ray ;
191 ray = ( a3 > ray ) ? a3 : ray ;
195 double x_min = mp.get_ori_x() - ray ;
196 double x_max = mp.get_ori_x() + ray ;
197 double z_min = mp.get_ori_z() - ray ;
198 double z_max = mp.get_ori_z() + ray ;
200 des_coupe_y(uu, y0, x_min, x_max, z_min, z_max, title, defsurf, draw_bound,
207void des_coupe_y(
const Scalar& uu,
double y0,
double x_min,
double x_max,
208 double z_min,
double z_max,
const char* title,
const Scalar* defsurf,
209 bool draw_bound,
int ncour,
int nx,
int nz) {
211 using namespace Unites ;
213 const Map& mp = uu.get_mp() ;
218 float* uutab =
new float[nx*nz] ;
220 double hx = (x_max - x_min) /
double(nx-1) ;
221 double hza = (z_max - z_min) /
double(nz-1) ;
225 for (
int j=0; j<nz; j++) {
227 double z = z_min + hza * j ;
229 for (
int i=0; i<nx; i++) {
231 double x = x_min + hx * i ;
234 double r, theta,
phi ;
235 mp.convert_absolute(
x, y0,
z,
r, theta,
phi) ;
237 uutab[nx*j+i] = float(uu.val_point(
r, theta,
phi)) ;
241 float xmin1 = float(x_min / km) ;
242 float xmax1 = float(x_max / km) ;
243 float zmin1 = float(z_min / km) ;
244 float zmax1 = float(z_max / km) ;
246 const char* nomx =
"x [km]" ;
247 const char* nomz =
"z [km]" ;
254 const char* device = 0x0 ;
255 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
257 des_equipot(uutab, nx, nz, xmin1, xmax1, zmin1, zmax1, ncour, nomx, nomz,
258 title, device, newgraph) ;
263 if (defsurf != 0x0) {
265 assert( &(defsurf->get_mp()) == &mp ) ;
267 newgraph = draw_bound ? 0 : 2 ;
269 des_surface_y(*defsurf, y0, device, newgraph) ;
280 int ndom = mp.get_mg()->get_nzone() ;
282 for (
int l=0; l<ndom-1; l++) {
285 newgraph = (l == ndom-2) ? 2 : 0 ;
287 des_domaine_y(mp, l, y0, device, newgraph) ;
297void des_coupe_z(
const Scalar& uu,
double z0,
int nzdes,
const char* title,
298 const Scalar* defsurf,
double zoom,
bool draw_bound,
299 int ncour,
int nx,
int ny) {
301 const Map& mp = uu.get_mp() ;
303 double a1 = mp.val_r(nzdes-1, 1., M_PI/2., 0.) ;
304 double a2 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI/2.) ;
305 double a3 = mp.val_r(nzdes-1, 1., M_PI/2., M_PI) ;
306 double ray = mp.val_r(nzdes-1, 1., 0., 0.) ;
308 ray = ( a1 > ray ) ? a1 : ray ;
309 ray = ( a2 > ray ) ? a2 : ray ;
310 ray = ( a3 > ray ) ? a3 : ray ;
314 double x_min = mp.get_ori_x() - ray ;
315 double x_max = mp.get_ori_x() + ray ;
316 double y_min = mp.get_ori_y() - ray ;
317 double y_max = mp.get_ori_y() + ray ;
319 des_coupe_z(uu, z0, x_min, x_max, y_min, y_max, title, defsurf, draw_bound,
327void des_coupe_z(
const Scalar& uu,
double z0,
double x_min,
double x_max,
328 double y_min,
double y_max,
const char* title,
const Scalar* defsurf,
329 bool draw_bound,
int ncour,
int nx,
int ny) {
331 using namespace Unites ;
333 const Map& mp = uu.get_mp() ;
338 float* uutab =
new float[ny*nx] ;
340 double hy = (y_max - y_min) /
double(ny-1) ;
341 double hx = (x_max - x_min) /
double(nx-1) ;
343 for (
int j=0; j<ny; j++) {
345 double y = y_min + hy * j ;
347 for (
int i=0; i<nx; i++) {
349 double x = x_min + hx * i ;
352 double r, theta,
phi ;
353 mp.convert_absolute(
x,
y, z0,
r, theta,
phi) ;
355 uutab[nx*j+i] = float(uu.val_point(
r, theta,
phi)) ;
359 float ymin1 = float(y_min / km) ;
360 float ymax1 = float(y_max / km) ;
361 float xmin1 = float(x_min / km) ;
362 float xmax1 = float(x_max / km) ;
364 const char* nomy =
"y [km]" ;
365 const char* nomx =
"x [km]" ;
371 const char* device = 0x0 ;
372 int newgraph = ( (defsurf != 0x0) || draw_bound ) ? 1 : 3 ;
374 des_equipot(uutab, nx, ny, xmin1, xmax1, ymin1, ymax1, ncour, nomx, nomy,
375 title, device, newgraph) ;
383 if (defsurf != 0x0) {
385 assert( &(defsurf->get_mp()) == &mp ) ;
387 newgraph = draw_bound ? 0 : 2 ;
389 des_surface_z(*defsurf, z0, device, newgraph) ;
398 int ndom = mp.get_mg()->get_nzone() ;
400 for (
int l=0; l<ndom-1; l++) {
403 newgraph = (l == ndom-2) ? 2 : 0 ;
405 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