[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter describes the file formats that cannot be modified by the user. These formats have a version number (currently 1.2), independent of the Gmsh version number (currently 1.52).
All non-parsed file formats have sections enclosed between $KEY
and
$ENDKEY
tags.
9.1 Gmsh mesh file format 9.2 Gmsh ASCII post-processing file format 9.3 Gmsh binary post-processing file format 9.4 Gmsh parsed post-processing file format 9.5 Gmsh node ordering
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.1.1 Version 1.0 9.1.2 Version 2.0
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The `.msh' file format, version 1.0, is Gmsh's old native mesh file format, now superseeded by the format described in 9.1.2 Version 2.0.
In the `.msh' file format, version 1.0, the file is divided in two
sections, defining the nodes ($NOD
-$ENDNOD
) and the elements
($ELM
-$ENDELM
) in the mesh:
$NOD number-of-nodes node-number x-coord y-coord z-coord ... $ENDNOD $ELM number-of-elements elm-number elm-type reg-phys reg-elem number-of-nodes node-number-list ... $ENDELM |
where
number-of-nodes
node-number
x-coord y-coord z-coord
number-of-elements
elm-number
elm-type
1
2
3
4
5
6
7
8
9
11
15
reg-phys
reg-elem
number-of-nodes
node-number-list
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Version 2.0 of the `.msh' file format is Gmsh's new native mesh file format. It is very similar to the old one (see section 9.1.1 Version 1.0), but is more general: it contains information about itself and allows to associate an arbitrary number of integer tags with each element.
The `.msh' file format, version 2.0, is divided in three sections,
defining the file format ($MeshFormat
-$EndMeshFormat
), the
nodes ($Nodes
-$EndNodes
) and the elements
($Elements
-$EndElements
) in the mesh:
$MeshFormat 2.0 file-type data-size $EndMeshFormat $Nodes number-of-nodes node-number x-coord y-coord z-coord ... $EndNodes $Elements number-of-elements elm-number elm-type number-of-tags < tag > ... node-number-list ... $EndElements |
where
file-type
data-size
number-of-nodes
node-number
x-coord y-coord z-coord
number-of-elements
elm-number
elm-type
1
2
3
4
5
6
7
8
9
11
15
number-of-tags
tag
node-number-list
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The ASCII post-processing file is divided in several sections: one format
section, enclosed between $PostFormat
-$EndPostFormat
tags, and
one or more post-processing views, enclosed between
$View
-$EndView
tags:
$PostFormat 1.2 file-type data-size $EndPostFormat $View view-name nb-time-steps nb-scalar-points nb-vector-points nb-tensor-points nb-scalar-lines nb-vector-lines nb-tensor-lines nb-scalar-triangles nb-vector-triangles nb-tensor-triangles nb-scalar-quadrangles nb-vector-quadrangles nb-tensor-quadrangles nb-scalar-tetrahedra nb-vector-tetrahedra nb-tensor-tetrahedra nb-scalar-hexahedra nb-vector-hexahedra nb-tensor-hexahedra nb-scalar-prisms nb-vector-prisms nb-tensor-prisms nb-scalar-pyramids nb-vector-pyramids nb-tensor-pyramids nb-text2d nb-text2d-chars nb-text3d nb-text3d-chars time-step-values < scalar-point-value > ... < vector-point-value > ... < tensor-point-value > ... < scalar-line-value > ... < vector-line-value > ... < tensor-line-value > ... < scalar-triangle-value > ... < vector-triangle-value > ... < tensor-triangle-value > ... < scalar-quadrangle-value > ... < vector-quadrangle-value > ... < tensor-quadrangle-value > ... < scalar-tetrahedron-value > ... < vector-tetrahedron-value > ... < tensor-tetrahedron-value > ... < scalar-hexahedron-value > ... < vector-hexahedron-value > ... < tensor-hexahedron-value > ... < scalar-prism-value > ... < vector-prism-value > ... < tensor-prism-value > ... < scalar-pyramid-value > ... < vector-pyramid-value > ... < tensor-pyramid-value > ... < text2d > ... < text2d-chars > ... < text3d > ... < text3d-chars > ... $EndView |
where
file-type
data-size
view-name
nb-time-steps
nb-scalar-points
nb-vector-points
...
nb-text2d
nb-text3d
nb-text2d-chars
nb-text3d-chars
time-step-values
scalar-point-value
vector-point-value
...
For example, vector-triangle-value is defined as:
coord1-node1 coord1-node2 coord1-node3 coord2-node1 coord2-node2 coord2-node3 coord3-node1 coord3-node2 coord3-node3 comp1-node1-time1 comp2-node1-time1 comp3-node1-time1 comp1-node2-time1 comp2-node2-time1 comp3-node2-time1 comp1-node3-time1 comp2-node3-time1 comp3-node3-time1 comp1-node1-time2 comp2-node1-time2 comp3-node1-time2 comp1-node2-time2 comp2-node2-time2 comp3-node2-time2 comp1-node3-time2 comp2-node3-time2 comp3-node3-time2 ... |
text2d
coord1 coord2 style index |
text2d-chars
^
' character (which is a forbidden character in regular strings).
text3d
coord1 coord2 coord3 style index |
text3d-chars
^
' character.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The binary post-processing file format is the same as the ASCII file format described in 9.2 Gmsh ASCII post-processing file format, except that:
Here is a pseudo C code to write the beginning of a post-processing file in binary format:
int one = 1; fprintf(file, "$PostFormat\n"); fprintf(file, "%g %d %d\n", 1.2, 1, sizeof(double)); fprintf(file, "$EndPostFormat\n"); fprintf(file, "$View\n"); fprintf(file, "%s %d " "%d %d %d " "%d %d %d " "%d %d %d " "%d %d %d " "%d %d %d " "%d %d %d " "%d %d %d " "%d %d %d " "%d %d %d %d\n", view-name, nb-time-steps, nb-scalar-points, nb-vector-points, nb-tensor-points, nb-scalar-lines, nb-vector-lines, nb-tensor-lines, nb-scalar-triangles, nb-vector-triangles, nb-tensor-triangles, nb-scalar-quadrangles, nb-vector-quadrangles, nb-tensor-quadrangles, nb-scalar-tetrahedra, nb-vector-tetrahedra, nb-tensor-tetrahedra, nb-scalar-hexahedra, nb-vector-hexahedra, nb-tensor-hexahedra, nb-scalar-prisms, nb-vector-prisms, nb-tensor-prisms, nb-scalar-pyramids, nb-vector-pyramids, nb-tensor-pyramids, nb-text2d, nb-text2d-chars, nb-text3d, nb-text3d-chars); fwrite(&one, sizeof(int), 1, file); fwrite(time-step-values, sizeof(double), nb-time-steps, file); fwrite(all-scalar-point-values, sizeof(double), ..., file); ... fprintf(file, "\n$EndView\n"); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For relatively small data sets Gmsh provides an additional post-processing format, which is read by Gmsh's script parser. You can thus, for example, embed small post-processing views directly into your geometrical descriptions (see e.g. 7.4 `t4.geo'). This format is also useful for testing purposes: its syntax is very permissive, and you can easily generate it by hand or on the fly. The format of the parsed post-processing file is the following:
View "string" { type ( list-of-coords ) { list-of-values }; ... }; |
The 26 objects that can be displayed are the same as in the ASCII or binary post-processing file formats:
type #list-of-coords #list-of-values ------------------------------------------------------------ scalar point SP 3 1 * nb-time-steps vector point VP 3 3 * nb-time-steps tensor point TP 3 9 * nb-time-steps scalar line SL 6 2 * nb-time-steps vector line VL 6 6 * nb-time-steps tensor line TL 6 18 * nb-time-steps scalar triangle ST 9 3 * nb-time-steps vector triangle VT 9 9 * nb-time-steps tensor triangle TT 9 27 * nb-time-steps scalar quadrangle SQ 12 4 * nb-time-steps vector quadrangle VQ 12 12 * nb-time-steps tensor quadrangle TQ 12 36 * nb-time-steps scalar tetrahedron SS 12 4 * nb-time-steps vector tetrahedron VS 12 12 * nb-time-steps tensor tetrahedron TS 12 36 * nb-time-steps scalar hexahedron SH 24 8 * nb-time-steps vector hexahedron VH 24 24 * nb-time-steps tensor hexahedron TH 24 72 * nb-time-steps scalar prism SI 18 6 * nb-time-steps vector prism VI 18 18 * nb-time-steps tensor prism TI 18 54 * nb-time-steps scalar pyramid SY 15 5 * nb-time-steps vector pyramid VY 15 15 * nb-time-steps tensor pyramid TY 15 45 * nb-time-steps text 2d T2 4 arbitrary text 3d T3 5 arbitrary |
For historical reasons, contrary to the ASCII and binary post-processing file formats, the coordinates are given `by node', i.e.:
(coord1, coord2,coord3)
for a point,
(coord1-node1, coord2-node1, coord3-node1,
coord1-node2, coord2-node2, coord3-node2)
for a line,
(coord1-node1, coord2-node1, coord3-node1,
coord1-node2, coord2-node2, coord3-node2,
coord1-node3, coord2-node3, coord3-node3)
for a triangle,
The values are given in the same order as for the ASCII and binary post-processing file formats.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For all mesh and post-processing file formats, the reference elements are defined as follows:
Point: v | | -----1-----u | | |
Line: edge 1: nodes 1 -> 2 v | | --1-----2--u | | |
Triangle: edge 1: nodes 1 -> 2 v 2: 2 -> 3 | 3: 3 -> 1 | 3 |\ | \ |__\___u 1 2 |
Quadrangle: edge 1: nodes 1 -> 2 v 2: 2 -> 3 | 3: 3 -> 4 4--|--3 4: 4 -> 1 | | | -----------u | | | 1--|--2 | |
Tetrahedron: edge 1: nodes 1 -> 2 v 2: 2 -> 3 | 3: 3 -> 1 | 4: 4 -> 1 | 5: 4 -> 3 3 6: 4 -> 2 |\ | \ |__\2_____u 1\ / \4 \ w |
Hexahedron: v | | 4----|--3 |\ | |\ | 8-------7 | | ----|---u 1-|---\-2 | \| \ \| 5-----\-6 \ w |
Prism: v 3 | |\| | | 1_|2 \| 6 |_|_\___u \| \ 4 __5 \ \ w |
Pyramid: v | | 4---|---3 | \ | /| | \ -/-|---u | / 5\ | 1/----\-2 \ \ w |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |