~ubuntu-branches/ubuntu/karmic/gmsh/karmic

« back to all changes in this revision

Viewing changes to doc/texinfo/gmsh.texi

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme, Daniel Leidert
  • Date: 2008-05-18 12:46:05 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080518124605-716xqbqeo07o497k
Tags: 2.2.0-2
[Christophe Prud'homme]
* Bug fix: "gmsh ships no .desktop", thanks to Vassilis Pandis (Closes:
  #375770). Applied the Ubuntu patch.

[Daniel Leidert]
* debian/control (Vcs-Svn): Fixed.
  (Build-Depends): Use texlive instead of tetex-bin.
* debian/gmsh.doc-base (Section): Fixed accordingly to doc-base (>= 0.8.10).
* debian/rules: Removed some variable declarations, that lead to double
  configuration and seem to be useless.
  (build/gmsh): Try to avoid multiple runs by using a stamp.
  (orig-tarball): Renamed to get-orig-source and changed to use uscan.
* debian/watch: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
\input texinfo.tex @c -*-texinfo-*-
2
 
@c $Id: gmsh.texi,v 1.232 2007-05-20 13:23:48 geuzaine Exp $
 
2
@c $Id: gmsh.texi,v 1.247 2008-04-17 21:05:52 geuzaine Exp $
3
3
@c
4
 
@c Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 
4
@c Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
5
5
@c
6
6
@c This program is free software; you can redistribute it and/or modify
7
7
@c it under the terms of the GNU General Public License as published by
37
37
@c =========================================================================
38
38
@c %**start of header
39
39
@setfilename        gmsh.info
40
 
@set GMSH-VERSION   2.0
41
 
@set COPYRIGHT      @copyright{} 1997-2007 Christophe Geuzaine, Jean-Fran@,{c}ois Remacle
 
40
@set GMSH-VERSION   2.2
 
41
@set COPYRIGHT      @copyright{} 1997-2008 Christophe Geuzaine, Jean-Fran@,{c}ois Remacle
42
42
@c
43
43
@settitle Gmsh @value{GMSH-VERSION}
44
44
@footnotestyle separate
230
230
 
231
231
File formats
232
232
 
233
 
* Gmsh mesh file formats::      
234
 
* Gmsh post-processing file formats::  
235
 
* Gmsh node ordering::          
236
 
 
237
 
Gmsh mesh file formats
238
 
 
239
 
* Version 1.0::                 
240
 
* Version 2.0 ASCII::           
241
 
* Version 2.0 Binary::          
242
 
 
243
 
Gmsh post-processing file formats
244
 
 
245
 
* Parsed post-processing file format::  
246
 
* ASCII post-processing file format::  
247
 
* Binary post-processing file format::  
 
233
* MSH ASCII file format::       
 
234
* MSH binary file format::      
 
235
* Node ordering::               
 
236
* Legacy formats::              
 
237
 
 
238
Legacy formats
 
239
 
 
240
* MSH file format version 1.0::  
 
241
* POS ASCII file format::       
 
242
* POS binary file format::      
248
243
 
249
244
Programming notes
250
245
 
 
246
* Main code structure::         
251
247
* Coding style::                
252
248
* Option handling::             
253
249
 
369
365
inside an @var{n}-th dimensional entity does @emph{not} constrain the
370
366
@var{n}-th dimensional mesh.  Every meshing step is constrained by the
371
367
characteristic length field, which can be uniform, specified by
372
 
characteristic lengths associated with elementary geometrical entities,
373
 
associated with another mesh (the ``background mesh''), or defined by
374
 
point or line ``attractors''.
 
368
characteristic lengths associated with points in the geometry, or
 
369
defined by general ``fields'' (a scalar field defined on another mesh
 
370
using post-processing view, threshold fields associated with point or
 
371
line ``attractors'', etc.).
375
372
 
376
373
For each meshing step, all structured mesh directives are executed
377
374
first, and serve as additional constraints for the unstructured parts
449
446
@item
450
447
specify target element sizes accurately. Gmsh provides several
451
448
mechanisms to control the size of the elements in the final mesh:
452
 
through interpolation from sizes specified at geometry points or on a
453
 
background mesh, or using attractors (@pxref{Mesh commands});
 
449
through interpolation from sizes specified at geometry points or using
 
450
flexible mesh size fields (@pxref{Mesh commands});
454
451
@item
455
452
create simple extruded geometries and meshes (see @ref{Geometry commands},
456
453
and @ref{Mesh commands});
513
510
Gmsh is not a multi-bloc generator: all meshes produced by Gmsh are
514
511
conforming in the sense of finite element meshes;
515
512
@item
516
 
the 3D unstructured algorithm is still experimental and not very robust.
517
 
If this algorithm fail, try to change some characteristic lengths to
518
 
generate meshes that better suit the geometrical details of the
519
 
structures;
520
 
@item
521
513
Gmsh was designed to solve academic ``test cases'', not industrial-size
522
514
problems. You may find that Gmsh is too slow for large problems (with
523
515
thousands of geometric primitives, or millions of mesh/post-processing
1480
1472
@cindex Lines, physical
1481
1473
 
1482
1474
@ftable @code
1483
 
@item Bezier ( @var{expression} ) = @{ @var{expression-list} @};
1484
 
Creates a Bezier curve. The @var{expression} inside the parentheses is the
1485
 
Bezier curve's identification number; the @var{expression-list} on the right
1486
 
hand side should contain the identification numbers of all the curve's
1487
 
control points.
 
1475
@c @item Bezier ( @var{expression} ) = @{ @var{expression-list} @};
 
1476
@c Creates a Bezier curve. The @var{expression} inside the parentheses is the
 
1477
@c Bezier curve's identification number; the @var{expression-list} on the right
 
1478
@c hand side should contain the identification numbers of all the curve's
 
1479
@c control points.
1488
1480
 
1489
1481
@item BSpline ( @var{expression} ) = @{ @var{expression-list} @};
1490
1482
Creates a B-spline curve. The @var{expression} inside the parentheses is the
1751
1743
@var{transform-list}. The @var{expression-list} should contain three
1752
1744
@w{@var{expression}s} giving the X, Y and Z components of the translation
1753
1745
vector.
 
1746
 
 
1747
@item Boundary @{ @var{transform-list} @}
 
1748
(Not a transformation per-se.) Returns the boundary of the elementary
 
1749
entities in @var{transform-list}.
 
1750
 
 
1751
@c @item Intersect Line @{ @var{expression-list} @} Surface @{ @var{expression} @}
 
1752
@c (Not a transformation per-se.) Returns the intersections of the lines
 
1753
@c given in @var{expression-list} with the specified surface.
1754
1754
@end ftable
1755
1755
 
1756
1756
@noindent with
1868
1868
region number (and 0 as their physical region number@footnote{This
1869
1869
behaviour was introduced in Gmsh 2.0. In older versions, both the
1870
1870
elementary and the physical region numbers would be set to the
1871
 
identification number of the elementary region.}; @ref{Gmsh mesh file
 
1871
identification number of the elementary region.}; @ref{File
1872
1872
formats}). This can sometimes be inconvenient:
1873
1873
 
1874
1874
@itemize @bullet
1893
1893
manipulation of the model (e.g., using `Tools->Visibility' in the GUI)
1894
1894
and the interfacing with external solvers.  
1895
1895
 
1896
 
In the @file{.msh} file format (@pxref{Gmsh mesh file formats}), if
1897
 
physical entities are defined, the output mesh only contains those
1898
 
elements that belong to physical entities. Other file formats each treat
1899
 
physical entities in slightly different ways, depending on their
1900
 
capability to define groups.
 
1896
In the MSH file format (@pxref{File formats}), if physical entities are
 
1897
defined, the output mesh only contains those elements that belong to
 
1898
physical entities. Other file formats each treat physical entities in
 
1899
slightly different ways, depending on their capability to define groups.
1901
1900
 
1902
1901
@c -------------------------------------------------------------------------
1903
1902
@c Mesh commands
1935
1934
@cindex Mesh, background
1936
1935
@cindex Background mesh
1937
1936
 
1938
 
The `size' of a mesh element is defined as the length of the segment for a
1939
 
line segment, the radius of the circumscribed circle for a triangle and the
1940
 
radius of the circumscribed sphere for a tetrahedron. There are three main
1941
 
ways to specify the size of the mesh elements for a given geometry:
 
1937
There are two ways to specify the size of the mesh elements for a given
 
1938
geometry:
1942
1939
 
1943
1940
@enumerate
1944
1941
@item
1955
1952
algorithms for which the element sizes are explicitly specified (e.g.,
1956
1953
transfinite and extruded grids: see @ref{Structured grids}).
1957
1954
@item
1958
 
You can give Gmsh an explicit background mesh in the form of a scalar
1959
 
post-processing view (see @ref{Post-processing commands}, and @ref{File
1960
 
formats}) in which the nodal values are the target element sizes.  This
1961
 
method is very general but it requires a first (usually rough) mesh and
1962
 
a way to compute the target sizes on this mesh (usually through an error
1963
 
estimation procedure, in an iterative process of mesh adaptation). Note
1964
 
that the target element sizes can be constrained by the characteristic
1965
 
lengths defined in the geometrical model if the
1966
 
@code{Mesh.ConstrainedBackgroundMesh} option is set. To load a
1967
 
background mesh, you can use the @code{-bgm} command-line option
1968
 
(@pxref{Command-line options}), select `Apply as background mesh' in the
1969
 
post-processing view option menu, or use the @code{Background Mesh}
1970
 
command in a script (@pxref{Post-processing commands}).
1971
 
 
1972
 
Background meshes are supported by all algorithms except the algorithms
1973
 
based on Netgen.
1974
 
@item
1975
 
You can define point or line attractors. [More to come here later.]
 
1955
You can specify characteristic lengths using mesh size
 
1956
``fields''. Various fields exist: 
 
1957
@itemize @bullet
 
1958
@item 
 
1959
A @code{PostView} field specifies an explicit background mesh in the
 
1960
form of a scalar post-processing view (see @ref{Post-processing
 
1961
commands}, and @ref{File formats}) in which the nodal values are the
 
1962
target element sizes.  This method is very general but it requires a
 
1963
first (usually rough) mesh and a way to compute the target sizes on this
 
1964
mesh (usually through an error estimation procedure, in an iterative
 
1965
process of mesh adaptation).
 
1966
 
 
1967
(Note that you can also load a background mesh directly from the command
 
1968
line using the @code{-bgm} option (@pxref{Command-line options}), or in
 
1969
the GUI by selecting `Apply as background mesh' in the post-processing
 
1970
view option menu.)
 
1971
@item 
 
1972
A @code{Box} field specifies the size of the elements inside and outside
 
1973
of a parallelipipedic region.
 
1974
@item 
 
1975
A @code{Threshold} field specifies the size of the mesh according to the
 
1976
distance to some geometrical entities. These entities can for example be
 
1977
geometry points and lines specified by an @code{Attractor} field.
 
1978
@item 
 
1979
A @code{MathEval} field specifies the size of the mesh using an explicit
 
1980
mathematical function.
 
1981
@item 
 
1982
A @code{Min} field specifies the size as the minimum of the sizes
 
1983
computed using other fields
 
1984
@item 
 
1985
@dots{}
 
1986
@end itemize
 
1987
All target element sizes specified by fields can also be constrained by
 
1988
the characteristic lengths defined in the geometrical model if the
 
1989
@code{Mesh.ConstrainedBackgroundMesh} option is set. 
 
1990
 
 
1991
Fields are supported by all the algorithms except those based on Netgen.
1976
1992
@end enumerate
1977
1993
 
1978
1994
Here are the mesh commands that are related to the specification of
1983
1999
Modifies the characteristic length of the points whose identification
1984
2000
numbers are listed in @var{expression-list}. The new value is given by
1985
2001
@var{expression}.
1986
 
@item Attractor Point @{ @var{expression-list} @} = @{ @var{expression-list} @};
1987
 
[More to come here later.]
1988
 
@item Attractor Line @{ @var{expression-list} @} = @{ @var{expression-list} @};
1989
 
[More to come here later.]
 
2002
@item Field[@var{expression}] = @var{string};
 
2003
@item Field[@var{expression}].@var{string} = @var{char-expression} | @var{expression} | @var{expression-list};
 
2004
@item Background Field = @var{expression};
1990
2005
@end ftable
1991
2006
 
1992
2007
@c .........................................................................
2108
2123
Recombines the triangular meshes of the surfaces listed in
2109
2124
@var{expression-list} into mixed triangular/quadrangular meshes. The
2110
2125
optional @var{expression} on the right hand side specifies the maximum
2111
 
recombination angle allowed (a large @var{expression} leading to more
2112
 
triangle recombinations).
 
2126
difference (in degrees) allowed between the largest angle of a
 
2127
quadrangle and a right angle (a value of 0 would only accept quadrangles
 
2128
with right angles; a value of 90 would allow degenerate quadrangles;
 
2129
default value is 45).
2113
2130
 
2114
2131
@item Save @var{char-expression};
2115
2132
Saves the mesh in a file named @var{char-expression}, using the current
2125
2142
Shows the mesh of the entity @var{char-expression}, if
2126
2143
@code{General.VisibilityMode} is set to @code{0} or @code{2}
2127
2144
(@var{char-expression} can for example be @code{"*"}).
 
2145
 
 
2146
@item Smoother Surface @{ @var{expression-list} @} = @var{expression};
 
2147
Sets number of elliptic smoothing steps for the surfaces listed in
 
2148
@var{expression-list} (smothing only applies to transfinite meshes at
 
2149
the moment).
2128
2150
@end ftable
2129
2151
 
2130
2152
@c -------------------------------------------------------------------------
2281
2303
labels, etc.). Note that 2D plots can be positioned explicitly inside the
2282
2304
graphical window, or be automatically positioned in order to avoid overlaps.
2283
2305
 
2284
 
Sample post-processing files in human-readable ``parsed'' format
2285
 
(@pxref{Parsed post-processing file format}) are available in the
2286
 
@file{tutorial} directory of Gmsh's distribution (@file{.pos} files).
 
2306
Sample post-processing files in human-readable ``parsed'' format are
 
2307
available in the @file{tutorial} directory of Gmsh's distribution
 
2308
(@file{.pos} files).
2287
2309
 
2288
2310
@menu
2289
2311
* Post-processing commands::    
2374
2396
@var{char-expression}. If the path in @var{char-expression} is not absolute,
2375
2397
@var{char-expression} is appended to the path of the current file.
2376
2398
 
2377
 
@item View "@var{string}" @{ @var{string} ( @var{expression-list} ) @{ @var{expression-list} @}; @dots{} @};
2378
 
Creates a new post-processing view, named @code{"@var{string}"}. This is the
2379
 
easiest way to create a post-processing view, but also the least efficient
2380
 
(the view is read through Gmsh's script parser, which can become a bit slow
2381
 
if the view is very large---e.g., with one million elements). Nevertheless,
2382
 
this ``parsed'' post-processing format (explained in detail in @ref{Parsed
2383
 
post-processing file format}) is very powerful, since all the values are
2384
 
@var{expressions}. Two other formats, better suited for very large data
2385
 
sets, are described in @ref{ASCII post-processing file format}, and
2386
 
@ref{Binary post-processing file format}.
 
2399
@item View "@var{string}" @{ @var{string} < ( @var{expression-list} ) > @{ @var{expression-list} @}; @dots{} @};
 
2400
Creates a new post-processing view, named @code{"@var{string}"}.  This
 
2401
is an easy and quite powerful way to import post-processing data: all
 
2402
the values are @var{expressions}, you can embed datasets directly into
 
2403
your geometrical descriptions (see, e.g., @ref{t4.geo}), the data can be
 
2404
easily generated ``on-the-fly'' (there is no header containing @emph{a
 
2405
priori} information on the size of the dataset). The syntax is also very
 
2406
permissive, which makes it ideal for testing purposes.
 
2407
 
 
2408
However this ``parsed format'' is read by Gmsh's script parser, which
 
2409
makes it inefficient if there are many elements in the dataset. Also,
 
2410
there is no connectivity information in parsed views and all the
 
2411
elements are independent (all fields can be discontinuous), so a lot of
 
2412
information can be duplicated. For large datasets, you should thus use
 
2413
the mesh-based post-processing file format described in @ref{File
 
2414
formats}, or use one of the standard formats like MED.
 
2415
 
 
2416
More explicitly, the syntax for a parsed @code{View} is the following
 
2417
 
 
2418
@example
 
2419
@group
 
2420
View "@var{string}" @{
 
2421
  < TIME @{ @var{expression-list} @}; >
 
2422
  @var{type} ( @var{list-of-coords} ) @{ @var{list-of-values} @};
 
2423
  @dots{}
 
2424
@};
 
2425
@end group
 
2426
@end example
 
2427
 
 
2428
where the 47 object @w{@var{type}s} that can be displayed are:
 
2429
 
 
2430
@smallexample
 
2431
                              @var{type}  #@var{list-of-coords}  #@var{list-of-values}
 
2432
--------------------------------------------------------------------
 
2433
Scalar point                  SP    3            1  * @var{nb-time-steps}
 
2434
Vector point                  VP    3            3  * @var{nb-time-steps}
 
2435
Tensor point                  TP    3            9  * @var{nb-time-steps}
 
2436
Scalar line                   SL    6            2  * @var{nb-time-steps}
 
2437
Vector line                   VL    6            6  * @var{nb-time-steps}
 
2438
Tensor line                   TL    6            18 * @var{nb-time-steps}
 
2439
Scalar triangle               ST    9            3  * @var{nb-time-steps}
 
2440
Vector triangle               VT    9            9  * @var{nb-time-steps}
 
2441
Tensor triangle               TT    9            27 * @var{nb-time-steps}
 
2442
Scalar quadrangle             SQ    12           4  * @var{nb-time-steps}
 
2443
Vector quadrangle             VQ    12           12 * @var{nb-time-steps}
 
2444
Tensor quadrangle             TQ    12           36 * @var{nb-time-steps}
 
2445
Scalar tetrahedron            SS    12           4  * @var{nb-time-steps}
 
2446
Vector tetrahedron            VS    12           12 * @var{nb-time-steps}
 
2447
Tensor tetrahedron            TS    12           36 * @var{nb-time-steps}
 
2448
Scalar hexahedron             SH    24           8  * @var{nb-time-steps}
 
2449
Vector hexahedron             VH    24           24 * @var{nb-time-steps}
 
2450
Tensor hexahedron             TH    24           72 * @var{nb-time-steps}
 
2451
Scalar prism                  SI    18           6  * @var{nb-time-steps}
 
2452
Vector prism                  VI    18           18 * @var{nb-time-steps}
 
2453
Tensor prism                  TI    18           54 * @var{nb-time-steps}
 
2454
Scalar pyramid                SY    15           5  * @var{nb-time-steps}
 
2455
Vector pyramid                VY    15           15 * @var{nb-time-steps}
 
2456
Tensor pyramid                TY    15           45 * @var{nb-time-steps}
 
2457
2nd order scalar line         SL2   9            3  * @var{nb-time-steps}
 
2458
2nd order vector line         VL2   9            9  * @var{nb-time-steps}
 
2459
2nd order tensor line         TL2   9            27 * @var{nb-time-steps}
 
2460
2nd order scalar triangle     ST2   18           6  * @var{nb-time-steps}
 
2461
2nd order vector triangle     VT2   18           18 * @var{nb-time-steps}
 
2462
2nd order tensor triangle     TT2   18           54 * @var{nb-time-steps}
 
2463
2nd order scalar quadrangle   SQ2   27           9  * @var{nb-time-steps}
 
2464
2nd order vector quadrangle   VQ2   27           27 * @var{nb-time-steps}
 
2465
2nd order tensor quadrangle   TQ2   27           81 * @var{nb-time-steps}
 
2466
2nd order scalar tetrahedron  SS2   30           10 * @var{nb-time-steps}
 
2467
2nd order vector tetrahedron  VS2   30           30 * @var{nb-time-steps}
 
2468
2nd order tensor tetrahedron  TS2   30           90 * @var{nb-time-steps}
 
2469
2nd order scalar hexahedron   SH2   81           27 * @var{nb-time-steps}
 
2470
2nd order vector hexahedron   VH2   81           81 * @var{nb-time-steps}
 
2471
2nd order tensor hexahedron   TH2   81           243* @var{nb-time-steps}
 
2472
2nd order scalar prism        SI2   54           18 * @var{nb-time-steps}
 
2473
2nd order vector prism        VI2   54           54 * @var{nb-time-steps}
 
2474
2nd order tensor prism        TI2   54           162* @var{nb-time-steps}
 
2475
2nd order scalar pyramid      SY2   42           14 * @var{nb-time-steps}
 
2476
2nd order vector pyramid      VY2   42           42 * @var{nb-time-steps}
 
2477
2nd order tensor pyramid      TY2   42           126* @var{nb-time-steps}
 
2478
2D text                       T2    3            arbitrary
 
2479
3D text                       T3    4            arbitrary
 
2480
@end smallexample
 
2481
 
 
2482
The coordinates are given `by node', i.e.,
 
2483
 
 
2484
@itemize @bullet
 
2485
@item
 
2486
@code{(@var{coord1}, @var{coord2}, @var{coord3})} for a point,
 
2487
@item 
 
2488
@code{(@var{coord1-node1}, @var{coord2-node1}, @var{coord3-node1},}@* 
 
2489
@code{ @var{coord1-node2}, @var{coord2-node2}, @var{coord3-node2})} for a line,
 
2490
@item 
 
2491
@code{(@var{coord1-node1}, @var{coord2-node1}, @var{coord3-node1},}@*
 
2492
@code{ @var{coord1-node2}, @var{coord2-node2}, @var{coord3-node2},}@*
 
2493
@code{ @var{coord1-node3}, @var{coord2-node3}, @var{coord3-node3})} for a triangle,
 
2494
@item
 
2495
etc.
 
2496
@end itemize
 
2497
 
 
2498
The ordering of the nodes is given in @ref{Node ordering}. For second
 
2499
order elements, the first order nodes are given first, followed by the nodes
 
2500
associated with the edges, followed by the nodes associated with the
 
2501
quadrangular faces (if any), followed by the nodes associated with the
 
2502
volume (if any). The ordering of these additional nodes follows the ordering
 
2503
of the edges and quadrangular faces given in @ref{Node ordering}.
 
2504
 
 
2505
The values are given by time step, by node and by component, i.e.:
 
2506
@example
 
2507
@var{comp1-node1-time1}, @var{comp2-node1-time1}, @var{comp3-node1-time1},
 
2508
@var{comp1-node2-time1}, @var{comp2-node2-time1}, @var{comp3-node2-time1},
 
2509
@var{comp1-node3-time1}, @var{comp2-node3-time1}, @var{comp3-node3-time1},
 
2510
@var{comp1-node1-time2}, @var{comp2-node1-time2}, @var{comp3-node1-time2},
 
2511
@var{comp1-node2-time2}, @var{comp2-node2-time2}, @var{comp3-node2-time2},
 
2512
@var{comp1-node3-time2}, @var{comp2-node3-time2}, @var{comp3-node3-time2},
 
2513
@dots{}
 
2514
@end example
 
2515
 
 
2516
For the 2D text objects, the two first @w{@var{expression}s} in
 
2517
@var{list-of-coords} give the X-Y position of the string in screen
 
2518
coordinates, measured from the top-left corner of the window. If the first
 
2519
(respectively second) @var{expression} is negative, the position is measured
 
2520
from the right (respectively bottom) edge of the window. If the value of the
 
2521
first (respectively second) @var{expression} is larger than 99999, the
 
2522
string is centered horizontally (respectively vertically). If the third
 
2523
@var{expression} is equal to zero, the text is aligned bottom-left and
 
2524
displayed using the default font and size. Otherwise, the third
 
2525
@var{expression} is converted into an integer whose eight lower bits give
 
2526
the font size, whose eight next bits select the font (the index corresponds
 
2527
to the position in the font menu in the GUI), and whose eight next bits
 
2528
define the text alignment (0=bottom-left, 1=bottom-center, 2=bottom-right,
 
2529
3=top-left, 4=top-center, 5=top-right, 6=center-left, 7=center-center,
 
2530
8=center-right).
 
2531
 
 
2532
For the 3D text objects, the three first @w{@var{expression}s} in
 
2533
@var{list-of-coords} give the XYZ position of the string in model (real
 
2534
world) coordinates.  The fourth @var{expression} has the same meaning as the
 
2535
third @var{expression} in 2D text objects.
 
2536
 
 
2537
For both 2D and 3D text objects, the @var{list-of-values} can contain an
 
2538
arbitrary number of @w{@var{char-expression}s}.
 
2539
 
 
2540
The optional @code{TIME} list can contain a list of expressions giving the
 
2541
value of the time (or any other variable) for which an evolution was saved.
2387
2542
@end ftable
2388
2543
 
2389
2544
@c -------------------------------------------------------------------------
2800
2955
 
2801
2956
@cindex File formats
2802
2957
 
2803
 
This chapter describes Gmsh's native mesh and post-processing file
2804
 
formats. (These formats have version numbers that are independent of Gmsh's
2805
 
main version number.)
2806
 
 
2807
 
All non-parsed file formats have sections enclosed between @code{$Key} and
2808
 
@code{$EndKey} tags.
 
2958
This chapter describes Gmsh's native ``MSH'' file format, used to store
 
2959
meshes and associated post-processing datasets. The MSH format exists in
 
2960
two flavors: ASCII and binary. The format has a version number
 
2961
(currently: 2.0) that is independent of Gmsh's main version number.
2809
2962
 
2810
2963
@menu
2811
 
* Gmsh mesh file formats::      
2812
 
* Gmsh post-processing file formats::  
2813
 
* Gmsh node ordering::          
 
2964
* MSH ASCII file format::       
 
2965
* MSH binary file format::      
 
2966
* Node ordering::               
 
2967
* Legacy formats::              
2814
2968
@end menu
2815
2969
 
2816
2970
@c -------------------------------------------------------------------------
2817
 
@c Gmsh mesh file formats
 
2971
@c MSH ASCII file format
2818
2972
@c -------------------------------------------------------------------------
2819
2973
 
2820
 
@node Gmsh mesh file formats, Gmsh post-processing file formats, File formats, File formats
2821
 
@section Gmsh mesh file formats
 
2974
@node MSH ASCII file format, MSH binary file format, File formats, File formats
 
2975
@section MSH ASCII file format
2822
2976
 
2823
2977
@cindex Mesh, file format
2824
2978
@cindex File format, mesh
2825
 
@cindex @file{.msh} file
2826
 
 
2827
 
Please note that the list of nodes and elements in Gmsh's mesh files do
2828
 
not have to be dense or ordered (i.e., the node and element numbers do
2829
 
not have to be given in a consecutive or even an ordered way).
2830
 
 
2831
 
@menu
2832
 
* Version 1.0::                 
2833
 
* Version 2.0 ASCII::           
2834
 
* Version 2.0 Binary::          
2835
 
@end menu
2836
 
 
2837
 
@c .........................................................................
2838
 
@c Version 1.0
2839
 
@c .........................................................................
2840
 
 
2841
 
@node Version 1.0, Version 2.0 ASCII, Gmsh mesh file formats, Gmsh mesh file formats
2842
 
@subsection Version 1.0
2843
 
 
2844
 
The @file{.msh} file format, version 1.0, is Gmsh's old native mesh file
2845
 
format, now superseded by the format described in @ref{Version 2.0 ASCII}.
2846
 
 
2847
 
In the @file{.msh} file format, version 1.0, the file is divided in two
2848
 
sections, defining the nodes (@code{$NOD}-@code{$ENDNOD}) and the elements
2849
 
(@code{$ELM}-@code{$ENDELM}) in the mesh:
2850
 
 
2851
 
@example
2852
 
$NOD
2853
 
@var{number-of-nodes}
2854
 
@var{node-number} @var{x-coord} @var{y-coord} @var{z-coord}
2855
 
@dots{}
2856
 
$ENDNOD
2857
 
$ELM
2858
 
@var{number-of-elements}
2859
 
@var{elm-number} @var{elm-type} @var{reg-phys} @var{reg-elem} @var{number-of-nodes} @var{node-number-list}
2860
 
@dots{}
2861
 
$ENDELM
2862
 
@end example
2863
 
 
2864
 
@noindent
2865
 
where
2866
 
@table @code
2867
 
@item @var{number-of-nodes}
2868
 
is the number of nodes in the mesh.
2869
 
 
2870
 
@item @var{node-number}
2871
 
is the number (index) of the @var{n}-th node in the mesh. Note that the
2872
 
@w{@var{node-number}s} do not have to be given in a consecutive (or even an
2873
 
ordered) way.
2874
 
 
2875
 
@item @var{x-coord} @var{y-coord} @var{z-coord}
2876
 
are the floating point values giving the X, Y and Z coordinates of the
2877
 
@var{n}-th node.
2878
 
 
2879
 
@item @var{number-of-elements}
2880
 
is the number of elements in the mesh.
2881
 
 
2882
 
@item @var{elm-number}
2883
 
is the number (index) of the @var{n}-th element in the mesh. Note that the
2884
 
@w{@var{elm-number}s} do not have to be given in a consecutive (or even an
2885
 
ordered) way.
2886
 
 
2887
 
@item @var{elm-type}
2888
 
defines the geometrical type of the @var{n}-th element:
2889
 
@table @code
2890
 
@item 1
2891
 
2-node line.
2892
 
@item 2
2893
 
3-node triangle.
2894
 
@item 3
2895
 
4-node quadrangle.
2896
 
@item 4
2897
 
4-node tetrahedron.
2898
 
@item 5
2899
 
8-node hexahedron.
2900
 
@item 6
2901
 
6-node prism.
2902
 
@item 7
2903
 
5-node pyramid.
2904
 
@item 8
2905
 
3-node second order line (2 nodes associated with the vertices and 1
2906
 
with the edge).
2907
 
@item 9
2908
 
6-node second order triangle (3 nodes associated with the vertices and 3
2909
 
with the edges).
2910
 
@item 10
2911
 
9-node second order quadrangle (4 nodes associated with the vertices, 4
2912
 
with the edges and 1 with the face).
2913
 
@item 11
2914
 
10-node second order tetrahedron (4 nodes associated with the vertices
2915
 
and 6 with the edges).
2916
 
@item 12
2917
 
27-node second order hexahedron (8 nodes associated with the vertices,
2918
 
12 with the edges, 6 with the faces and 1 with the volume).
2919
 
@item 13
2920
 
18-node second order prism (6 nodes associated with the vertices, 9 with
2921
 
the edges and 3 with the quadrangular faces).
2922
 
@item 14
2923
 
14-node second order pyramid (5 nodes associated with the vertices, 8
2924
 
with the edges and 1 with the quadrangular face).
2925
 
@item 15
2926
 
1-node point.
2927
 
@item 16
2928
 
8-node second order quadrangle (4 nodes associated with the vertices and
2929
 
4 with the edges).
2930
 
@item 17
2931
 
20-node second order hexahedron (8 nodes associated with the vertices
2932
 
and 12 with the edges).
2933
 
@item 18
2934
 
15-node second order prism (6 nodes associated with the vertices and 9
2935
 
with the edges).
2936
 
@item 19
2937
 
13-node second order pyramid (5 nodes associated with the vertices and 8
2938
 
with the edges).
2939
 
@end table
2940
 
See below for the ordering of the nodes.
2941
 
 
2942
 
@item @var{reg-phys}
2943
 
is the number of the physical entity to which the element belongs. 
2944
 
 
2945
 
@item @var{reg-elem}
2946
 
is the number of the elementary entity to which the element belongs.
2947
 
 
2948
 
@item @var{number-of-nodes}
2949
 
is the number of nodes for the @var{n}-th element. This is redundant, but
2950
 
kept for backward compatibility.
2951
 
 
2952
 
@item @var{node-number-list}
2953
 
is the list of the @var{number-of-nodes} node numbers of the @var{n}-th
2954
 
element. The ordering of the nodes is given in @ref{Gmsh node ordering}; for
2955
 
second order elements, the first order nodes are given first, followed by
2956
 
the nodes associated with the edges, followed by the nodes associated with
2957
 
the quadrangular faces (if any), followed by the nodes associated with the
2958
 
volume (if any). The ordering of these additional nodes follows the ordering
2959
 
of the edges and quadrangular faces given in @ref{Gmsh node ordering}.
2960
 
@end table
2961
 
 
2962
 
@c .........................................................................
2963
 
@c Version 2.0 ASCII
2964
 
@c .........................................................................
2965
 
 
2966
 
@node Version 2.0 ASCII, Version 2.0 Binary, Version 1.0, Gmsh mesh file formats
2967
 
@subsection Version 2.0 ASCII
2968
 
 
2969
 
The version 2.0 of the @file{.msh} file format is Gmsh's new native mesh
2970
 
file format. It is very similar to the old one (@pxref{Version 1.0}),
2971
 
but is more general: it contains information about itself and allows to
2972
 
associate an arbitrary number of integer tags with each element. Ialso
2973
 
exists in both ASCII and binary form.
2974
 
 
2975
 
The @file{.msh} file format, version 2.0, is divided in three main
2976
 
sections, defining the file format
2977
 
(@code{$MeshFormat}-@code{$EndMeshFormat}), the nodes
2978
 
(@code{$Nodes}-@code{$EndNodes}) and the elements
2979
 
(@code{$Elements}-@code{$EndElements}) in the mesh:
 
2979
@cindex MSH file
 
2980
 
 
2981
The MSH ASCII file format contains one mandatory section giving
 
2982
information about the file (@code{$MeshFormat}), followed by several
 
2983
optional sections defining the nodes (@code{$Nodes}), elements
 
2984
(@code{$Elements}), region names (@code{$PhysicalName}) and
 
2985
post-processing datasets (@code{$NodeData}, @code{$ElementData},
 
2986
@code{$ElememtNodeData}). Sections can be repeated in the same file, and
 
2987
post-processing sections can be put into separate files (e.g. one file
 
2988
per time step).
 
2989
 
 
2990
The format is defined as follows:
2980
2991
 
2981
2992
@example
2982
2993
$MeshFormat
2983
 
2.0 @var{file-type} @var{data-size}
 
2994
@var{version-number} @var{file-type} @var{data-size}
2984
2995
$EndMeshFormat
2985
2996
$Nodes
2986
2997
@var{number-of-nodes}
2992
3003
@var{elm-number} @var{elm-type} @var{number-of-tags} < @var{tag} > @dots{} @var{node-number-list}
2993
3004
@dots{}
2994
3005
$EndElements
 
3006
$PhysicalNames
 
3007
@var{number-of-names}
 
3008
@var{phyical-number} "@var{physical-name}"
 
3009
@dots{}
 
3010
$EndPhysicalNames
 
3011
$NodeData
 
3012
@var{number-of-string-tags}
 
3013
< "@var{string-tag}" >
 
3014
@dots{}
 
3015
@var{number-of-real-tags}
 
3016
< @var{real-tag} >
 
3017
@dots{}
 
3018
@var{number-of-integer-tags}
 
3019
< @var{integer-tag} >
 
3020
@dots{}
 
3021
@var{node-number} @var{value} @dots{}
 
3022
@dots{}
 
3023
$EndNodeData
 
3024
$ElementData
 
3025
@var{number-of-string-tags}
 
3026
< "@var{string-tag}" >
 
3027
@dots{}
 
3028
@var{number-of-real-tags}
 
3029
< @var{real-tag} >
 
3030
@dots{}
 
3031
@var{number-of-integer-tags}
 
3032
< @var{integer-tag} >
 
3033
@dots{}
 
3034
@var{elm-number} @var{value} @dots{}
 
3035
@dots{}
 
3036
$EndElementData
 
3037
$ElementNodeData
 
3038
@var{number-of-string-tags}
 
3039
< "@var{string-tag}" >
 
3040
@dots{}
 
3041
@var{number-of-real-tags}
 
3042
< @var{real-tag} >
 
3043
@dots{}
 
3044
@var{number-of-integer-tags}
 
3045
< @var{integer-tag} >
 
3046
@dots{}
 
3047
@var{elm-number} @var{number-of-nodes-per-element} @var{value} @dots{}
 
3048
@dots{}
 
3049
$ElementEndNodeData
2995
3050
@end example
2996
3051
 
2997
3052
@noindent
2998
3053
where
2999
3054
@table @code
 
3055
@item @var{version-number}
 
3056
is a real number equal to 2.0
 
3057
 
3000
3058
@item @var{file-type}
3001
3059
is an integer equal to 0 in the ASCII file format.
3002
3060
 
3008
3066
is the number of nodes in the mesh.
3009
3067
 
3010
3068
@item @var{node-number}
3011
 
is the number (index) of the @var{n}-th node in the mesh. Note that the
3012
 
@w{@var{node-number}s} do not have to be given in a consecutive (or even an
3013
 
ordered) way.
 
3069
is the number (index) of the @var{n}-th node in the mesh;
 
3070
@var{node-number} must be a postive (non-zero) integer. Note that the
 
3071
@w{@var{node-number}s} do not necessarily have to form a dense nor an
 
3072
ordered sequence.
3014
3073
 
3015
3074
@item @var{x-coord} @var{y-coord} @var{z-coord}
3016
3075
are the floating point values giving the X, Y and Z coordinates of the
3020
3079
is the number of elements in the mesh.
3021
3080
 
3022
3081
@item @var{elm-number}
3023
 
is the number (index) of the @var{n}-th element in the mesh. Note that the
3024
 
@w{@var{elm-number}s} do not have to be given in a consecutive (or even an
3025
 
ordered) way.
 
3082
is the number (index) of the @var{n}-th element in the mesh;
 
3083
@var{elm-number} must be a postive (non-zero) integer. Note that the
 
3084
@w{@var{elm-number}s} do not necessarily have to form a dense nor an
 
3085
ordered sequence.
3026
3086
 
3027
3087
@item @var{elm-type}
3028
3088
defines the geometrical type of the @var{n}-th element:
3080
3140
See below for the ordering of the nodes.
3081
3141
 
3082
3142
@item @var{number-of-tags}
3083
 
gives the number of tags for the @var{n}-th element. By default, Gmsh
3084
 
generates meshes with two tags and reads files with an arbitrary number of
3085
 
tags: see below.
3086
 
 
3087
 
@item @var{tag}
3088
 
is an integer tag associated with the @var{n}-th element. By default, the
3089
 
first tag is the number of the physical entity to which the element belongs;
3090
 
the second is the number of the elementary geometrical entity to which the
3091
 
element belongs; the third is the number of a mesh partition to which the
3092
 
element belongs.
 
3143
gives the number of integer tags that follow for the @var{n}-th
 
3144
element. By default, the first @var{tag} is the number of the physical
 
3145
entity to which the element belongs; the second is the number of the
 
3146
elementary geometrical entity to which the element belongs; the third is
 
3147
the number of a mesh partition to which the element belongs. All tags
 
3148
must be postive integers, or zero. A zero tag is equivalent to no tag.
3093
3149
 
3094
3150
@item @var{node-number-list}
3095
3151
is the list of the node numbers of the @var{n}-th element. The ordering of
3096
 
the nodes is given in @ref{Gmsh node ordering}; for second order elements,
 
3152
the nodes is given in @ref{Node ordering}; for second order elements,
3097
3153
the first order nodes are given first, followed by the nodes associated with
3098
3154
the edges, followed by the nodes associated with the quadrangular faces (if
3099
3155
any), followed by the nodes associated with the volume (if any). The
3100
3156
ordering of these additional nodes follows the ordering of the edges and
3101
 
quadrangular faces given in @ref{Gmsh node ordering}.
 
3157
quadrangular faces given in @ref{Node ordering}.
 
3158
 
 
3159
@item @var{number-of-string-tags}
 
3160
gives the number of string tags that follow. By default the first
 
3161
@var{string-tag} is interpreted as the name of the post-processing view,
 
3162
and the second as the name of the interpolation scheme.
 
3163
 
 
3164
@item @var{number-of-real-tags}
 
3165
gives the number of real number tags that follow.
 
3166
 
 
3167
@item @var{number-of-integer-tags}
 
3168
gives the number of integer tags that follow. By default the first
 
3169
@var{integer-tag} is interpreted as a time step number, the second as
 
3170
the number of field components of the data in the view, the third as the
 
3171
number of entities (nodes or elements) in the view, and the fourth as
 
3172
the partition index for the view data.
 
3173
 
 
3174
@item @var{number-of-nodes-per-elements}
 
3175
gives the number of node values for an element in an element-based view.
 
3176
 
 
3177
@item @var{value}
 
3178
is a real number giving the value associated with a node or an
 
3179
element. For @code{NodeData} (respectively @code{ElementData}) views,
 
3180
there are @var{ncomp} values per node (resp. per element), where
 
3181
@var{ncomp} is the number of field components. For
 
3182
@code{ElementNodeData} views, there are @var{ncomp} times
 
3183
@var{number-of-nodes-per-elements} values per element.
3102
3184
@end table
3103
3185
 
3104
 
Additional sections can be present in the file, which an external parser
3105
 
can simply ignore. One such additional section
3106
 
(@code{$PhysicalNames}-@code{$EndPhysicalNames}) associates names with
3107
 
physical entity identification numbers:
3108
 
@example
3109
 
$PhysicalNames
3110
 
@var{number-of-names}
3111
 
@var{phyical-number} "@var{physical-name}"
3112
 
$EndPhysicalNames
3113
 
@end example
3114
 
 
3115
 
@c .........................................................................
3116
 
@c Version 2.0 BINARY
3117
 
@c .........................................................................
3118
 
 
3119
 
@node Version 2.0 Binary,  , Version 2.0 ASCII, Gmsh mesh file formats
3120
 
@subsection Version 2.0 Binary
3121
 
 
3122
 
The binary file format is similar to the ASCII format described in
3123
 
@ref{Version 2.0 ASCII}:
 
3186
@c -------------------------------------------------------------------------
 
3187
@c MSH binary file format
 
3188
@c -------------------------------------------------------------------------
 
3189
 
 
3190
@node MSH binary file format, Node ordering, MSH ASCII file format, File formats
 
3191
@section MSH binary file format
 
3192
 
 
3193
The binary file format is similar to the ASCII format described above:
3124
3194
 
3125
3195
@example
3126
3196
$MeshFormat
3127
 
2.0 @var{file-type} @var{data-size}
 
3197
@var{version-number} @var{file-type} @var{data-size}
3128
3198
@var{one-binary}
3129
3199
$EndMeshFormat
3130
3200
$Nodes
3139
3209
@var{elements-binary}
3140
3210
@dots{}
3141
3211
$EndElements
 
3212
 
 
3213
[ all other sections are identical to ASCII, except that @var{node-number},
 
3214
  @var{elm-number}, @var{number-of-nodes-per-elemenr} and @var{values} are written in
 
3215
  binary format ]
3142
3216
@end example
3143
3217
 
3144
3218
@noindent
3145
3219
where
3146
3220
@table @code
 
3221
@item @var{version-number}
 
3222
is a real number equal to 2.0.
 
3223
 
3147
3224
@item @var{file-type}
3148
3225
is an integer equal to 1.
3149
3226
 
3217
3294
@end example
3218
3295
@end table
3219
3296
 
3220
 
The same additional sections as in the ASCII format can be present in
3221
 
the file.
3222
 
 
3223
 
@c -------------------------------------------------------------------------
3224
 
@c Gmsh post-processing file formats
3225
 
@c -------------------------------------------------------------------------
3226
 
 
3227
 
@node Gmsh post-processing file formats, Gmsh node ordering, Gmsh mesh file formats, File formats
3228
 
@section Gmsh post-processing file formats
3229
 
 
3230
 
@cindex @file{.pos} file
3231
 
 
3232
 
Gmsh can read and write data sets in three different file formats: the
3233
 
``parsed'', ``ASCII'' and ``binary'' file formats. The parsed format is the
3234
 
oldest and most flexible, but also the slowest to read/write. The ASCII and
3235
 
binary formats are less flexible but allow for faster read/write operations,
3236
 
which is useful for (very) large data sets.
3237
 
 
3238
 
Gmsh can convert any format to any other, either in a script (cf. @code{Save
3239
 
View} and @code{PostProcessing.Format} in @ref{Post-processing commands},
3240
 
and @ref{Post-processing options}, respectively) or in the graphical user
3241
 
interface (using the `View->Save As' menu).
 
3297
@c -------------------------------------------------------------------------
 
3298
@c Node ordering
 
3299
@c -------------------------------------------------------------------------
 
3300
 
 
3301
@node Node ordering, Legacy formats, MSH binary file format, File formats
 
3302
@section Node ordering
 
3303
 
 
3304
@cindex Nodes, ordering
 
3305
@cindex Edges, ordering
 
3306
@cindex Faces, ordering
 
3307
 
 
3308
For all mesh and post-processing file formats, the reference elements
 
3309
are defined as follows. For high-order elements, the ordering of the
 
3310
edges/quad faces defines the ordering of high-order vertices associated
 
3311
with edges/faces.
 
3312
 
 
3313
@c FIXME: changer la doc des faces pour les definir de maniere sensee
 
3314
@c sans butterflies.
 
3315
 
 
3316
@example
 
3317
@group
 
3318
Point:
 
3319
        v
 
3320
        |
 
3321
        |
 
3322
   -----1-----u
 
3323
        |
 
3324
        |
 
3325
@end group
 
3326
@end example
 
3327
 
 
3328
@example
 
3329
@group
 
3330
Line:
 
3331
                  edge 1: nodes 1 2
 
3332
        v
 
3333
        |
 
3334
        |
 
3335
   --1-----2--u
 
3336
        |
 
3337
        |
 
3338
@end group
 
3339
@end example
 
3340
 
 
3341
@example
 
3342
@group
 
3343
Triangle:
 
3344
                  edge 1: nodes 1 2
 
3345
   v                   2:       2 3
 
3346
   |                   3:       3 1
 
3347
   |
 
3348
   3
 
3349
   |\
 
3350
   | \
 
3351
   |__\___u
 
3352
   1   2
 
3353
@end group
 
3354
@end example
 
3355
 
 
3356
@example
 
3357
@group
 
3358
Quadrangle:
 
3359
                  edge 1: nodes 1 2   quad. face 1: nodes 1 2 3 4
 
3360
        v              2:       2 3
 
3361
        |              3:       3 4
 
3362
     4--|--3           4:       4 1
 
3363
     |  |  |
 
3364
   -----------u
 
3365
     |  |  |
 
3366
     1--|--2
 
3367
        |
 
3368
@end group
 
3369
@end example
 
3370
 
 
3371
@example
 
3372
@group
 
3373
Tetrahedron:
 
3374
                  edge 1: nodes 1 2
 
3375
   v                   2:       2 3
 
3376
   |                   3:       3 1
 
3377
   |                   4:       4 1
 
3378
   |                   5:       4 3
 
3379
   3                   6:       4 2
 
3380
   |\                
 
3381
   | \
 
3382
   |__\2_____u
 
3383
   1\ /
 
3384
     \4
 
3385
      \
 
3386
       w
 
3387
@end group
 
3388
@end example
 
3389
 
 
3390
@example
 
3391
@group
 
3392
Hexahedron:
 
3393
                  edge 1: nodes 1 2   quad. face 1: nodes 1 4 3 2
 
3394
        v              2:       1 4              2:       1 2 6 5
 
3395
        |              3:       1 5              3:       1 5 8 4
 
3396
        |              4:       2 3              4:       2 3 7 6
 
3397
   4----|--3           5:       2 6              5:       3 4 8 7
 
3398
   |\   |  |\          6:       3 4              6:       5 6 7 8
 
3399
   | 8-------7         7:       3 7
 
3400
   | |   ----|---u     8:       4 8
 
3401
   1-|---\-2 |         9:       5 6
 
3402
    \|    \ \|        10:       5 8
 
3403
     5-----\-6        11:       6 7
 
3404
            \         12:       7 8
 
3405
             w
 
3406
@end group
 
3407
@end example
 
3408
 
 
3409
@example
 
3410
@group
 
3411
Prism:
 
3412
                  edge 1: nodes 1 2   quad. face 1: nodes 1 2 5 4
 
3413
      v                2:       1 3              2:       1 4 6 3
 
3414
    3 |                3:       1 4              3:       2 3 6 5
 
3415
    |\|                4:       2 3
 
3416
    | |                5:       2 5
 
3417
    1_|2               6:       3 6
 
3418
     \| 6              7:       4 5
 
3419
      |_|_\___u        8:       4 6
 
3420
       \|  \           9:       5 6
 
3421
        4 __5
 
3422
         \
 
3423
          \
 
3424
           w
 
3425
@end group
 
3426
@end example
 
3427
 
 
3428
@example
 
3429
@group
 
3430
Pyramid:
 
3431
                  edge 1: nodes 1 2   quad. face 1: nodes 1 4 3 2
 
3432
        v              2        1 4
 
3433
        |              3        1 5
 
3434
        |              4        2 3
 
3435
    4---|---3          5        2 5
 
3436
    | \ |  /|          6        3 4
 
3437
    |  \ -/-|---u      7        3 5
 
3438
    |  / 5\ |          8        4 5
 
3439
    1/----\-2
 
3440
           \
 
3441
            \
 
3442
             w
 
3443
@end group
 
3444
@end example
 
3445
 
 
3446
@c -------------------------------------------------------------------------
 
3447
@c Legacy formats
 
3448
@c -------------------------------------------------------------------------
 
3449
 
 
3450
@node Legacy formats,  , Node ordering, File formats
 
3451
@section Legacy formats
 
3452
 
 
3453
This section describes Gmsh's older native file formats. Future versions
 
3454
of Gmsh will continue to support these formats, but we recommend that
 
3455
you do not use them in new aplications.
 
3456
 
 
3457
@c .........................................................................
 
3458
@c MSH file format version 1.0
 
3459
@c .........................................................................
3242
3460
 
3243
3461
@menu
3244
 
* Parsed post-processing file format::  
3245
 
* ASCII post-processing file format::  
3246
 
* Binary post-processing file format::  
 
3462
* MSH file format version 1.0::  
 
3463
* POS ASCII file format::       
 
3464
* POS binary file format::      
3247
3465
@end menu
3248
3466
 
3249
 
@c .........................................................................
3250
 
@c Parsed post-processing file format
3251
 
@c .........................................................................
3252
 
 
3253
 
@node Parsed post-processing file format, ASCII post-processing file format, Gmsh post-processing file formats, Gmsh post-processing file formats
3254
 
@subsection Parsed post-processing file format
3255
 
 
3256
 
@cindex Post-processing, parsed file format
3257
 
@cindex File format, post-processing, parsed
3258
 
@cindex @file{.pos} file
3259
 
 
3260
 
Gmsh's oldest post-processing format (``parsed'') is read by Gmsh's script
3261
 
parser (see also @ref{Post-processing commands}). You can thus, for example,
3262
 
embed parsed post-processing views directly into your geometrical
3263
 
descriptions (see, e.g., @ref{t4.geo}). 
3264
 
 
3265
 
The parsed format is very powerful, since all the values are
3266
 
@var{expressions}, and it can be easily generated ``on-the-fly'', as there
3267
 
is no header containing @emph{a priori} information on the size of the data
3268
 
set. Its syntax is also very permissive, which makes it ideal for testing
3269
 
purposes. Its main disadvantage resides in the overhead introduced by the
3270
 
parser, which makes loading a view in parsed format slower than loading a
3271
 
view in ASCII or binary format. This is only a disadvantage for very large
3272
 
data sets, though.
3273
 
 
3274
 
A post-processing view in parsed format is defined as follows (there can be
3275
 
one or more views in the same file):
3276
 
 
3277
 
@example
3278
 
@group
3279
 
View "@var{string}" @{
3280
 
  < TIME @{ @var{expression-list} @}; >
3281
 
  @var{type} ( @var{list-of-coords} ) @{ @var{list-of-values} @};
3282
 
  @dots{}
3283
 
@};
3284
 
@end group
3285
 
@end example
3286
 
 
3287
 
where the 47 object @w{@var{type}s} that can be displayed are:
3288
 
 
3289
 
@example
3290
 
                                 @var{type}  #@var{list-of-coords}  #@var{list-of-values}
3291
 
--------------------------------------------------------------------
3292
 
Scalar point                     SP    3            1  * @var{nb-time-steps}
3293
 
Vector point                     VP    3            3  * @var{nb-time-steps}
3294
 
Tensor point                     TP    3            9  * @var{nb-time-steps}
3295
 
Scalar line                      SL    6            2  * @var{nb-time-steps}
3296
 
Vector line                      VL    6            6  * @var{nb-time-steps}
3297
 
Tensor line                      TL    6            18 * @var{nb-time-steps}
3298
 
Scalar triangle                  ST    9            3  * @var{nb-time-steps}
3299
 
Vector triangle                  VT    9            9  * @var{nb-time-steps}
3300
 
Tensor triangle                  TT    9            27 * @var{nb-time-steps}
3301
 
Scalar quadrangle                SQ    12           4  * @var{nb-time-steps}
3302
 
Vector quadrangle                VQ    12           12 * @var{nb-time-steps}
3303
 
Tensor quadrangle                TQ    12           36 * @var{nb-time-steps}
3304
 
Scalar tetrahedron               SS    12           4  * @var{nb-time-steps}
3305
 
Vector tetrahedron               VS    12           12 * @var{nb-time-steps}
3306
 
Tensor tetrahedron               TS    12           36 * @var{nb-time-steps}
3307
 
Scalar hexahedron                SH    24           8  * @var{nb-time-steps}
3308
 
Vector hexahedron                VH    24           24 * @var{nb-time-steps}
3309
 
Tensor hexahedron                TH    24           72 * @var{nb-time-steps}
3310
 
Scalar prism                     SI    18           6  * @var{nb-time-steps}
3311
 
Vector prism                     VI    18           18 * @var{nb-time-steps}
3312
 
Tensor prism                     TI    18           54 * @var{nb-time-steps}
3313
 
Scalar pyramid                   SY    15           5  * @var{nb-time-steps}
3314
 
Vector pyramid                   VY    15           15 * @var{nb-time-steps}
3315
 
Tensor pyramid                   TY    15           45 * @var{nb-time-steps}
3316
 
Second order scalar line         SL2   9            3  * @var{nb-time-steps}
3317
 
Second order vector line         VL2   9            9  * @var{nb-time-steps}
3318
 
Second order tensor line         TL2   9            27 * @var{nb-time-steps}
3319
 
Second order scalar triangle     ST2   18           6  * @var{nb-time-steps}
3320
 
Second order vector triangle     VT2   18           18 * @var{nb-time-steps}
3321
 
Second order tensor triangle     TT2   18           54 * @var{nb-time-steps}
3322
 
Second order scalar quadrangle   SQ2   27           9  * @var{nb-time-steps}
3323
 
Second order vector quadrangle   VQ2   27           27 * @var{nb-time-steps}
3324
 
Second order tensor quadrangle   TQ2   27           81 * @var{nb-time-steps}
3325
 
Second order scalar tetrahedron  SS2   30           10 * @var{nb-time-steps}
3326
 
Second order vector tetrahedron  VS2   30           30 * @var{nb-time-steps}
3327
 
Second order tensor tetrahedron  TS2   30           90 * @var{nb-time-steps}
3328
 
Second order scalar hexahedron   SH2   81           27 * @var{nb-time-steps}
3329
 
Second order vector hexahedron   VH2   81           81 * @var{nb-time-steps}
3330
 
Second order tensor hexahedron   TH2   81           243* @var{nb-time-steps}
3331
 
Second order scalar prism        SI2   54           18 * @var{nb-time-steps}
3332
 
Second order vector prism        VI2   54           54 * @var{nb-time-steps}
3333
 
Second order tensor prism        TI2   54           162* @var{nb-time-steps}
3334
 
Second order scalar pyramid      SY2   42           14 * @var{nb-time-steps}
3335
 
Second order vector pyramid      VY2   42           42 * @var{nb-time-steps}
3336
 
Second order tensor pyramid      TY2   42           126* @var{nb-time-steps}
3337
 
2D text                          T2    3            arbitrary
3338
 
3D text                          T3    4            arbitrary
3339
 
@end example
3340
 
 
3341
 
The coordinates are given `by node'@footnote{Beware that this is different
3342
 
from the ordering of the node coordinates in the ASCII and binary
3343
 
post-processing file formats.}, i.e.,
3344
 
 
3345
 
@itemize @bullet
3346
 
@item
3347
 
@code{(@var{coord1}, @var{coord2}, @var{coord3})} for a point,
3348
 
@item 
3349
 
@code{(@var{coord1-node1}, @var{coord2-node1}, @var{coord3-node1},}@* 
3350
 
@code{ @var{coord1-node2}, @var{coord2-node2}, @var{coord3-node2})} for a line,
3351
 
@item 
3352
 
@code{(@var{coord1-node1}, @var{coord2-node1}, @var{coord3-node1},}@*
3353
 
@code{ @var{coord1-node2}, @var{coord2-node2}, @var{coord3-node2},}@*
3354
 
@code{ @var{coord1-node3}, @var{coord2-node3}, @var{coord3-node3})} for a triangle,
3355
 
@item
3356
 
etc.
3357
 
@end itemize
3358
 
 
3359
 
The ordering of the nodes is given in @ref{Gmsh node ordering}. For second
3360
 
order elements, the first order nodes are given first, followed by the nodes
3361
 
associated with the edges, followed by the nodes associated with the
3362
 
quadrangular faces (if any), followed by the nodes associated with the
3363
 
volume (if any). The ordering of these additional nodes follows the ordering
3364
 
of the edges and quadrangular faces given in @ref{Gmsh node ordering}.
3365
 
 
3366
 
The values are given by time step, by node and by component, i.e.:
3367
 
@example
3368
 
@var{comp1-node1-time1}, @var{comp2-node1-time1}, @var{comp3-node1-time1},
3369
 
@var{comp1-node2-time1}, @var{comp2-node2-time1}, @var{comp3-node2-time1},
3370
 
@var{comp1-node3-time1}, @var{comp2-node3-time1}, @var{comp3-node3-time1},
3371
 
@var{comp1-node1-time2}, @var{comp2-node1-time2}, @var{comp3-node1-time2},
3372
 
@var{comp1-node2-time2}, @var{comp2-node2-time2}, @var{comp3-node2-time2},
3373
 
@var{comp1-node3-time2}, @var{comp2-node3-time2}, @var{comp3-node3-time2},
3374
 
@dots{}
3375
 
@end example
3376
 
 
3377
 
For the 2D text objects, the two first @w{@var{expression}s} in
3378
 
@var{list-of-coords} give the X-Y position of the string in screen
3379
 
coordinates, measured from the top-left corner of the window. If the first
3380
 
(respectively second) @var{expression} is negative, the position is measured
3381
 
from the right (respectively bottom) edge of the window. If the value of the
3382
 
first (respectively second) @var{expression} is larger than 99999, the
3383
 
string is centered horizontally (respectively vertically). If the third
3384
 
@var{expression} is equal to zero, the text is aligned bottom-left and
3385
 
displayed using the default font and size. Otherwise, the third
3386
 
@var{expression} is converted into an integer whose eight lower bits give
3387
 
the font size, whose eight next bits select the font (the index corresponds
3388
 
to the position in the font menu in the GUI), and whose eight next bits
3389
 
define the text alignment (0=bottom-left, 1=bottom-center, 2=bottom-right,
3390
 
3=top-left, 4=top-center, 5=top-right, 6=center-left, 7=center-center,
3391
 
8=center-right).
3392
 
 
3393
 
For the 3D text objects, the three first @w{@var{expression}s} in
3394
 
@var{list-of-coords} give the XYZ position of the string in model (real
3395
 
world) coordinates.  The fourth @var{expression} has the same meaning as the
3396
 
third @var{expression} in 2D text objects.
3397
 
 
3398
 
For both 2D and 3D text objects, the @var{list-of-values} can contain an
3399
 
arbitrary number of @w{@var{char-expression}s}.
3400
 
 
3401
 
The optional @code{TIME} list can contain a list of expressions giving the
3402
 
value of the time (or any other variable) for which an evolution was saved.
3403
 
 
3404
 
@c .........................................................................
3405
 
@c ASCII post-processing file format
3406
 
@c .........................................................................
3407
 
 
3408
 
@node ASCII post-processing file format, Binary post-processing file format, Parsed post-processing file format, Gmsh post-processing file formats
3409
 
@subsection ASCII post-processing file format
3410
 
 
3411
 
@cindex Post-processing, ASCII file format
3412
 
@cindex File format, post-processing, ASCII
3413
 
 
3414
 
The ASCII post-processing file is divided in several sections: one format
3415
 
section, enclosed between @code{$PostFormat}-@code{$EndPostFormat} tags, and
3416
 
one or more post-processing views, enclosed between
3417
 
@code{$View}-@code{$EndView} tags:
 
3467
@node MSH file format version 1.0, POS ASCII file format, Legacy formats, Legacy formats
 
3468
@subsection MSH file format version 1.0
 
3469
 
 
3470
The MSH file format version 1.0 is Gmsh's old native mesh file format,
 
3471
now superseded by the format described in @ref{MSH ASCII file
 
3472
format}. It is defined as follows:
 
3473
 
 
3474
@example
 
3475
$NOD
 
3476
@var{number-of-nodes}
 
3477
@var{node-number} @var{x-coord} @var{y-coord} @var{z-coord}
 
3478
@dots{}
 
3479
$ENDNOD
 
3480
$ELM
 
3481
@var{number-of-elements}
 
3482
@var{elm-number} @var{elm-type} @var{reg-phys} @var{reg-elem} @var{number-of-nodes} @var{node-number-list}
 
3483
@dots{}
 
3484
$ENDELM
 
3485
@end example
 
3486
 
 
3487
@noindent
 
3488
where
 
3489
@table @code
 
3490
@item @var{number-of-nodes}
 
3491
is the number of nodes in the mesh.
 
3492
 
 
3493
@item @var{node-number}
 
3494
is the number (index) of the @var{n}-th node in the mesh;
 
3495
@var{node-number} must be a postive (non-zero) integer. Note that the
 
3496
@w{@var{node-number}s} do not necessarily have to form a dense nor an
 
3497
ordered sequence.
 
3498
 
 
3499
@item @var{x-coord} @var{y-coord} @var{z-coord}
 
3500
are the floating point values giving the X, Y and Z coordinates of the
 
3501
@var{n}-th node.
 
3502
 
 
3503
@item @var{number-of-elements}
 
3504
is the number of elements in the mesh.
 
3505
 
 
3506
@item @var{elm-number}
 
3507
is the number (index) of the @var{n}-th element in the mesh;
 
3508
@var{elm-number} must be a postive (non-zero) integer. Note that the
 
3509
@w{@var{elm-number}s} do not necessarily have to form a dense nor an
 
3510
ordered sequence.
 
3511
 
 
3512
@item @var{elm-type}
 
3513
defines the geometrical type of the @var{n}-th element:
 
3514
@table @code
 
3515
@item 1
 
3516
2-node line.
 
3517
@item 2
 
3518
3-node triangle.
 
3519
@item 3
 
3520
4-node quadrangle.
 
3521
@item 4
 
3522
4-node tetrahedron.
 
3523
@item 5
 
3524
8-node hexahedron.
 
3525
@item 6
 
3526
6-node prism.
 
3527
@item 7
 
3528
5-node pyramid.
 
3529
@item 8
 
3530
3-node second order line (2 nodes associated with the vertices and 1
 
3531
with the edge).
 
3532
@item 9
 
3533
6-node second order triangle (3 nodes associated with the vertices and 3
 
3534
with the edges).
 
3535
@item 10
 
3536
9-node second order quadrangle (4 nodes associated with the vertices, 4
 
3537
with the edges and 1 with the face).
 
3538
@item 11
 
3539
10-node second order tetrahedron (4 nodes associated with the vertices
 
3540
and 6 with the edges).
 
3541
@item 12
 
3542
27-node second order hexahedron (8 nodes associated with the vertices,
 
3543
12 with the edges, 6 with the faces and 1 with the volume).
 
3544
@item 13
 
3545
18-node second order prism (6 nodes associated with the vertices, 9 with
 
3546
the edges and 3 with the quadrangular faces).
 
3547
@item 14
 
3548
14-node second order pyramid (5 nodes associated with the vertices, 8
 
3549
with the edges and 1 with the quadrangular face).
 
3550
@item 15
 
3551
1-node point.
 
3552
@item 16
 
3553
8-node second order quadrangle (4 nodes associated with the vertices and
 
3554
4 with the edges).
 
3555
@item 17
 
3556
20-node second order hexahedron (8 nodes associated with the vertices
 
3557
and 12 with the edges).
 
3558
@item 18
 
3559
15-node second order prism (6 nodes associated with the vertices and 9
 
3560
with the edges).
 
3561
@item 19
 
3562
13-node second order pyramid (5 nodes associated with the vertices and 8
 
3563
with the edges).
 
3564
@end table
 
3565
See below for the ordering of the nodes.
 
3566
 
 
3567
@item @var{reg-phys}
 
3568
is the number of the physical entity to which the element belongs;
 
3569
@var{reg-phys} must be a postive integer, or zero. If @var{reg-phys} is
 
3570
equal to zero, the element is considered not to belong to any physical
 
3571
entity.
 
3572
 
 
3573
@item @var{reg-elem}
 
3574
is the number of the elementary entity to which the element belongs;
 
3575
@var{reg-elem} must be a postive (non-zero) integer.
 
3576
 
 
3577
@item @var{number-of-nodes}
 
3578
is the number of nodes for the @var{n}-th element. This is redundant, but
 
3579
kept for backward compatibility.
 
3580
 
 
3581
@item @var{node-number-list}
 
3582
is the list of the @var{number-of-nodes} node numbers of the @var{n}-th
 
3583
element. The ordering of the nodes is given in @ref{Node ordering}; for
 
3584
second order elements, the first order nodes are given first, followed
 
3585
by the nodes associated with the edges, followed by the nodes associated
 
3586
with the quadrangular faces (if any), followed by the nodes associated
 
3587
with the volume (if any). The ordering of these additional nodes follows
 
3588
the ordering of the edges and quadrangular faces given in @ref{Node
 
3589
ordering}.
 
3590
@end table
 
3591
 
 
3592
@c .........................................................................
 
3593
@c POS ASCII file format
 
3594
@c .........................................................................
 
3595
 
 
3596
@node POS ASCII file format, POS binary file format, MSH file format version 1.0, Legacy formats
 
3597
@subsection POS ASCII file format
 
3598
 
 
3599
The POS ASCII file is Gmsh's old native pot-processing format, now
 
3600
superseded by the format described in @ref{MSH ASCII file format}. It is
 
3601
defined as follows:
3418
3602
 
3419
3603
@example
3420
3604
$PostFormat
3531
3715
@dots{}
3532
3716
@end example
3533
3717
 
3534
 
The ordering of the nodes is given in @ref{Gmsh node ordering}. For second
3535
 
order elements, the first order nodes are given first, followed by the nodes
3536
 
associated with the edges, followed by the nodes associated with the
3537
 
quadrangular faces (if any), followed by the nodes associated with the
3538
 
volume (if any). The ordering of these additional nodes follows the ordering
3539
 
of the edges and quadrangular faces given in @ref{Gmsh node ordering}.
 
3718
The ordering of the nodes is given in @ref{Node ordering}. For second
 
3719
order elements, the first order nodes are given first, followed by the
 
3720
nodes associated with the edges, followed by the nodes associated with
 
3721
the quadrangular faces (if any), followed by the nodes associated with
 
3722
the volume (if any). The ordering of these additional nodes follows the
 
3723
ordering of the edges and quadrangular faces given in @ref{Node
 
3724
ordering}.
3540
3725
 
3541
3726
@item @var{text2d}
3542
3727
is a list of 4 double precision numbers:
3578
3763
@end table
3579
3764
 
3580
3765
@c .........................................................................
3581
 
@c Binary post-processing file format
 
3766
@c POS binary file format
3582
3767
@c .........................................................................
3583
3768
 
3584
 
@node Binary post-processing file format,  , ASCII post-processing file format, Gmsh post-processing file formats
3585
 
@subsection Binary post-processing file format
3586
 
 
3587
 
@cindex Post-processing, binary file format
3588
 
@cindex File format, post-processing, binary
3589
 
 
3590
 
The binary post-processing file format is the same as the ASCII file format
3591
 
described in @ref{ASCII post-processing file format}, except that:
 
3769
@node POS binary file format,  , POS ASCII file format, Legacy formats
 
3770
@subsection POS binary file format
 
3771
 
 
3772
The POS binary file format is the same as the POS ASCII file format
 
3773
described in @ref{POS ASCII file format}, except that:
3592
3774
 
3593
3775
@enumerate
3594
3776
@item
3647
3829
after each other in order to form a long array of doubles. The principle is
3648
3830
the same for all other kinds of values.
3649
3831
 
3650
 
@c -------------------------------------------------------------------------
3651
 
@c Gmsh node ordering
3652
 
@c -------------------------------------------------------------------------
3653
 
 
3654
 
@node Gmsh node ordering,  , Gmsh post-processing file formats, File formats
3655
 
@section Gmsh node ordering
3656
 
 
3657
 
@cindex Nodes, ordering
3658
 
@cindex Edges, ordering
3659
 
@cindex Faces, ordering
3660
 
 
3661
 
For all mesh and post-processing file formats, the reference elements are
3662
 
defined as follows:
3663
 
 
3664
 
@c FIXME: changer la doc des faces pour les definir de maniere sensee
3665
 
@c sans butterflies.
3666
 
 
3667
 
@example
3668
 
@group
3669
 
Point:
3670
 
        v
3671
 
        |
3672
 
        |
3673
 
   -----1-----u
3674
 
        |
3675
 
        |
3676
 
@end group
3677
 
@end example
3678
 
 
3679
 
@example
3680
 
@group
3681
 
Line:
3682
 
                  edge 1: nodes 1 2
3683
 
        v
3684
 
        |
3685
 
        |
3686
 
   --1-----2--u
3687
 
        |
3688
 
        |
3689
 
@end group
3690
 
@end example
3691
 
 
3692
 
@example
3693
 
@group
3694
 
Triangle:
3695
 
                  edge 1: nodes 1 2
3696
 
   v                   2:       2 3
3697
 
   |                   3:       3 1
3698
 
   |
3699
 
   3
3700
 
   |\
3701
 
   | \
3702
 
   |__\___u
3703
 
   1   2
3704
 
@end group
3705
 
@end example
3706
 
 
3707
 
@example
3708
 
@group
3709
 
Quadrangle:
3710
 
                  edge 1: nodes 1 2   quad. face 1: nodes 1 2 3 4
3711
 
        v              2:       2 3
3712
 
        |              3:       3 4
3713
 
     4--|--3           4:       4 1
3714
 
     |  |  |
3715
 
   -----------u
3716
 
     |  |  |
3717
 
     1--|--2
3718
 
        |
3719
 
@end group
3720
 
@end example
3721
 
 
3722
 
@example
3723
 
@group
3724
 
Tetrahedron:
3725
 
                  edge 1: nodes 1 2
3726
 
   v                   2:       2 3
3727
 
   |                   3:       3 1
3728
 
   |                   4:       4 1
3729
 
   |                   5:       4 3
3730
 
   3                   6:       4 2
3731
 
   |\                
3732
 
   | \
3733
 
   |__\2_____u
3734
 
   1\ /
3735
 
     \4
3736
 
      \
3737
 
       w
3738
 
@end group
3739
 
@end example
3740
 
 
3741
 
@example
3742
 
@group
3743
 
Hexahedron:
3744
 
                  edge 1: nodes 1 2   quad. face 1: nodes 1 2 3 4
3745
 
        v              2:       1 4              2:       1 2 5 6
3746
 
        |              3:       1 5              3:       1 4 5 8
3747
 
        |              4:       2 3              4:       2 3 6 7
3748
 
   4----|--3           5:       2 6              5:       3 4 7 8
3749
 
   |\   |  |\          6:       3 4              6:       5 6 7 8
3750
 
   | 8-------7         7:       3 7
3751
 
   | |   ----|---u     8:       4 8
3752
 
   1-|---\-2 |         9:       5 6
3753
 
    \|    \ \|        10:       5 8
3754
 
     5-----\-6        11:       6 7
3755
 
            \         12:       7 8
3756
 
             w
3757
 
@end group
3758
 
@end example
3759
 
 
3760
 
@example
3761
 
@group
3762
 
Prism:
3763
 
                  edge 1: nodes 1 2   quad. face 1: nodes 1 2 4 5
3764
 
      v                2:       1 3              2:       1 3 4 6
3765
 
    3 |                3:       1 4              3:       2 3 5 6
3766
 
    |\|                4:       2 3
3767
 
    | |                5:       2 5
3768
 
    1_|2               6:       3 6
3769
 
     \| 6              7:       4 5
3770
 
      |_|_\___u        8:       4 6
3771
 
       \|  \           9:       5 6
3772
 
        4 __5
3773
 
         \
3774
 
          \
3775
 
           w
3776
 
@end group
3777
 
@end example
3778
 
 
3779
 
@example
3780
 
@group
3781
 
Pyramid:
3782
 
                  edge 1: nodes 1 2   quad. face 1: nodes 1 2 3 4
3783
 
        v              2        1 4
3784
 
        |              3        1 5
3785
 
        |              4        2 3
3786
 
    4---|---3          5        2 5
3787
 
    | \ |  /|          6        3 4
3788
 
    |  \ -/-|---u      7        3 5
3789
 
    |  / 5\ |          8        4 5
3790
 
    1/----\-2
3791
 
           \
3792
 
            \
3793
 
             w
3794
 
@end group
3795
 
@end example
3796
 
 
3797
3832
@c =========================================================================
3798
3833
@c Programming notes
3799
3834
@c =========================================================================
3803
3838
 
3804
3839
@cindex Programming, notes
3805
3840
 
3806
 
Gmsh was originally written in C, and later enhanced with various C++
3807
 
additions. The resulting code is a hybrid C/C++ beast, hopefully not too
3808
 
badly structured... The scripting language is parsed using Lex and Yacc
3809
 
(actually, Flex and Bison), while the GUI relies on OpenGL for the 3D
3810
 
graphics and FLTK for the widget set. See @uref{http://www.opengl.org},
3811
 
@uref{http://www.mesa3d.org} and @uref{http://www.fltk.org} for more
3812
 
information.
3813
 
 
3814
 
Gmsh's build system is based on autoconf, and should work on most modern
3815
 
platforms providing standard compliant C and C++ compilers. Practical
3816
 
notes on how to compile Gmsh's source code are included in the
3817
 
distribution. See @ref{Frequently asked questions}, for more
3818
 
information.
 
3841
Gmsh is written in C++, the scripting language is parsed using Lex and
 
3842
Yacc (actually, Flex and Bison), and the GUI relies on OpenGL for the 3D
 
3843
graphics and FLTK (@uref{http://www.fltk.org}) for the widget
 
3844
set. Gmsh's build system is based on autoconf. Practical notes on how to
 
3845
compile Gmsh's source code are included in the distribution. See
 
3846
@ref{Frequently asked questions}, for more information.
3819
3847
 
3820
3848
@menu
 
3849
* Main code structure::         
3821
3850
* Coding style::                
3822
3851
* Option handling::             
3823
3852
@end menu
3824
3853
 
3825
3854
@c -------------------------------------------------------------------------
 
3855
@c Main code structure
 
3856
@c -------------------------------------------------------------------------
 
3857
 
 
3858
@node Main code structure, Coding style, Programming notes, Programming notes
 
3859
@section Main code structure
 
3860
 
 
3861
Gmsh's code is structured in several libraries, roughly separated
 
3862
between the three main core modules (Geo, Mesh, Post) and associated
 
3863
utility libraries (Common, Numeric) on one hand, and graphics (Graphics)
 
3864
and interface (Fltk, Box) libraries on the other.
 
3865
 
 
3866
The geometry and mesh modules are based on an object-oriented model
 
3867
class (Geo/GModel.h), built upon abstract geometrical entity classes
 
3868
(Geo/GVertex.h, Geo/Gedge.h, Geo/GFace.h and Geo/GRegion.h).
 
3869
 
 
3870
@c -------------------------------------------------------------------------
3826
3871
@c Coding style
3827
3872
@c -------------------------------------------------------------------------
3828
3873
 
3829
 
@node Coding style, Option handling, Programming notes, Programming notes
 
3874
@node Coding style, Option handling, Main code structure, Programming notes
3830
3875
@section Coding style
3831
3876
 
3832
3877
If you plan to contribute code to the Gmsh project, here are some easy rules
3853
3898
 
3854
3899
@enumerate
3855
3900
@item
3856
 
create the option in the @code{Context_T} class (@file{Common/Context.h}) if
3857
 
it's a classical option, or in the @code{Post_View} class
3858
 
(@file{Common/View.h}) if it's a post-processing view-dependent option;
 
3901
create the option in the @code{Context_T} class
 
3902
(@file{Common/Context.h}) if it's a classical option, or in the
 
3903
@code{PViewOptions} class (@file{Post/PViewOptions.h}) if it's a
 
3904
post-processing view-dependent option;
3859
3905
@item
3860
3906
in @file{Common/DefaultOptions.h}, give a name (for the parser to be able to
3861
3907
access it), a reference to a handling routine (i.e. @code{opt_XXX}) and a
3873
3919
 
3874
3920
@c todo:
3875
3921
@c Tools to check memory leaks
 
3922
@c * on mac: use GMALLOC
 
3923
@c   (gdb) set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib
3876
3924
@c * LIBNJAMD
3877
3925
@c   export LD_PRELOAD=libnjamd.so
3878
3926
@c   kill -USR1
3972
4020
directly. For example, @code{info gmsh surfaces} or @code{info gmsh surf}
3973
4021
will take you directly to @ref{Surfaces}.
3974
4022
@item
3975
 
Use emacs to edit your files, and load the C++ mode! This permits automatic
 
4023
Use emacs to edit your files, and load the C++ mode. This permits automatic
3976
4024
syntax highlighting and easy indentation. Automatic loading of the C++ mode
3977
4025
for @file{.geo} files can be achieved by adding the following command in
3978
4026
your @code{.emacs} file: @code{(setq auto-mode-alist (append '(("\\.geo$"