msh格式解析


参考自http://geuz.org/gmsh/doc/texinfo/gmsh.html#MSH-binary-file-format

$MeshFormat
version-number file-type data-size
$EndMeshFormat
$PhysicalNames
number-of-names
physical-dimension physical-number "physical-name"
…
$EndPhysicalNames
$Nodes
number-of-nodes
node-number x-coord y-coord z-coord
…
$EndNodes
$Elements
number-of-elements
elm-number elm-type number-of-tags < tag > … node-number-list
…
$EndElements
$Periodic
number-of-periodic-entities
dimension slave-entity-tag master-entity-tag
number-of-nodes
slave-node-number master-node-number
…
$EndPeriodic
$NodeData
number-of-string-tags
< "string-tag" >
…
number-of-real-tags
< real-tag >
…
number-of-integer-tags
< integer-tag >
…
node-number value …
…
$EndNodeData
$ElementData
number-of-string-tags
< "string-tag" >
…
number-of-real-tags
< real-tag >
…
number-of-integer-tags
< integer-tag >
…
elm-number value …
…
$EndElementData
$ElementNodeData
number-of-string-tags
< "string-tag" >
…
number-of-real-tags
< real-tag >
…
number-of-integer-tags
< integer-tag >
…
elm-number number-of-nodes-per-element value …
…
$EndElementNodeData
$InterpolationScheme
"name"
number-of-element-topologies
elm-topology
number-of-interpolation-matrices
num-rows num-columns value …
…
$EndInterpolationScheme
elm-type

defines the geometrical type of the n-th element:

1

2-node line.

2

3-node triangle.

3

4-node quadrangle.

4

4-node tetrahedron.

5

8-node hexahedron.

6

6-node prism.

7

5-node pyramid.

8

3-node second order line (2 nodes associated with the vertices and 1 with the edge).

9

6-node second order triangle (3 nodes associated with the vertices and 3 with the edges).

10

9-node second order quadrangle (4 nodes associated with the vertices, 4 with the edges and 1 with the face).

11

10-node second order tetrahedron (4 nodes associated with the vertices and 6 with the edges).

12

27-node second order hexahedron (8 nodes associated with the vertices, 12 with the edges, 6 with the faces and 1 with the volume).

13

18-node second order prism (6 nodes associated with the vertices, 9 with the edges and 3 with the quadrangular faces).

14

14-node second order pyramid (5 nodes associated with the vertices, 8 with the edges and 1 with the quadrangular face).

15

1-node point.

16

8-node second order quadrangle (4 nodes associated with the vertices and 4 with the edges).

17

20-node second order hexahedron (8 nodes associated with the vertices and 12 with the edges).

18

15-node second order prism (6 nodes associated with the vertices and 9 with the edges).

19

13-node second order pyramid (5 nodes associated with the vertices and 8 with the edges).

20

9-node third order incomplete triangle (3 nodes associated with the vertices, 6 with the edges)

21

10-node third order triangle (3 nodes associated with the vertices, 6 with the edges, 1 with the face)

22

12-node fourth order incomplete triangle (3 nodes associated with the vertices, 9 with the edges)

23

15-node fourth order triangle (3 nodes associated with the vertices, 9 with the edges, 3 with the face)

24

15-node fifth order incomplete triangle (3 nodes associated with the vertices, 12 with the edges)

25

21-node fifth order complete triangle (3 nodes associated with the vertices, 12 with the edges, 6 with the face)

26

4-node third order edge (2 nodes associated with the vertices, 2 internal to the edge)

27

5-node fourth order edge (2 nodes associated with the vertices, 3 internal to the edge)

28

6-node fifth order edge (2 nodes associated with the vertices, 4 internal to the edge)

29

20-node third order tetrahedron (4 nodes associated with the vertices, 12 with the edges, 4 with the faces)

30

35-node fourth order tetrahedron (4 nodes associated with the vertices, 18 with the edges, 12 with the faces, 1 in the volume)

31

56-node fifth order tetrahedron (4 nodes associated with the vertices, 24 with the edges, 24 with the faces, 4 in the volume)

92

64-node third order hexahedron (8 nodes associated with the vertices, 24 with the edges, 24 with the faces, 8 in the volume)

93

125-node fourth order hexahedron (8 nodes associated with the vertices, 36 with the edges, 54 with the faces, 27 in the volume)

example:
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
6                      six mesh nodes:
1 0.0 0.0 0.0            node #1: coordinates (0.0, 0.0, 0.0)
2 1.0 0.0 0.0            node #2: coordinates (1.0, 0.0, 0.0)
3 1.0 1.0 0.0            etc.
4 0.0 1.0 0.0
5 2.0 0.0 0.0
6 2.0 1.0 0.0
$EndNodes
$Elements
2                      two elements:
1 3 2 99 2 1 2 3 4       quad #1: type 3, physical 99, elementary 2, nodes 1 2 3 4
2 3 2 99 2 2 5 6 3       quad #2: type 3, physical 99, elementary 2, nodes 2 5 6 3
$EndElements 
$NodeData
1                      one string tag:
"A scalar view"          the name of the view ("A scalar view")
1                      one real tag:
0.0                      the time value (0.0)
3                      three integer tags:
0                        the time step (0; time steps always start at 0)
1                        1-component (scalar) field
6                        six associated nodal values
1 0.0                  value associated with node #1 (0.0)
2 0.1                  value associated with node #2 (0.1)
3 0.2                  etc.
4 0.0
5 0.2
6 0.4
$EndNodeData 

当element为这种形式:
207 5 2 1 1 820 1201 856 316 1161 1204 1203 833
意为,第207个element,5:六面体,2 1 1 暂时我没有管,后面为六面体的八个顶点

顶点顺序:
Hexahedron:             Hexahedron20:          Hexahedron27:

       v
3----------2            3----13----2           3----13----2     
|\     ^   |\           |\         |\          |\         |\    
| \    |   | \          | 15       | 14        |15    24  | 14  
|  \   |   |  \         9  \       11 \        9  \ 20    11 \  
|   7------+---6        |   7----19+---6       |   7----19+---6 
|   |  +-- |-- | -> u   |   |      |   |       |22 |  26  | 23| 
0---+---\--1   |        0---+-8----1   |       0---+-8----1   | 
 \  |    \  \  |         \  17      \  18       \ 17    25 \  18
  \ |     \  \ |         10 |        12|        10 |  21    12| 
   \|      w  \|           \|         \|          \|         \| 
    4----------5            4----16----5           4----16----5 


再如:

3485 14 2 1 1 410 405 409 402 588 436 448 1355 439 1230 444 906 993 449

意为,第3485个element,14:四棱锥,2 1 1 暂时我没有管,后面5个为四棱锥的八个顶点,在后面8个为四棱锥的八条边,最后一个为底面

Pyramid:                     Pyramid13:                   Pyramid14:

               4                            4                            4
             ,/|\                         ,/|\                         ,/|\
           ,/ .'|\                      ,/ .'|\                      ,/ .'|\
         ,/   | | \                   ,/   | | \                   ,/   | | \
       ,/    .' | `.                ,/    .' | `.                ,/    .' | `.
     ,/      |  '.  \             ,7      |  12  \             ,7      |  12  \
   ,/       .' w |   \          ,/       .'   |   \          ,/       .'   |   \
 ,/         |  ^ |    \       ,/         9    |    11      ,/         9    |    11
0----------.'--|-3    `.     0--------6-.'----3    `.     0--------6-.'----3    `.
 `\        |   |  `\    \      `\        |      `\    \     `\        |      `\    \
   `\     .'   +----`\ - \ -> v  `5     .'        10   \      `5     .' 13     10   \
     `\   |    `\     `\  \        `\   |           `\  \       `\   |           `\  \ 
       `\.'      `\     `\`          `\.'             `\`         `\.'             `\` 
          1----------------2            1--------8-------2           1--------8-------2
                    `\
                       u



  • 3
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值