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 $" ;
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 ;
283void 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 ;
Base class for pure radial mappings.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping,...
void convert_absolute(double xx, double yy, double zz, double &rr, double &theta, double &pphi) const
Determines the coordinates corresponding to given absolute Cartesian coordinates (X,...
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
virtual void val_lx(double rr, double theta, double pphi, int &l, double &xi) const =0
Computes the domain index l and the value of corresponding to a point given by its physical coordina...
Coefficients storage for the multi-domain spectral method.
double val_point(int l, double x, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point, by means of the spectral ...
Tensor field of valence 0 (or component of a tensorial field).
int get_dzpuis() const
Returns dzpuis.
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values of the Scalar in the co...
Values and coefficients of a (real-value) function.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void coef() const
Computes the coeffcients of *this.
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.