msh格式解析

来源:互联网 发布:电子笔记 知乎 编辑:程序博客网 时间:2024/06/05 17:37


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

$MeshFormatversion-number file-type data-size$EndMeshFormat$PhysicalNamesnumber-of-namesphysical-dimension physical-number "physical-name"…$EndPhysicalNames$Nodesnumber-of-nodesnode-number x-coord y-coord z-coord…$EndNodes$Elementsnumber-of-elementselm-number elm-type number-of-tags < tag > … node-number-list…$EndElements$Periodicnumber-of-periodic-entitiesdimension slave-entity-tag master-entity-tagnumber-of-nodesslave-node-number master-node-number…$EndPeriodic$NodeDatanumber-of-string-tags< "string-tag" >…number-of-real-tags< real-tag >…number-of-integer-tags< integer-tag >…node-number value ……$EndNodeData$ElementDatanumber-of-string-tags< "string-tag" >…number-of-real-tags< real-tag >…number-of-integer-tags< integer-tag >…elm-number value ……$EndElementData$ElementNodeDatanumber-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-topologieselm-topologynumber-of-interpolation-matricesnum-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:
$MeshFormat2.2 0 8$EndMeshFormat$Nodes6                      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.05 2.0 0.0 0.06 2.0 1.0 0.0$EndNodes$Elements2                      two elements:1 3 2 99 2 1 2 3 4       quad #1: type 3, physical 99, elementary 2, nodes 1 2 3 42 3 2 99 2 2 5 6 3       quad #2: type 3, physical 99, elementary 2, nodes 2 5 6 3$EndElements $NodeData1                      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) field6                        six associated nodal values1 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.05 0.26 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:       v3----------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    |    110----------.'--|-3    `.     0--------6-.'----3    `.     0--------6-.'----3    `. `\        |   |  `\    \      `\        |      `\    \     `\        |      `\    \   `\     .'   +----`\ - \ -> v  `5     .'        10   \      `5     .' 13     10   \     `\   |    `\     `\  \        `\   |           `\  \       `\   |           `\  \        `\.'      `\     `\`          `\.'             `\`         `\.'             `\`           1----------------2            1--------8-------2           1--------8-------2                    `\                       u



0 0
原创粉丝点击