We present some examples of meshes writing. The format is the Gamma Mesh Format (GMF) and follow the
libMeshb format. More information about this format can be found at:
https://github.com/LoicMarechal/libMeshb
and in the user guide of ViZiR 4.
To sum up, a mesh file is composed of:
A mesh file version
The dimension (2 or 3)
The vertices: the number of points and the list of vertices (the coordinates x, y, z if 3D and
an integer
reference)
For each type of element: the number of given elements, the connectivity (the number of indexes
depends on the element type) and an integer reference
The ordering is optional and can be given (otherwise a standard ordering is taken into account).
Here is an example of triangular mesh. Note that the dimension is two, then only the coordinates x and y
are given with an integer reference (here equal to 1). The connectivity of the triangle is 1, 2, 3 and
its reference 1.
Here is an example of quadrilateral mesh. The dimension is 3. For each vertex, the coordinates (x, y, z)
are given with an integer reference here equal to 1. The quadrilateral element is defined by its
connectivity here 1, 2, 3 and 4 and a reference integer equal to 1.
We present how to render different solutions on a simple triangle. The mesh file is given below and
is composed of
the unit triangle. On the same triangle, 3 solutions are defined hereafter:
A P0 solution (i.e. constant) with the keyword SolAtTriangles.
A P1 solution (i.e. affine) with the keyword SolAtVertices.
A P3 solution (i.e. of degree 3) with the keyword
HOSolAtTrianglesP1.
If we want to use Gauss Lobatto points of degree 3 in a quadrilateral,
where 16 degrees of freedom (see the figure below) are introduced, the keyword
HOSolAtQuadrilateralsQ1NodesPositions is
used.
Using the libMeshb
library to write meshes/solutions is by far the best way (in term of performance in
particular).
In the github of the library, there is an examples directory with several examples to write meshes (some in
C,
others in Fortran).
Have a look at the gitlab of cgns2meshb, a tool to
convert CGNS files to GMF (i.e. .mesh[b], .sol[b]), can be useful as
there
are functions to write meshes and solutions using the libMeshb library.