Skip to content

MSH File Format

Darren Engwirda edited this page Sep 27, 2019 · 4 revisions

*.msh files are used by JIGSAW to store mesh data. They are intended as a flexible mesh format, and can be used to store both the two- and three-dimensional output meshes generated by JIGSAW itself, as well as any input geometries, structured data sets, etc.

*.msh files are semi-structured text-files, consisting of a series of sections enumerated by keywords. Individual tokens in the file are delimited by semi-colons.

COMMENTS

Comment lines are supported, though only between adjacent file segments. Each file segment is assumed to be contiguous - it is not valid to insert comment lines (or blank lines, for that matter) in the middle of any given file segment.

#   This is a comment line. Only full lines can be comments -- trailing comments are not allowed.

MSHID segment

mshid is an ID-tag for the *.msh file-format that indicates the file-format version and the basic mesh/geometry kind. mesh files describe unstructured data structures, while grid files define structured array types. mshid must be the first keyword found in the file.

    MSHID = 3; euclidean-mesh
    MSHID = 3; euclidean-grid
    MSHID = 3; ellipsoid-mesh
    MSHID = 3; ellipsoid-grid

NDIMS segment

ndims defines the number of "geometric" dimensions the mesh is embedded in. Currently, support for ndims=2 and ndims=3 is provided. ndims must occur before the point segment in the file.

    NDIMS = UINT

RADII segment

radii defines the principal radii for ellipsoid mesh and grid objects.

    RADII = RR11; RR22; RR33

POINT segment

The point segment describes the set of vertex coordinates in for unstructured mesh objects, consisting of n contiguous lines of data. Each entry contains a set of orthogonal coordinates, specified as floating-point numbers, and an integer ID number. point entries are implicitly zero-indexed, based on their line position within the segment.

#   POINT segment for NDIMS=2

    POINT = NROW
    XX_0; YY_0; ID_0
    XX_1; YY_1; ID_1

    ...

    XX_k; YY_k; ID_k
#   POINT segment for NDIMS=3

    POINT = NROW
    XX_0; YY_0; ZZ_O; ID_0
    XX_1; YY_1; ZZ_1; ID_1

    ...

    XX_k; YY_k; ZZ_k; ID_k

EDGE2 segment

The edge2 segment describes the set of 2-node linear edge elements for unstructured mesh objects, consisting of n contiguous lines of data. edge2 elements are topologically 1-dimensional. Each entry contains a set of point indices i1,...,i2, specified as non-negative integers, and an integer ID number. edge2 entries are implicitly zero-indexed, based on their line position within the segment.

#   EDGE2 segment

    EDGE2 = NROW
    I_01; I_02; ID_0
    I_11; I_12; ID_1

    ...

    I_k1; I_k2; ID_k

TRIA3 segment

The tria3 segment describes the set of 3-node linear tria. elements for unstructured mesh objects, consisting of n contiguous lines of data. tria3 elements are topologically 2-dimensional. Each entry contains a set of point indices i1,...,i3, specified as non-negative integers, and an integer ID number. tria3 entries are implicitly zero-indexed, based on their line position within the segment.

#   TRIA3 segment

    TRIA3 = NROW
    I_01; I_02; I_03; ID_0
    I_11; I_12; I_13; ID_1

    ...

    I_k1; I_k2; I_k3; ID_k

TRIA4 segment

The tria4 segment describes the set of 4-node linear tria. elements for unstructured mesh objects, consisting of n contiguous lines of data. tria4 elements are topologically 3-dimensional. Each entry contains a set of point indices i1,...,i4, specified as non-negative integers, and an integer ID number. tria4 entries are implicitly zero-indexed, based on their line position within the segment.

#   TRIA4 segment

    TRIA4 = NROW
    I_01; I_02; I_03; I_04; ID_0
    I_11; I_12; I_13; I_14; ID_1

    ...

    I_k1; I_k2; I_k3; I_k4; ID_k

BOUND segment

The bound segment describes an (optional) set of boundary definitions for unstructured mesh objects, indicating how elements in the geometry are associated with various enclosed areas/volumes, herein known as "parts". bound(:,1) is an array of "part" ID tags, bound(:,2) is an array of element numbering and bound(:,3) is an array of element "tags", describing which element "kind" is numbered via bound(:,2). Element tags are defined via a series of constants defined in jigsaw_const.h. In the default case, where bound is not specified, all elements in the geometry are assumed to define the boundaries of enclosed "parts".

#   BOUND segment

    BOUND = NROW
    ID_0; II_0; ET_0
    ID_1; II_1; ET_1

    ...

    ID_k; II_k; ET_k

COORD segment

The coord segment describes the spatial discretisation for structured grid objects, consisting of n contiguous lines of data. coord segments must define a monotonically vector of coordinates, to be applied in the equivalent x, y or z axis directions (axis = 1,2,3) of a structured grid.

#   COORD segment

    COORD = AXIS; NROW
    X_0
    X_1

    ...

    X_k

VALUE segment

The value segment describes a set of floating-point "function values" associated with the vertices of unstructured mesh or structured grid objects. The value segment consists of n contiguous lines of data. Each value entry contains a set of m floating-point values v1,...,vm associated with a given vertex. Typically, m = 1. The k-th line of data is associated with the k-th vertex in the mesh/grid object. The vertices of structured grid objects are labeled in column-wise order.

#   VALUE segment

    VALUE = NROW; NVAL
    V_00; V_01; ...; V_0m
    V_10; V_11; ...; V_1m

    ...

    V_k0; V_k1; ...; V_km

SLOPE segment

The slope segment describes a set of floating-point "gradient-limits" associated with the vertices of unstructured mesh or structured grid objects. The slope segment consists of n contiguous lines of data. Each slope entry contains a set of m floating-point values g1,...,gm associated with a given vertex. Typically, m = 1. The k-th line of data is associated with the k-th vertex in the mesh/grid object. The vertices of structured grid objects are labeled in column-wise order.

#   SLOPE segment

    SLOPE = NROW; NVAL
    G_00; G_01; ...; G_0m
    G_10; G_11; ...; G_1m

    ...

    G_k0; G_k1; ...; G_km

POWER segment

The power segment describes a set of floating-point "weights" associated with the vertices of "regular" tessellations. The power segment consists of n contiguous lines of data. Each power entry contains a set of m floating-point values p1,...,pm associated with a given vertex. Typically, m = 1. The k-th line of data is associated with the k-th vertex in the mesh object.

#   POWER segment

    POWER = NROW; NPWR
    P_00; P_01; ...; P_0m
    P_10; P_11; ...; P_1m

    ...

    P_k0; P_k1; ...; P_km