82 double umax,
double vmin,
double vmax,
const char* title0,
83 const char* filename0,
bool start_dx,
int nu,
int nv)
const {
88 switch (section_type) {
100 plane.
set(2,1) = 0. ;
101 plane.
set(2,2) = 1. ;
103 visu_section(plane, umin, umax, vmin, vmax, title0, filename0,
109 plane.
set(0,0) = 0. ;
110 plane.
set(0,1) = aa ;
111 plane.
set(0,2) = 0. ;
113 plane.
set(1,0) = 1. ;
114 plane.
set(1,1) = 0. ;
115 plane.
set(1,2) = 0. ;
117 plane.
set(2,0) = 0. ;
118 plane.
set(2,1) = 0. ;
119 plane.
set(2,2) = 1. ;
121 visu_section(plane, umin, umax, vmin, vmax, title0, filename0,
127 plane.
set(0,0) = 0. ;
128 plane.
set(0,1) = 0. ;
129 plane.
set(0,2) = aa ;
131 plane.
set(1,0) = 1. ;
132 plane.
set(1,1) = 0. ;
133 plane.
set(1,2) = 0. ;
135 plane.
set(2,0) = 0. ;
136 plane.
set(2,1) = 1. ;
137 plane.
set(2,2) = 0. ;
139 visu_section(plane, umin, umax, vmin, vmax, title0, filename0,
145 cerr <<
"Scalar::visu_section : unknown type of section ! \n" ;
146 cerr <<
" section_type = " << section_type << endl ;
160 double vmin,
double vmax,
const char* title0,
const char* filename0,
161 bool start_dx,
int nu,
int nv)
const {
166 title =
new char[2] ;
169 title_quotes =
new char[4] ;
170 strcpy(title_quotes,
"\" \"") ;
173 title =
new char[ strlen(title0)+1 ] ;
174 strcpy(title, title0) ;
176 title_quotes =
new char[ strlen(title0)+3 ] ;
177 strcpy(title_quotes,
"\"") ;
178 strcat(title_quotes, title0) ;
179 strcat(title_quotes,
"\"") ;
187 if (filename0 == 0x0) {
188 filename =
new char[30] ;
189 strcpy(filename,
"scalar_section.dxdata") ;
192 filename =
new char[ strlen(filename0)+8 ] ;
193 strcpy(filename, filename0) ;
194 strcat(filename,
".dxdata") ;
197 ofstream fdata(filename) ;
199 fdata << title <<
"\n" ;
200 fdata <<
"size : " << nu <<
" x " << nv <<
"\n" ;
201 fdata <<
"u_min = " << umin <<
" u_max = " << umax <<
"\n" ;
202 fdata <<
"v_min = " << vmin <<
" v_max = " << vmax <<
"\n" ;
207 double xa0 = plane(0,0) ;
208 double ya0 = plane(0,1) ;
209 double za0 = plane(0,2) ;
211 double eux = plane(1,0) ;
212 double euy = plane(1,1) ;
213 double euz = plane(1,2) ;
215 double evx = plane(2,0) ;
216 double evy = plane(2,1) ;
217 double evz = plane(2,2) ;
225 assert( dynamic_cast<const Map_radial*>(
mp) != 0x0 ) ;
228 fdata.setf(ios::scientific) ;
232 double du = (umax - umin) /
double(nu-1) ;
233 double dv = (vmax - vmin) /
double(nv-1) ;
237 for (
int j=0; j<nv; j++) {
239 double v = vmin + dv * j ;
241 for (
int i=0; i<nu; i++) {
243 double u = umin + du * i ;
245 double xa = xa0 + u * eux + v * evx ;
246 double ya = ya0 + u * euy + v * evy ;
247 double za = za0 + u * euz + v * evz ;
264 double ff = cva.
val_point(l, xi, th, ph) ;
278 if (npoint != 0) fdata <<
"\n" ;
287 if (filename0 == 0x0) {
288 headername =
new char[30] ;
289 strcpy(headername,
"scalar_section.dxhead") ;
292 headername =
new char[ strlen(filename0)+9 ] ;
293 strcpy(headername, filename0) ;
294 strcat(headername,
".dxhead") ;
297 ofstream fheader(headername) ;
299 fheader <<
"file = " << filename << endl ;
300 fheader <<
"grid = " << nu <<
" x " << nv << endl ;
301 fheader <<
"format = ascii" << endl ;
302 fheader <<
"interleaving = record" << endl ;
303 fheader <<
"majority = column" << endl ;
304 fheader <<
"header = lines 4" << endl ;
305 fheader <<
"field = " << title_quotes << endl ;
306 fheader <<
"structure = scalar" << endl ;
307 fheader <<
"type = float" << endl ;
308 fheader <<
"dependency = positions" << endl ;
309 fheader <<
"positions = regular, regular, " << umin <<
", " << du
310 <<
", " << vmin <<
", " << dv << endl ;
312 fheader <<
"end" << endl ;
319 char* commande =
new char[ strlen(headername) + 60 ] ;
320 strcpy(commande,
"ln -s ") ;
321 strcat(commande, headername) ;
322 strcat(commande,
" visu_section.dxhead") ;
324 system(
"rm -f visu_section.dxhead") ;
326 system(
"dx -image visu_section.net &") ;
334 delete [] title_quotes ;
336 delete [] headername ;
346 double zmin,
double zmax,
const char* title0,
const char* filename0,
347 bool start_dx,
int nx,
int ny,
int nz)
const {
354 scal_tmp =
new Scalar(*
this) ;
365 title =
new char[2] ;
368 title_quotes =
new char[4] ;
369 strcpy(title_quotes,
"\" \"") ;
372 title =
new char[ strlen(title0)+1 ] ;
373 strcpy(title, title0) ;
375 title_quotes =
new char[ strlen(title0)+3 ] ;
376 strcpy(title_quotes,
"\"") ;
377 strcat(title_quotes, title0) ;
378 strcat(title_quotes,
"\"") ;
386 if (filename0 == 0x0) {
387 filename =
new char[30] ;
388 strcpy(filename,
"scalar_box.dxdata") ;
391 filename =
new char[ strlen(filename0)+8 ] ;
392 strcpy(filename, filename0) ;
393 strcat(filename,
".dxdata") ;
396 ofstream fdata(filename) ;
398 fdata << title <<
"\n" ;
399 fdata <<
"size : " << nx <<
" x " << ny <<
" x " << nz <<
"\n" ;
400 fdata <<
"x_min = " << xmin <<
" x_max = " << xmax <<
"\n" ;
401 fdata <<
"y_min = " << ymin <<
" y_max = " << ymax <<
"\n" ;
402 fdata <<
"z_min = " << zmin <<
" z_max = " << zmax <<
"\n" ;
410 assert( dynamic_cast<const Map_radial*>(
mp) != 0x0 ) ;
413 fdata.setf(ios::scientific) ;
417 double dx = (xmax - xmin) /
double(nx-1) ;
418 double dy = (ymax - ymin) /
double(ny-1) ;
419 double dz = (zmax - zmin) /
double(nz-1) ;
423 for (
int k=0; k<nz; k++) {
425 double zz = zmin + dz * k ;
427 for (
int j=0; j<ny; j++) {
429 double yy = ymin + dy * j ;
431 for (
int i=0; i<nx; i++) {
433 double xx = xmin + dx * i ;
448 double ff = cva.
val_point(l, xi, th, ph) ;
464 if (npoint != 0) fdata <<
"\n" ;
473 if (filename0 == 0x0) {
474 headername =
new char[30] ;
475 strcpy(headername,
"scalar_box.dxhead") ;
478 headername =
new char[ strlen(filename0)+9 ] ;
479 strcpy(headername, filename0) ;
480 strcat(headername,
".dxhead") ;
483 ofstream fheader(headername) ;
485 fheader <<
"file = " << filename << endl ;
486 fheader <<
"grid = " << nx <<
" x " << ny <<
" x " << nz << endl ;
487 fheader <<
"format = ascii" << endl ;
488 fheader <<
"interleaving = record" << endl ;
489 fheader <<
"majority = column" << endl ;
490 fheader <<
"header = lines 5" << endl ;
491 fheader <<
"field = " << title_quotes << endl ;
492 fheader <<
"structure = scalar" << endl ;
493 fheader <<
"type = float" << endl ;
494 fheader <<
"dependency = positions" << endl ;
495 fheader <<
"positions = regular, regular, regular, " 496 << xmin <<
", " << dx <<
", " 497 << ymin <<
", " << dy <<
", " 498 << zmin <<
", " << dz << endl ;
500 fheader <<
"end" << endl ;
507 char* commande =
new char[ strlen(headername) + 60 ] ;
508 strcpy(commande,
"ln -s ") ;
509 strcat(commande, headername) ;
510 strcat(commande,
" visu_scalar_box.dxhead") ;
512 system(
"rm -f visu_scalar_box.dxhead") ;
514 system(
"dx -image visu_scalar_box.net &") ;
523 if (scal_tmp != 0x0)
delete scal_tmp ;
525 delete [] title_quotes ;
527 delete [] headername ;
539 double umax,
double vmin,
double vmax,
int jtime,
double ,
540 int jgraph,
const char* title,
const char* filename_root,
bool start_dx,
541 int nu,
int nv)
const {
543 if ( jtime % jgraph != 0 ) return ;
547 int k = jtime / jgraph ;
550 if (filename_root == 0x0) {
551 filename =
new char[40] ;
552 strcpy(filename,
"anim") ;
555 filename =
new char[ strlen(filename_root)+10 ] ;
556 strcpy(filename, filename_root) ;
560 sprintf(nomk,
"%04d", k) ;
561 strcat(filename, nomk) ;
566 visu_section(section_type, aa, umin, umax, vmin, vmax, title, filename,
574 system(
"dx -edit anime.net &") ;
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void coef() const
Computes the coeffcients of *this.
Scalar(const Map &mpi)
Constructor from mapping.
void visu_section_anim(const char section_type, double aa, double umin, double umax, double vmin, double vmax, int jtime, double ttime, int jgraph=1, const char *title=0x0, const char *filename_root=0x0, bool start_dx=false, int nu=200, int nv=200) const
3D visualization via time evolving plane section (animation).
void visu_box(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=40, int ny=40, int nz=40) const
3D visualization (volume rendering) via OpenDX.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Tensor field of valence 0 (or component of a tensorial field).
Values and coefficients of a (real-value) function.
int dzpuis
Power of r by which the quantity represented by this must be divided in the compactified external do...
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Valeur va
The numerical value of the Scalar.
void visu_section(const char section_type, double aa, double umin, double umax, double vmin, double vmax, const char *title=0x0, const char *filename=0x0, bool start_dx=true, int nu=200, int nv=200) const
3D visualization via a plane section.
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 ...
Coefficients storage for the multi-domain spectral method.
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...
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...