28 char vector_visu_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tensor/vector_visu.C,v 1.5 2014/10/13 08:53:45 j_novak Exp $" ;
63 double zmin,
double zmax,
const char* title0,
const char* filename0,
64 bool start_dx,
int nx,
int ny,
int nz)
const {
75 vect_tmp =
new Vector(*
this) ;
80 cerr <<
"Vector::visu_arrows : unknown triad !" << endl ;
86 bool dzpnonzero = false ;
87 for (
int i=1; i<=3; i++) {
91 if (vect_tmp == 0x0) {
92 vect_tmp =
new Vector(*
this) ;
94 for (
int i=1; i<=3; i++) {
107 title =
new char[2] ;
110 title_quotes =
new char[4] ;
111 strcpy(title_quotes,
"\" \"") ;
114 title =
new char[ strlen(title0)+1 ] ;
115 strcpy(title, title0) ;
117 title_quotes =
new char[ strlen(title0)+3 ] ;
118 strcpy(title_quotes,
"\"") ;
119 strcat(title_quotes, title0) ;
120 strcat(title_quotes,
"\"") ;
128 if (filename0 == 0x0) {
129 filename =
new char[30] ;
130 strcpy(filename,
"vector3d_arrows.dxdata") ;
133 filename =
new char[ strlen(filename0)+8 ] ;
134 strcpy(filename, filename0) ;
135 strcat(filename,
".dxdata") ;
138 ofstream fdata(filename) ;
140 fdata << title <<
"\n" ;
141 fdata <<
"size : " << nx <<
" x " << ny <<
" x " << nz <<
"\n" ;
142 fdata <<
"x_min = " << xmin <<
" x_max = " << xmax <<
"\n" ;
143 fdata <<
"y_min = " << ymin <<
" y_max = " << ymax <<
"\n" ;
144 fdata <<
"z_min = " << zmin <<
" z_max = " << zmax <<
"\n" ;
147 const Valeur& vax = (vect->operator()(1)).get_spectral_va() ;
148 const Valeur& vay = (vect->operator()(2)).get_spectral_va() ;
149 const Valeur& vaz = (vect->operator()(3)).get_spectral_va() ;
161 fdata.setf(ios::scientific) ;
165 double dx = (xmax - xmin) /
double(nx-1) ;
166 double dy = (ymax - ymin) /
double(ny-1) ;
167 double dz = (zmax - zmin) /
double(nz-1) ;
171 for (
int k=0; k<nz; k++) {
173 double zz = zmin + dz * k ;
175 for (
int j=0; j<ny; j++) {
177 double yy = ymin + dy * j ;
179 for (
int i=0; i<nx; i++) {
181 double xx = xmin + dx * i ;
196 double vx = cvax.
val_point(l, xi, th, ph) ;
197 double vy = cvay.
val_point(l, xi, th, ph) ;
198 double vz = cvaz.
val_point(l, xi, th, ph) ;
200 fdata.width(14) ; fdata << vx ;
201 fdata.width(14) ; fdata << vy ;
202 fdata.width(14) ; fdata << vz ;
215 if (npoint != 0) fdata <<
"\n" ;
224 if (filename0 == 0x0) {
225 headername =
new char[30] ;
226 strcpy(headername,
"vector3d_arrows.dxhead") ;
229 headername =
new char[ strlen(filename0)+9 ] ;
230 strcpy(headername, filename0) ;
231 strcat(headername,
".dxhead") ;
234 ofstream fheader(headername) ;
236 fheader <<
"file = " << filename << endl ;
237 fheader <<
"grid = " << nx <<
" x " << ny <<
" x " << nz << endl ;
238 fheader <<
"format = ascii" << endl ;
239 fheader <<
"interleaving = record-vector" << endl ;
240 fheader <<
"majority = column" << endl ;
241 fheader <<
"header = lines 5" << endl ;
242 fheader <<
"field = " << title_quotes << endl ;
243 fheader <<
"structure = 3-vector" << endl ;
244 fheader <<
"type = float" << endl ;
245 fheader <<
"dependency = positions" << endl ;
246 fheader <<
"positions = regular, regular, regular, "
247 << xmin <<
", " << dx <<
", "
248 << ymin <<
", " << dy <<
", "
249 << zmin <<
", " << dz << endl ;
251 fheader <<
"end" << endl ;
258 char* commande =
new char[ strlen(headername) + 60 ] ;
259 strcpy(commande,
"ln -s ") ;
260 strcat(commande, headername) ;
261 strcat(commande,
" visu_vector3d.dxhead") ;
263 system(
"rm -f visu_vector3d.dxhead") ;
265 system(
"dx -image visu_vector3d.net &") ;
274 if (vect_tmp != 0x0)
delete vect_tmp ;
276 delete [] title_quotes ;
278 delete [] headername ;
283 void Vector::visu_streamline(
double xmin,
double xmax,
double ymin,
double ymax,
284 double zmin,
double zmax,
const char* title0,
const char* filename0,
285 bool start_dx,
int nx,
int ny,
int nz)
const {
296 vect_tmp =
new Vector(*
this) ;
301 cerr <<
"Vector::visu_streamline : unknown triad !" << endl ;
307 bool dzpnonzero = false ;
308 for (
int i=1; i<=3; i++) {
312 if (vect_tmp == 0x0) {
313 vect_tmp =
new Vector(*
this) ;
315 for (
int i=1; i<=3; i++) {
316 Scalar& cvect = vect_tmp->
set(i) ;
319 cvect.dec_dzpuis(dzpuis) ;
328 title =
new char[2] ;
331 title_quotes =
new char[4] ;
332 strcpy(title_quotes,
"\" \"") ;
335 title =
new char[ strlen(title0)+1 ] ;
336 strcpy(title, title0) ;
338 title_quotes =
new char[ strlen(title0)+3 ] ;
339 strcpy(title_quotes,
"\"") ;
340 strcat(title_quotes, title0) ;
341 strcat(title_quotes,
"\"") ;
349 if (filename0 == 0x0) {
350 filename =
new char[30] ;
351 strcpy(filename,
"vector3d_streamline.dxdata") ;
354 filename =
new char[ strlen(filename0)+8 ] ;
355 strcpy(filename, filename0) ;
356 strcat(filename,
".dxdata") ;
359 ofstream fdata(filename) ;
361 fdata << title <<
"\n" ;
362 fdata <<
"size : " << nx <<
" x " << ny <<
" x " << nz <<
"\n" ;
363 fdata <<
"x_min = " << xmin <<
" x_max = " << xmax <<
"\n" ;
364 fdata <<
"y_min = " << ymin <<
" y_max = " << ymax <<
"\n" ;
365 fdata <<
"z_min = " << zmin <<
" z_max = " << zmax <<
"\n" ;
368 const Valeur& vax = (vect->operator()(1)).get_spectral_va() ;
369 const Valeur& vay = (vect->operator()(2)).get_spectral_va() ;
370 const Valeur& vaz = (vect->operator()(3)).get_spectral_va() ;
374 const Mtbl_cf& cvax = *(vax.c_cf) ;
375 const Mtbl_cf& cvay = *(vay.c_cf) ;
376 const Mtbl_cf& cvaz = *(vaz.c_cf) ;
379 assert(
dynamic_cast<const Map_radial*
>(
mp) != 0x0 ) ;
382 fdata.setf(ios::scientific) ;
386 double dx = (xmax - xmin) /
double(nx-1) ;
387 double dy = (ymax - ymin) /
double(ny-1) ;
388 double dz = (zmax - zmin) /
double(nz-1) ;
392 for (
int k=0; k<nz; k++) {
394 double zz = zmin + dz * k ;
396 for (
int j=0; j<ny; j++) {
398 double yy = ymin + dy * j ;
400 for (
int i=0; i<nx; i++) {
402 double xx = xmin + dx * i ;
417 double vx = cvax.val_point(l, xi, th, ph) ;
418 double vy = cvay.val_point(l, xi, th, ph) ;
419 double vz = cvaz.val_point(l, xi, th, ph) ;
421 fdata.width(14) ; fdata << vx ;
422 fdata.width(14) ; fdata << vy ;
423 fdata.width(14) ; fdata << vz ;
436 if (npoint != 0) fdata <<
"\n" ;
445 if (filename0 == 0x0) {
446 headername =
new char[30] ;
447 strcpy(headername,
"vector3d_streamline.dxhead") ;
450 headername =
new char[ strlen(filename0)+9 ] ;
451 strcpy(headername, filename0) ;
452 strcat(headername,
".dxhead") ;
455 ofstream fheader(headername) ;
457 fheader <<
"file = " << filename << endl ;
458 fheader <<
"grid = " << nx <<
" x " << ny <<
" x " << nz << endl ;
459 fheader <<
"format = ascii" << endl ;
460 fheader <<
"interleaving = record-vector" << endl ;
461 fheader <<
"majority = column" << endl ;
462 fheader <<
"header = lines 5" << endl ;
463 fheader <<
"field = " << title_quotes << endl ;
464 fheader <<
"structure = 3-vector" << endl ;
465 fheader <<
"type = float" << endl ;
466 fheader <<
"dependency = positions" << endl ;
467 fheader <<
"positions = regular, regular, regular, "
468 << xmin <<
", " << dx <<
", "
469 << ymin <<
", " << dy <<
", "
470 << zmin <<
", " << dz << endl ;
472 fheader <<
"end" << endl ;
479 char* commande =
new char[ strlen(headername) + 60 ] ;
480 strcpy(commande,
"ln -s ") ;
481 strcat(commande, headername) ;
482 strcat(commande,
" visu_vector3d_SL.general") ;
484 system(
"rm -f visu_vector3d_SL.general") ;
486 system(
"dx -image visu_vector3d_SL.net &") ;
495 if (vect_tmp != 0x0)
delete vect_tmp ;
497 delete [] title_quotes ;
499 delete [] headername ;