FREEFEM++_MSH_IO
Read and Write FreeFem++ MSH files
FREEFEM++_MSH_IO,
a FORTRAN90 library which
can read and write files used by the FreeFem++ finite element program
to store mesh information.
Note that the GMSH program creates mesh files that use the ".msh"
extension, but which are an entirely different format.
The msh file format is obliquely described in section 12.5 of the
FreeFem++ documentation.
At least for the 2D case of a triangular mesh, the format seems
to be as follows:

a single line giving NV, NE, NT, the number of vertices, boundary edges, and triangles

NV lines, each containing the (X,Y) coordinates and integer label for a node.

NT lines, each containing three vertex indices and integer label for a triangle.

NE lines, each containing two vertex indices and integer label for a boundary edge.
The "labels" seem to be "0" for interior objects and 1 for boundary objects.
All edges are boundary objects. (This might not be true. A geometry
might include internal edges, and perhaps these count as interior objects,
but definitely, the edge list does not include arbitrary triangle edges,
only those on the boundary.) All triangles are interior objects.
Vertices may be boundary or interior objects.
Licensing:
The computer code and data files made available on this
web page are distributed under
the GNU LGPL license.
Languages:
FREEFEM++_MSH_IO is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
BAMG,
examples which
illustrate the use of BAMG,
a program for generating 2D meshes that can be used to
define the geometry for the the finite element package FREEFEM++.
FREEFEM++,
examples which
illustrate the use of the FREEFEM++ package,
a highlevel integrated development environment for the numerical
solution of nonlinear multiphysics partial differential equations (PDE's)
in 2D and 3D.
FREEFEM++_MSH,
a data directory which
contains examples of the mesh files created by the FreeFem++ program,
which use the extension ".msh".
MITCHELL_FREEFEM++,
examples which
illustrate the implementation of the Mitchell 2D elliptic
partial differential equation (PDE) test problems using FREEFEM++.
Reference:

Frederic Hecht,
New development in FreeFem++,
Journal of Numerical Mathematics,
Volume 20, Number 34, 2012, pages 251265.

Frederic Hecht,
BAMG: Bidimensional Anisotropic Mesh Generator,
draft version v1.00, December 2006.
Source Code:
Examples and Tests:
List of Routines:

GET_UNIT returns a free FORTRAN unit number.

FFMSH_2D_DATA_EXAMPLE returns example FFMSH data.

FFMSH_2D_DATA_PRINT prints FFMSH data.

FFMSH_2D_DATA_READ reads data from an FFMSH file.

FFMSH_2D_SIZE_EXAMPLE returns sizes for the 2D example.

FFMSH_2D_SIZE_PRINT prints the sizes of an FFMSH.

FFMSH_2D_SIZE_READ reads sizes from a FFMSH file.

FFMSH_2D_WRITE writes FFMSH data to a file.

I4MAT_COPY copies an I4MAT.

I4MAT_TRANSPOSE_PRINT prints an I4MAT, transposed.

I4MAT_TRANSPOSE_PRINT_SOME prints some of the transpose of an I4MAT.

I4VEC_COPY copies an I4VEC.

I4VEC_PRINT prints an I4VEC.

MESH_BASE_ONE ensures that the element definition is onebased.

R8MAT_COPY copies an R8MAT.

R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed.

R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed.

S_TO_I4 reads an I4 from a string.

S_TO_R8 reads an R8 from a string.

TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the FORTRAN90 source codes.
Last revised on 20 December 2014.