smsh.5 (3390B)
1 .\" Copyright (C) 2020-2023, 2025, 2025 |Méso|Star> (contact@meso-star.com) 2 .\" 3 .\" This program is free software: you can redistribute it and/or modify 4 .\" it under the terms of the GNU General Public License as published by 5 .\" the Free Software Foundation, either version 3 of the License, or 6 .\" (at your option) any later version. 7 .\" 8 .\" This program is distributed in the hope that it will be useful, 9 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of 10 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 .\" GNU General Public License for more details. 12 .\" 13 .\" You should have received a copy of the GNU General Public License 14 .\" along with this program. If not, see <http://www.gnu.org/licenses/>. 15 .Dd July 26, 2023 16 .Dt SMSH 5 17 .Os 18 .Sh NAME 19 .Nm smsh 20 .Nd Star-Mesh file format 21 .Sh DESCRIPTION 22 .Nm 23 is a binary file format that describes an indexed mesh 24 .Pq surface or volume . 25 Only the geometric data of the mesh is stored; no additional properties are 26 attached to its nodes or cells. 27 .Pp 28 A 29 .Nm 30 file begins with a header that describes the layout of the data, followed by 31 the geometric data itself, i.e. the list of nodes and the list of cells. 32 .Pp 33 The header consists of 5 integers. 34 The first integer is a power of two 35 .Pq usually 4096 36 that defines the size of the memory page in bytes 37 .Pq Va pagesize 38 on which the list of nodes and the list of cells are aligned. 39 By aligning data to 40 .Va pagesize , 41 and depending on system requirements, memory mapping can be used to 42 automatically load/unload pages on demand 43 .Pq see Xr mmap 2 . 44 The remaining integers store the number of nodes 45 .Pq Va #nodes 46 and the number of cells 47 .Pq Va #cells , 48 followed by the size of a node 49 .Pq Va dimnode 50 and the size of a cell 51 .Pq Va dimcell , 52 respectively. 53 .Pp 54 Fill bytes follow the file header to align nodes to 55 .Va pagesize . 56 The nodes are then listed with a list of 57 .Va #nodes dimnode 58 double-precision floating-point numbers per node, where 59 .Va #nodes 60 is the number 61 of mesh nodes and 62 .Va dimnode 63 is the number of floating-point numbers per node. 64 Additional fill bytes are added after the node list to align the list of 65 upcoming cells to 66 .Va pagesize . 67 The cells are then listed using 68 .Va dimcell 69 64-bit unsigned integers per node where each 70 integer indexes a node in the previously defined list of nodes 71 .Pq indexing starts at 0 . 72 Finally, fill bytes are added to align the overall file size to 73 .Va pagesize . 74 .Pp 75 Data are encoded with respect to the little endian bytes ordering, i.e. least 76 significant bytes are stored first. 77 .Pp 78 The file format is as follows: 79 .Bl -column (pagesize) (::=) () 80 .It Ao Va smsh Ac Ta ::= Ta Ao Va pagesize Ac Ao Va #nodes Ac Ao Va #cells Ac Ao Va dimnode Ac Ao Va dimcel Ac 81 .It Ta Ta Aq Va padding 82 .It Ta Ta Aq Va nodes 83 .It Ta Ta Aq Va padding 84 .It Ta Ta Aq Va cells 85 .It Ta Ta Aq Va padding 86 .It Ao Va pagesize Ac Ta ::= Ta Vt uint64_t 87 .It Ao Va #nodes Ac Ta ::= Ta Vt uint64_t 88 .It Ao Va #cells Ac Ta ::= Ta Vt uint64_t 89 .It Ao Va dimnode Ac Ta ::= Ta Vt uint32_t 90 .It Ao Va dimcell Ac Ta ::= Ta Vt uint32_t 91 .It \ Ta Ta 92 .It Ao Va padding Ac Ta ::= Ta Op Vt int8_t ... 93 # Ensure alignment on 94 .Va pagesize 95 .It \ Ta Ta 96 .It Ao Va nodes Ac Ta ::= Ta Ao Va node-pos Ac Va ... 97 .It Ao Va cells Ac Ta ::= Ta Ao Va cell-ids Ac Va ... 98 .It Ao Va node-pos Ac Ta ::= Ta Vt double ... 99 .It Ao Va cell-ids Ac Ta ::= Ta Vt uint64_t ... 100 .El 101 .Sh SEE ALSO 102 .Xr mmap 2