66 double zmin,
double zmax,
const char* title0,
const char* filename0,
67 bool start_dx,
int nx,
int ny,
int nz)
const {
78 vect_tmp =
new Vector(*
this) ;
83 cerr <<
"Vector::visu_arrows : unknown triad !" << endl ;
89 bool dzpnonzero = false ;
90 for (
int i=1; i<=3; i++) {
94 if (vect_tmp == 0x0) {
95 vect_tmp =
new Vector(*
this) ;
97 for (
int i=1; i<=3; i++) {
110 title =
new char[2] ;
113 title_quotes =
new char[4] ;
114 strcpy(title_quotes,
"\" \"") ;
117 title =
new char[ strlen(title0)+1 ] ;
118 strcpy(title, title0) ;
120 title_quotes =
new char[ strlen(title0)+3 ] ;
121 strcpy(title_quotes,
"\"") ;
122 strcat(title_quotes, title0) ;
123 strcat(title_quotes,
"\"") ;
131 if (filename0 == 0x0) {
132 filename =
new char[30] ;
133 strcpy(filename,
"vector3d_arrows.dxdata") ;
136 filename =
new char[ strlen(filename0)+8 ] ;
137 strcpy(filename, filename0) ;
138 strcat(filename,
".dxdata") ;
141 ofstream fdata(filename) ;
143 fdata << title <<
"\n" ;
144 fdata <<
"size : " << nx <<
" x " << ny <<
" x " << nz <<
"\n" ;
145 fdata <<
"x_min = " << xmin <<
" x_max = " << xmax <<
"\n" ;
146 fdata <<
"y_min = " << ymin <<
" y_max = " << ymax <<
"\n" ;
147 fdata <<
"z_min = " << zmin <<
" z_max = " << zmax <<
"\n" ;
150 const Valeur& vax = (vect->operator()(1)).get_spectral_va() ;
151 const Valeur& vay = (vect->operator()(2)).get_spectral_va() ;
152 const Valeur& vaz = (vect->operator()(3)).get_spectral_va() ;
161 assert( dynamic_cast<const Map_radial*>(
mp) != 0x0 ) ;
164 fdata.setf(ios::scientific) ;
168 double dx = (xmax - xmin) /
double(nx-1) ;
169 double dy = (ymax - ymin) /
double(ny-1) ;
170 double dz = (zmax - zmin) /
double(nz-1) ;
174 for (
int k=0; k<nz; k++) {
176 double zz = zmin + dz * k ;
178 for (
int j=0; j<ny; j++) {
180 double yy = ymin + dy * j ;
182 for (
int i=0; i<nx; i++) {
184 double xx = xmin + dx * i ;
199 double vx = cvax.
val_point(l, xi, th, ph) ;
200 double vy = cvay.
val_point(l, xi, th, ph) ;
201 double vz = cvaz.
val_point(l, xi, th, ph) ;
203 fdata.width(14) ; fdata << vx ;
204 fdata.width(14) ; fdata << vy ;
205 fdata.width(14) ; fdata << vz ;
218 if (npoint != 0) fdata <<
"\n" ;
227 if (filename0 == 0x0) {
228 headername =
new char[30] ;
229 strcpy(headername,
"vector3d_arrows.dxhead") ;
232 headername =
new char[ strlen(filename0)+9 ] ;
233 strcpy(headername, filename0) ;
234 strcat(headername,
".dxhead") ;
237 ofstream fheader(headername) ;
239 fheader <<
"file = " << filename << endl ;
240 fheader <<
"grid = " << nx <<
" x " << ny <<
" x " << nz << endl ;
241 fheader <<
"format = ascii" << endl ;
242 fheader <<
"interleaving = record-vector" << endl ;
243 fheader <<
"majority = column" << endl ;
244 fheader <<
"header = lines 5" << endl ;
245 fheader <<
"field = " << title_quotes << endl ;
246 fheader <<
"structure = 3-vector" << endl ;
247 fheader <<
"type = float" << endl ;
248 fheader <<
"dependency = positions" << endl ;
249 fheader <<
"positions = regular, regular, regular, " 250 << xmin <<
", " << dx <<
", " 251 << ymin <<
", " << dy <<
", " 252 << zmin <<
", " << dz << endl ;
254 fheader <<
"end" << endl ;
261 char* commande =
new char[ strlen(headername) + 60 ] ;
262 strcpy(commande,
"ln -s ") ;
263 strcat(commande, headername) ;
264 strcat(commande,
" visu_vector3d.dxhead") ;
266 system(
"rm -f visu_vector3d.dxhead") ;
268 system(
"dx -image visu_vector3d.net &") ;
277 if (vect_tmp != 0x0)
delete vect_tmp ;
279 delete [] title_quotes ;
281 delete [] headername ;
286 void Vector::visu_streamline(
double xmin,
double xmax,
double ymin,
double ymax,
287 double zmin,
double zmax,
const char* title0,
const char* filename0,
288 bool start_dx,
int nx,
int ny,
int nz)
const {
299 vect_tmp =
new Vector(*
this) ;
304 cerr <<
"Vector::visu_streamline : unknown triad !" << endl ;
310 bool dzpnonzero = false ;
311 for (
int i=1; i<=3; i++) {
315 if (vect_tmp == 0x0) {
316 vect_tmp =
new Vector(*
this) ;
318 for (
int i=1; i<=3; i++) {
319 Scalar& cvect = vect_tmp->
set(i) ;
322 cvect.dec_dzpuis(dzpuis) ;
331 title =
new char[2] ;
334 title_quotes =
new char[4] ;
335 strcpy(title_quotes,
"\" \"") ;
338 title =
new char[ strlen(title0)+1 ] ;
339 strcpy(title, title0) ;
341 title_quotes =
new char[ strlen(title0)+3 ] ;
342 strcpy(title_quotes,
"\"") ;
343 strcat(title_quotes, title0) ;
344 strcat(title_quotes,
"\"") ;
352 if (filename0 == 0x0) {
353 filename =
new char[30] ;
354 strcpy(filename,
"vector3d_streamline.dxdata") ;
357 filename =
new char[ strlen(filename0)+8 ] ;
358 strcpy(filename, filename0) ;
359 strcat(filename,
".dxdata") ;
362 ofstream fdata(filename) ;
364 fdata << title <<
"\n" ;
365 fdata <<
"size : " << nx <<
" x " << ny <<
" x " << nz <<
"\n" ;
366 fdata <<
"x_min = " << xmin <<
" x_max = " << xmax <<
"\n" ;
367 fdata <<
"y_min = " << ymin <<
" y_max = " << ymax <<
"\n" ;
368 fdata <<
"z_min = " << zmin <<
" z_max = " << zmax <<
"\n" ;
371 const Valeur& vax = (vect->operator()(1)).get_spectral_va() ;
372 const Valeur& vay = (vect->operator()(2)).get_spectral_va() ;
373 const Valeur& vaz = (vect->operator()(3)).get_spectral_va() ;
377 const Mtbl_cf& cvax = *(vax.c_cf) ;
378 const Mtbl_cf& cvay = *(vay.c_cf) ;
379 const Mtbl_cf& cvaz = *(vaz.c_cf) ;
382 assert( dynamic_cast<const Map_radial*>(
mp) != 0x0 ) ;
385 fdata.setf(ios::scientific) ;
389 double dx = (xmax - xmin) /
double(nx-1) ;
390 double dy = (ymax - ymin) /
double(ny-1) ;
391 double dz = (zmax - zmin) /
double(nz-1) ;
395 for (
int k=0; k<nz; k++) {
397 double zz = zmin + dz * k ;
399 for (
int j=0; j<ny; j++) {
401 double yy = ymin + dy * j ;
403 for (
int i=0; i<nx; i++) {
405 double xx = xmin + dx * i ;
420 double vx = cvax.val_point(l, xi, th, ph) ;
421 double vy = cvay.val_point(l, xi, th, ph) ;
422 double vz = cvaz.val_point(l, xi, th, ph) ;
424 fdata.width(14) ; fdata << vx ;
425 fdata.width(14) ; fdata << vy ;
426 fdata.width(14) ; fdata << vz ;
439 if (npoint != 0) fdata <<
"\n" ;
448 if (filename0 == 0x0) {
449 headername =
new char[30] ;
450 strcpy(headername,
"vector3d_streamline.dxhead") ;
453 headername =
new char[ strlen(filename0)+9 ] ;
454 strcpy(headername, filename0) ;
455 strcat(headername,
".dxhead") ;
458 ofstream fheader(headername) ;
460 fheader <<
"file = " << filename << endl ;
461 fheader <<
"grid = " << nx <<
" x " << ny <<
" x " << nz << endl ;
462 fheader <<
"format = ascii" << endl ;
463 fheader <<
"interleaving = record-vector" << endl ;
464 fheader <<
"majority = column" << endl ;
465 fheader <<
"header = lines 5" << endl ;
466 fheader <<
"field = " << title_quotes << endl ;
467 fheader <<
"structure = 3-vector" << endl ;
468 fheader <<
"type = float" << endl ;
469 fheader <<
"dependency = positions" << endl ;
470 fheader <<
"positions = regular, regular, regular, " 471 << xmin <<
", " << dx <<
", " 472 << ymin <<
", " << dy <<
", " 473 << zmin <<
", " << dz << endl ;
475 fheader <<
"end" << endl ;
482 char* commande =
new char[ strlen(headername) + 60 ] ;
483 strcpy(commande,
"ln -s ") ;
484 strcat(commande, headername) ;
485 strcat(commande,
" visu_vector3d_SL.general") ;
487 system(
"rm -f visu_vector3d_SL.general") ;
489 system(
"dx -image visu_vector3d_SL.net &") ;
498 if (vect_tmp != 0x0)
delete vect_tmp ;
500 delete [] title_quotes ;
502 delete [] headername ;
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void coef() const
Computes the coeffcients of *this.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Tensor field of valence 0 (or component of a tensorial field).
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Values and coefficients of a (real-value) function.
virtual void change_triad(const Base_vect &)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
Tensor field of valence 1.
Vector(const Map &map, int tipe, const Base_vect &triad_i)
Standard constructor.
int get_dzpuis() const
Returns dzpuis.
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 ...
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
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.
Coefficients storage for the multi-domain spectral method.
Scalar & set(int)
Read/write access to a component.
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...
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
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 Scalar & operator()(int) const
Readonly access to a component.
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...
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...