SMSH(5) | File Formats Manual | SMSH(5) |
NAME
smsh
— Star-Mesh
file format
DESCRIPTION
smsh
is a binary file format that
describes an indexed mesh (surface or volume). Only the geometric data of
the mesh is stored; no additional properties are attached to its nodes or
cells.
A smsh
file begins with a header that
describes the layout of the data, followed by the geometric data itself,
i.e. the list of nodes and the list of cells.
The header consists of 5 integers. The first integer is a power of two (usually 4096) that defines the size of the memory page in bytes (pagesize) on which the list of nodes and the list of cells are aligned. By aligning data to pagesize, and depending on system requirements, memory mapping can be used to automatically load/unload pages on demand (see mmap(2)). The remaining integers store the number of nodes (#nodes) and the number of cells (#cells), followed by the size of a node (dimnode) and the size of a cell (dimcell), respectively.
Fill bytes follow the file header to align nodes to pagesize. The nodes are then listed with a list of #nodes dimnode double-precision floating-point numbers per node, where #nodes is the number of mesh nodes and dimnode is the number of floating-point numbers per node. Additional fill bytes are added after the node list to align the list of upcoming cells to pagesize. The cells are then listed using dimcell 64-bit unsigned integers per node where each integer indexes a node in the previously defined list of nodes (indexing starts at 0). Finally, fill bytes are added to align the overall file size to pagesize.
Data are encoded with respect to the little endian bytes ordering, i.e. least significant bytes are stored first.
The file format is as follows:
⟨smsh⟩ | ::= | ⟨pagesize⟩ ⟨#nodes⟩ ⟨#cells⟩ ⟨dimnode⟩ ⟨dimcel⟩ |
⟨padding⟩ | ||
⟨nodes⟩ | ||
⟨padding⟩ | ||
⟨cells⟩ | ||
⟨padding⟩ | ||
⟨pagesize⟩ | ::= | uint64_t |
⟨#nodes⟩ | ::= | uint64_t |
⟨#cells⟩ | ::= | uint64_t |
⟨dimnode⟩ | ::= | uint32_t |
⟨dimcell⟩ | ::= | uint32_t |
⟨padding⟩ | ::= | [int8_t ...] # Ensure alignment on pagesize |
⟨nodes⟩ | ::= | ⟨node-pos⟩ ... |
⟨cells⟩ | ::= | ⟨cell-ids⟩ ... |
⟨node-pos⟩ | ::= | double ... |
⟨cell-ids⟩ | ::= | uint64_t ... |
SEE ALSO
July 26, 2023 | UNIX |