Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
iorheo.h
Go to the documentation of this file.
1# ifndef _IORHEO_H
2# define _IORHEO_H
23
24#include "rheolef/iorheobase.h"
25#include <bitset>
26namespace rheolef {
27/*Class:iorheo
28NAME: @code{iorheo} - input and output functions and manipulation
29@cindex graphic render
30@clindex iorheo
31@clindex csr
32@clindex geo
33@clindex field
34@fiindex @file{.geo} mesh
35@fiindex @file{.hb} Harwell-Boeing matrix
36@fiindex @file{.mm} Matrix-Market matrix
37@fiindex @file{.field} field
38@fiindex @file{.tcl} tool command language
39@fiindex @file{.vtk} visualization toolkit
40@fiindex @file{.off} geomview data
41@fiindex @file{.plot} gnuplot script
42@fiindex @file{.gdat} gnuplot data
43@fiindex @file{.mtv} plotmtv
44@fiindex @file{.x3d} x3d mesh
45@fiindex @file{.atom} PlotM mesh
46@toindex @code{gnuplot}
47@toindex @code{plotmtv}
48@toindex @code{vtk}
49@toindex @code{geomview}
50@toindex @code{PlotM}
51SMALL PIECES OF CODE:
52 input geo in standard file format:
53@example
54 cin >> g;
55@end example
56@noindent
57 output geo in standard file format:
58@example
59 cout << g;
60@end example
61@noindent
62 output geo in gnuplot format:
63@example
64 cout << gnuplot << g;
65@end example
66
67DESCRIPTION:
68 @noindent
69 output manipulators enable the selection of
70 some pretty graphic options, in an elegant fashion.
71
72BOOLEAN MANIPULATORS:
73 @noindent
74 The boolean manipulators set an internal optional flag.
75 Each option has its negative counterpart, as
76 @code{verbose} and @code{noverbose}, by adding the
77 @code{no} prefix.
78 @example
79 cout << noverbose << a;
80 @end example
81 @table @code
82 @item verbose
83 trace some details, such as loading, storing or
84 unix command operations on @code{cerr}.
85 Default is on.
86 @item clean
87 delete temporary files during graphic outputs.
88 Default is on.
89 @item execute
90 run unix operations, such as @code{gnuplot} or
91 @code{plotmtv} or @code{vtk}. Note that the corresponding
92 files are created.
93 Default is on.
94 @item transpose
95 perform transposition when loading/soring a @code{csr} matrix
96 from Harwell-Boeing file.
97 This feature is available, since the file format store
98 matrix in transposed format.
99 Default is off.
100 @item logscale
101 when using matrix sparse postscript plot manipulator @code{ps}
102 and @code{color}. The color scale is related to a logarithmic
103 scale.
104 @item fill
105 @itemx grid
106 @itemx shrink
107 @itemx tube
108 @itemx ball
109 @itemx full
110 @itemx stereo
111 @itemx cut
112 @itemx iso
113 @itemx split
114 when using the @code{vtk} or @code{paraview} manipulators
115 for a mesh or a field.
116
117 @item volume
118 volume rendering by using ray cast functions.
119@cindex velocity
120@cindex deformation
121
122 @item velocity
123 @itemx deformation
124 Vector-valued fields are rendered by using arrows (@code{velocity})
125 or deformed meshes (@code{deformation}).
126 For @code{vtk} or @code{plotmtv} rendering.
127
128@cindex elevation
129
130 @item elevation
131 Scalar valued fields in two dimension are rendered by using
132 a tridimensionnal surface elevation.
133 For @code{vtk} or @code{plotmtv} rendering.
134
135@fiindex @file{.vtk} visualization toolkit
136@toindex @code{paraview}
137@clindex branch
138
139 @item skipvtk
140 For the @code{branch} class.
141 Combined with @code{paraview}, only create the main python @file{.py} file,
142 do not regenerate all the @file{.vtk} data files.
143
144 @end table
145
146@findex fastfieldload
147 @table @code
148 @item fastfieldload
149 try to reuse the supplied space. Default is on.
150 @end table
151
152FILE FORMAT MANIPULATORS:
153@fiindex @file{.bamg} bamg mesh
154@fiindex @file{.mesh} mmg3d mesh
155@fiindex @file{.node} tetgen mesh nodes
156@fiindex @file{.ele} tetgen mesh elements
157@fiindex @file{.face} tetgen mesh boundary faces
158@fiindex @file{.v} grummp tridimensionnal mesh
159@fiindex @file{.m} grummp bidimensionnal mesh
160@fiindex @file{.gmsh} gmsh mesh
161@fiindex @file{.gmsh_pos} gmsh metric mesh
162@fiindex @file{.hb} Harwell-Boeing matrix
163@fiindex @file{.geo} mesh
164@fiindex @file{.field} field
165@fiindex @file{.m} matlab matrix
166@fiindex @file{.ps} postscript
167@fiindex @file{.vtk} visualization toolkit
168@fiindex @file{.plot} gnuplot script
169@fiindex @file{.mtv} plotmtv
170@fiindex @file{.x3d} x3d mesh
171@fiindex @file{.atom} PlotM mesh
172@toindex @code{vtk}
173@toindex @code{gnuplot}
174@toindex @code{plotmtv}
175@toindex @code{x3d}
176@toindex @code{PlotM}
177@toindex @code{bamg}
178@toindex @code{mmg3d}
179@toindex @code{tetgen}
180
181 The @dfn{format} manipulator group applies for streams.
182 Its value is an enumerated type, containing the
183 following possibilities:
184 @table @code
185 @item rheo
186 use the default textual input/output file format.
187 For instance, this is
188 @file{.geo} for meshes,
189 @file{.field} for discretized functions.
190 This default format is specified in the corresponding
191 class documentation
192 (see also @ref{geo class} and @ref{field class}).
193 This is the default.
194 @item bamg
195 uses @file{.bamg} Frederic Hecht's bidimensional anisotropic
196 mesh generator file format for geo input/output operation.
197 @item tetgen
198 uses @file{.node} @file{.ele} and @code{.face} Hang Si's tridimensional
199 mesh generator file format for geo input/output operation.
200 @item mmg3d
201 uses @file{.mmg3d} Cecile Dobrzynski's tridimensional anisotropic
202 mesh generator file format for geo input/output operation.
203 @item gmsh
204 uses @file{.gmsh}
205 gmsh Christophe Geuzaine and Jean-Francois Remacle
206 mesh generator file format for geo input/output operation.
207 @item gmsh_pos
208 uses @file{.gmsh_pos}
209 gmsh Christophe Geuzaine and Jean-Francois Remacle
210 mesh metric file format for geo adapt input/output operation.
211 @item grummp
212 uses @file{.m} (bidimensional) or @file{.v} (tridimensionnal)
213 Carl Ollivier-Gooch 's mesh generator file format for geo input/output
214 operation.
215 @item qmg
216 uses @file{.qmg}
217 Stephen A. Vavasis's mesh generator file format for geo input/output
218 operation.
219 @item vtkdata
220 uses @file{.vtk}
221 mesh file format for geo input/output operations.
222 This file format is suitable for graphic treatment.
223 @item vtkpolydata
224 uses @file{.vtk} polydata (specific for polygonal boundaries)
225 mesh file format for geo input/output operations.
226 This file format is suitable for graphic treatment.
227
228@fiindex @file{.cemagref} cemagref topographic mesh
229@cindex @code{cemagref} topographic mesh
230@cindex topography
231 @item cemagref
232 uses @file{.cemagref} surface mesh (topography, with a @code{z} cote).
233 This file format is used at Cemagref (french research center for mountains,
234 @url{http://www.cemagref.fr}).
235 @item dump
236 output an extensive listing of the class data structure.
237 This option is used for debugging purpose.
238 @item hb
239 uses @file{.hb} Harwell-Boeing file format for sparse matrix input/output
240 operation.
241 This is the default.
242 @item matrix_market
243 uses @file{.mm} Matrix-Market file format for sparse matrix input/output
244 operation.
245 @item ml
246 @itemx matlab
247 uses @file{.m} Matlab file format for sparse matrix output
248 operation.
249 @item sparse_matlab
250 uses @file{.m} Matlab sparse file format for sparse matrix output
251 operation.
252 @item ps
253 uses @file{.ps} postscript for sparse matrix output
254 operation.
255 @item vtk
256 for mesh and field outputs.
257 Generate @file{.vtk} data file and the
258 @file{.tcl} command script file
259 and run the @code{vtk} command
260 on the @file{.tcl}.
261@fiindex @file{.py} python script file (for paraview visualization tool)
262@toindex @code{paraview}
263 @item paraview
264 for field outputs.
265 Generate @file{.vtk} data file and the
266 @file{.py} command script file
267 and run the @code{python} command on the @file{.py}
268 associated to the @code{paraview}/@code{vtk} library.
269 @item geomview
270 for boundary cad outputs.
271 Generate @file{.off} data file
272 and run the @code{geomview} command.
273 @item gnuplot
274 for mesh and field outputs.
275 Generate @file{.gdat} data file and the
276 @file{.plot} command script file
277 and run the @code{gnuplot} command
278 on the @file{.plot}.
279 @item plotmtv
280 for mesh and field outputs.
281 Generate @file{.mtv} data file
282 and run the @code{plotmtv} command.
283 @item x3d
284 for mesh output.
285 Generate @file{.x3d} data file
286 and run the @code{x3d} command.
287 This tool has fast rotation rendering.
288 @item atom
289 for mesh output.
290 Generate @file{.atom} data file
291 and run the @code{PlotM} command.
292 Tridimensional mesh rendering is performed
293 as a chemical molecule: nodes as balls and
294 edges as tubes.
295 The @code{PlotM} tool is developed
296 at Cornell University Laboratory of Atomic and Solid
297 State Physics (LASSP) in a Joint Study with IBM, with support by
298 the Materials Science Center and Corning Glassworks.
299 @end table
300COLOR MANIPULATORS:
301 The @dfn{color} manipulator group acts for
302 sparse matrix postscript output. Its value is an
303 enumerated type, containing three possibilities:
304 @example
305 cout << color << a;
306 cout << gray << b;
307 cout << black_and_white << c;
308 @end example
309 The default is to generate a color postcript file.
310 Conversely, its act for field rendering, via @code{paraview}.
311
312VALUATED MANIPULATORS:
313@pindex mfield
314 Some manipulators takes an argument that specifies a value.
315 @example
316 cout << geomview << bezieradapt << subdivide(5) << my_cad_boundary;
317 cout << vtk << iso << isovalue(2.5) << my_mesh;
318 cout << velocity << plotmtv << vectorscale(0.1) << uh;
319 @end example
320@clindex catchmark
321 See also @ref{catchmark algorithm} for input-output of vector-valued fields.
322 @table @code
323 @item isovalue @var{float}
324 @itemx n_isovalue @var{int}
325 @itemx n_isovalue_negative @var{int}
326 Used by 2D and 3D graphic renders.
327 @item vectorscale @var{float}
328 Used for vector field visualizattion.
329@toindex @code{paraview}
330 @item subdivide @var{float}
331 Used for high-order curved mesh visualizatiion
332 and also for high-order picewise polynomial fields.
333 From paraview-5.5, this features is obsolete.
334 @item label @var{string}
335 For colorbar anotation.
336 @item rounding_precision @var{float}
337 This manipulator set a rounding precision that could be used
338 by some output functions, e.g. by the @code{geo} class.
339 By default, the rounding value is zero and there is no rounding.
340@cindex image file format
341@cindex graphic render
342@fiindex @file{.png} image
343@fiindex @file{.jpg} image
344@fiindex @file{.pdf} image
345 @item image_format @var{string}
346 The argument is any valid image format, such as @code{png}, @code{jpg} or @code{pdf},
347 that could be handled by the corresponding graphic render.
348 @item branch_counter @var{int}
349 Counter for even outputed to a stream.
350 Used internally by the branch class during i/o.
351 @end table
352End:*/
353
354class iorheo {
355public:
356 // ------------------------------------------------------
357 // 1) booleans = set of bits
358 // ------------------------------------------------------
359 enum fmt_mode { // specific to one stream
360
361 // static field are positionned simultaneoulsy for all streams
362 // as global variables:
363
364 verbose, // print comments
365 execute, // execute graphic commands
366 clean, // clear temporary graphic files
367
368 // locals:
369
370 transpose, // avoid hb-matrix(csc) to/in csr conversion:
371 // thus, handle the transposed matrix
372 upgrade, // rheolef upgrade file format version
373
374 // color plot options
375
379
380 // file formats:
381
382 rheo, // rheolef file format
383 hb = rheo, // Harwell-Boeing mat-vec file fmt
384 matrix_market, // matrix market Cerfacs file format
385 ml, // Matlab mat-vec file fmt
386 matlab = ml, // alias
387 sparse_matlab, // Matlab sparse matrix format
388 dump, // Dump format (debug)
389
390 bamg, // bamg F. hecht mesh & metric format
391 peschetola, // Custom meshes by Valentina Peschetola
392 grummp, // grummp mesh file format
393 gmsh, // gmsh mesh file format
394 gmsh_pos, // gmsh metric mesh file format
395 mmg3d, // mmg3d mesh format
396 tetgen, // tetgen mesh format
397 qmg, // qmg mesh file format
398 cemagref, // topography mesh file format at Cemagref
399 vtkdata, // vtk mesh file format
400 vtkpolydata, // vtk boundary mesh file format
401
402 // renderer:
403
404 ps, // Postscript plot
408 vtk, // Visualization ToolKit
409 paraview, // paraview based on vtk
410 geomview, // geomview
411 atom, // PlotM, from Cornell
412
413 // render option are not exclusive:
414 logscale, // log scale (for hb+ps)
415 grid, // grid rendering (mesh)
416 domains, // domains rendering
417 fill, // fill faces with light effects
418 tube, // edges as tube
419 ball, // vertices as balls
420 shrink, // shrink 3d geo elements
421 full, // all edges in 3d
422 stereo, // stereo rendering
423 cut, // cut and clip 3d mesh/field with a plane
424 iso, // isosurface for a specified value
425 split, // P2-iso-P1 element split
426 velocity, // vectors rendered as arrows
427 deformation, // vectors rendered as deformed meshes
428 elevation, // 2d scalar field as 3d surface elevation
429 volume, // 3d scalar field visualization by using ray cast functions (paraview)
430 fastfieldload, // try to reuse supplied mesh space when loading field
431 bezieradapt, // subdivide each Bezier subpatch instead of global patch, for cad/geomview format
432 lattice, // subdivide each element by two, as in P2-iso-P1, for geo/vtkdata format
433 showlabel, // write labels on plotmtv contour lines
434 autovscale, // adapt vscale to actual length of vectors and meshsize
435 skipvtk, // with paraview, only create the .py file, do not regenerate all .vtk
436 reader_on_stdin, // when read on stdin, add -persist to gnuplot
437
438 last
439 };
440 typedef std::bitset<last> flag_type;
441 typedef size_t size_type;
442
447
448 private:
449 // default and current flags as a long (32 bits available)
450 static flag_type default_f;
451
452 public:
453 // ------------------------------------------------------
454# define boolean(stream,name) iorheobase_def_boolean_accessor_macro(iorheo,std::stream,name)
455# define member(stream,name,groupe) iorheobase_def_member_macro(iorheo,std::stream,name,groupe)
456# define i_scalar(t, a) iorheobase_def_scalar_macro(iorheo,t, a)
457# define o_scalar(t, a) iorheobase_def_scalar_macro(iorheo,t, a)
458# define io_scalar(t, a) iorheobase_def_scalar_macro(iorheo,t, a)
459# include "rheolef/iorheo-members.h"
460# undef boolean
461# undef member
462# undef i_scalar
463# undef o_scalar
464# undef io_scalar
465 // ------------------------------------------------------
466 // 3) some implementation details
467 // ------------------------------------------------------
468public:
469 // basics members
470 iorheo();
471 ~iorheo();
472
473 static flag_type flags (std::ios& s);
474 static flag_type flags (std::ios& s, flag_type f);
475 static flag_type setf (std::ios& s, size_type i_add);
476 static flag_type setf (std::ios& s, size_type i_add, flag_type field);
477 static flag_type unsetf (std::ios& s, size_type i_del);
478
479private:
480 // flags: shared and stream-local one
481 static flag_type globals_ /* = default_f & static_field */;
482 flag_type flags_;
483
484 // protected manipulations (see also class ios)
485 flag_type flags () const;
487
488 flag_type setf (size_type i_add);
490 flag_type unsetf (size_type i_del);
491
492 // ------------------------------------------------------
493 // 4) memory handler
494 // ------------------------------------------------------
495protected:
496 // local memory handler
497 static iorheo* get_pointer (std::ios& s);
498public:
502};
503// -------------------------------------------------------------------------
504// define iostream manipulators outside of the class for all scalars
505// -------------------------------------------------------------------------
506# define boolean(stream,name) iorheobase_manip_boolean_accessor_macro(iorheo,std::stream,name)
507# define member(stream,name,groupe) iorheobase_manip_member_macro(iorheo,std::stream,name,groupe)
508# define i_scalar(t, a) iorheobase_manip_scalar_macro(iorheo,t, a, i)
509# define o_scalar(t, a) iorheobase_manip_scalar_macro(iorheo,t, a, o)
510# define io_scalar(t, a) iorheobase_manip_scalar_macro(iorheo,t, a, io)
511# include "rheolef/iorheo-members.h"
512# undef boolean
513# undef member
514# undef i_scalar
515# undef o_scalar
516# undef io_scalar
517}// namespace rheolef
518# endif /* _IORHEO_H */
see the field page for the full documentation
static flag_type color_field
Definition iorheo.h:444
size_t size_type
Definition iorheo.h:441
static iorheo * get_pointer(std::ios &s)
Definition iorheo.cc:198
static flag_type render_field
Definition iorheo.h:446
std::bitset< last > flag_type
Definition iorheo.h:440
static flag_type flags(std::ios &s)
Definition iorheo.cc:244
static flag_type format_field
Definition iorheo.h:445
static flag_type unsetf(std::ios &s, size_type i_del)
Definition iorheo.cc:264
static flag_type static_field
Definition iorheo.h:443
static flag_type setf(std::ios &s, size_type i_add)
Definition iorheo.cc:254
This file is part of Rheolef.
Definition cavity_dg.h:29