28char vector_visu_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tensor/vector_visu.C,v 1.5 2014/10/13 08:53:45 j_novak Exp $" ;
70 if (*
triad ==
mp->get_bvect_cart()) {
74 if (*
triad ==
mp->get_bvect_spher()) {
76 vect_tmp->change_triad(
mp->get_bvect_cart() ) ;
80 cerr <<
"Vector::visu_arrows : unknown triad !" <<
endl ;
87 for (
int i=1;
i<=3;
i++) {
94 for (
int i=1;
i<=3;
i++) {
96 int dzpuis =
cvect.get_dzpuis() ;
98 cvect.dec_dzpuis(dzpuis) ;
107 title =
new char[2] ;
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" ;
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) ;
171 for (
int k=0;
k<nz;
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 ;
239 fheader <<
"interleaving = record-vector" <<
endl ;
246 fheader <<
"positions = regular, regular, regular, "
247 << xmin <<
", " <<
dx <<
", "
248 << ymin <<
", " <<
dy <<
", "
263 system(
"rm -f visu_vector3d.dxhead") ;
265 system(
"dx -image visu_vector3d.net &") ;
283void Vector::visu_streamline(
double xmin,
double xmax,
double ymin,
double ymax,
291 if (*
triad ==
mp->get_bvect_cart()) {
295 if (*
triad ==
mp->get_bvect_spher()) {
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++) {
309 dzpnonzero = dzpnonzero || !(
operator()(i).check_dzpuis(0)) ;
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 ;
408 mp->convert_absolute(xx, yy, zz, rr, th, ph) ;
413 mp->val_lx(rr, th, ph, l, xi) ;
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 ;
Time evolution with partial storage (*** under development ***).
Base class for pure radial mappings.
Coefficients storage for the multi-domain spectral method.
Tensor field of valence 0 (or component of a tensorial field).
int get_dzpuis() const
Returns dzpuis.
Values and coefficients of a (real-value) function.
Tensor field of valence 1.
const Scalar & operator()(int) const
Readonly access to a component.
Vector(const Map &map, int tipe, const Base_vect &triad_i)
Standard constructor.
void visu_arrows(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, const char *title0=0x0, const char *filename0=0x0, bool start_dx=true, int nx=8, int ny=8, int nz=8) const
3D visualization via OpenDX.
virtual void change_triad(const Base_vect &)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
Scalar & set(int)
Read/write access to a component.
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.