错误报告
可以修复吗?
我已经安装了最新版本的gmsh
v4.5.6 (http://gmsh.info/) 我正在尝试从luamesh
包中使用 MWE。我正在使用位于子文件夹中的 2017-02-09 包 v 0.5中的maillage.geo
和文件。maillage.msh
luamesh
/texlive/2020/texmf-dist/doc/lualatex/luamesh/
我使用的luamplib
是 2020-02-24 的 v2.20.5。TeXLive 2020,Xubuntu 18.04。
此代码运行良好:
\documentclass{article}
\usepackage{luamesh}
\begin{document}
\drawGmsh[tikz]{maillage.msh}
\end{document}
此代码未生成预期的 PDF 文件:
\documentclass{article}
\usepackage{luamesh}
\begin{document}
\drawGmsh{maillage.msh}
\end{document}
该文件的格式maillage.msh
为版本 2 ASCII。如果我们尝试msh
以版本 4 ASCII(默认选项)导出,则这两个示例都不起作用。
概括
版本 2 ASCII [tikz]
:一切运行良好。
版本 2 ASCII 不包含[tikz]
:
! Undefined control sequence.
\\drawGmsh ...eshvaldg@color ")}\else \mplibcolor
{\luameshmpcolor }{\luames...
l.4 \drawGmsh{maillage-version2.msh}
版本 4 ASCII 具有[tikz]
:
luamesh/luamesh.lua:534: attempt to perform arithmetic on a nil value (field '?
')
stack traceback:
...pivo/texlive/2020/texmf-dist/scripts/luamesh/luamesh.lua:534: in function '
readGmsh'
.../texlive/2020/texmf-dist/scripts/luamesh/luamesh-tex.lua:767: in function '
drawGmshTikZ'
[\directlua]:1: in main chunk.
\\drawGmsh ...ldg@scale ","\luameshvaldg@color ")}
\else \mplibcolor {\luames...
l.4 \drawGmsh[tikz]{maillage-version4.msh}
版本 4 ASCII 不带[tikz]
:
! Undefined control sequence.
\\drawGmsh ...eshvaldg@color ")}\else \mplibcolor
{\luameshmpcolor }{\luames...
l.4 \drawGmsh{maillage-version4.msh}
(maillage-version2.msh
与最后几位小数略有不同maillage.msh
,但结构相同):
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
49
1 0 0 0
2 3 0 0
3 0 3 0
4 0.4693033963404087 2.963065021592229 0
5 0.927050985688588 2.853169548052449 0
6 1.361971502971016 2.673019570653173 0
7 1.763355761304841 2.427050979908132 0
8 2.121320348549485 2.121320338569801 0
9 2.427050986323072 1.763355752475434 0
10 2.673019574643209 1.361971495140128 0
11 2.853169549732512 0.9270509805178855 0
12 2.963065021991164 0.4693033938216338 0
13 0 0.499999999997822 0
14 0 0.9999999999960245 0
15 0 1.499999999994285 0
16 0 1.999999999996158 0
17 0 2.499999999998079 0
18 2.500000000003167 0 0
19 2.000000000001941 0 0
20 1.500000000004168 0 0
21 1.00000000000281 0 0
22 0.5000000000014051 0 0
23 0.4324208618787972 1.254526258340053 0
24 1.964179242223375 1.677567546495472 0
25 1.277646354647664 0.4113155914951311 0
26 1.331385884279466 2.208153696956179 0
27 2.408333487391826 0.9570142841403682 0
28 0.4806120485258751 2.21192748111512 0
29 2.199842564949955 0.4740583806850691 0
30 0.4383482110825652 1.744285474319584 0
31 0.8583628800522819 1.500701899336962 0
32 0.8225535882961561 0.9953960076673578 0
33 1.281083415964582 1.237393204562323 0
34 0.8915779045171567 1.969788703743087 0
35 0.4204627438899584 0.7566691502573124 0
36 1.736929708778206 0.4257397652798222 0
37 1.278622231642468 1.746395721121067 0
38 1.524726655147985 0.8206048256661349 0
39 1.76486136704753 1.246517525545464 0
40 0.7904684345601101 0.4733411038827577 0
41 0.9693508624533295 2.418048746306837 0
42 1.982120034150953 0.8846091911536498 0
43 1.677597399498234 1.959155701651377 0
44 2.21890810757101 1.334757699095549 0
45 2.584882124813725 0.5654854078329913 0
46 0.5692634586016403 2.589242159412943 0
47 0.3706919352530829 0.3706919352521562 0
48 1.606720928989769 1.574445926857611 0
49 1.141924419829695 0.779315042507347 0
$EndNodes
$Elements
99
1 15 2 0 1 1
2 15 2 0 2 2
3 15 2 0 3 3
4 1 2 0 1 3 4
5 1 2 0 1 4 5
6 1 2 0 1 5 6
7 1 2 0 1 6 7
8 1 2 0 1 7 8
9 1 2 0 1 8 9
10 1 2 0 1 9 10
11 1 2 0 1 10 11
12 1 2 0 1 11 12
13 1 2 0 1 12 2
14 1 2 0 2 1 13
15 1 2 0 2 13 14
16 1 2 0 2 14 15
17 1 2 0 2 15 16
18 1 2 0 2 16 17
19 1 2 0 2 17 3
20 1 2 0 3 2 18
21 1 2 0 3 18 19
22 1 2 0 3 19 20
23 1 2 0 3 20 21
24 1 2 0 3 21 22
25 1 2 0 3 22 1
26 2 2 0 6 17 4 46
27 2 2 0 6 12 18 45
28 2 2 0 6 12 2 18
29 2 2 0 6 3 4 17
30 2 2 0 6 42 39 44
31 2 2 0 6 27 42 44
32 2 2 0 6 28 17 46
33 2 2 0 6 18 29 45
34 2 2 0 6 35 32 40
35 2 2 0 6 27 29 42
36 2 2 0 6 40 32 49
37 2 2 0 6 34 28 41
38 2 2 0 6 34 26 37
39 2 2 0 6 29 27 45
40 2 2 0 6 23 30 31
41 2 2 0 6 23 15 30
42 2 2 0 6 13 14 35
43 2 2 0 6 30 28 34
44 2 2 0 6 41 28 46
45 2 2 0 6 29 19 36
46 2 2 0 6 31 30 34
47 2 2 0 6 16 28 30
48 2 2 0 6 16 17 28
49 2 2 0 6 18 19 29
50 2 2 0 6 14 23 35
51 2 2 0 6 20 25 36
52 2 2 0 6 32 31 33
53 2 2 0 6 14 15 23
54 2 2 0 6 37 26 43
55 2 2 0 6 23 31 32
56 2 2 0 6 19 20 36
57 2 2 0 6 15 16 30
58 2 2 0 6 20 21 25
59 2 2 0 6 31 34 37
60 2 2 0 6 26 34 41
61 2 2 0 6 6 7 26
62 2 2 0 6 8 9 24
63 2 2 0 6 23 32 35
64 2 2 0 6 10 11 27
65 2 2 0 6 39 24 44
66 2 2 0 6 33 31 37
67 2 2 0 6 29 36 42
68 2 2 0 6 21 22 40
69 2 2 0 6 38 33 39
70 2 2 0 6 36 25 38
71 2 2 0 6 37 43 48
72 2 2 0 6 5 6 41
73 2 2 0 6 25 21 40
74 2 2 0 6 6 26 41
75 2 2 0 6 22 1 47
76 2 2 0 6 1 13 47
77 2 2 0 6 32 33 49
78 2 2 0 6 38 39 42
79 2 2 0 6 33 38 49
80 2 2 0 6 25 40 49
81 2 2 0 6 36 38 42
82 2 2 0 6 7 8 43
83 2 2 0 6 9 10 44
84 2 2 0 6 26 7 43
85 2 2 0 6 8 24 43
86 2 2 0 6 24 9 44
87 2 2 0 6 10 27 44
88 2 2 0 6 39 33 48
89 2 2 0 6 27 11 45
90 2 2 0 6 33 37 48
91 2 2 0 6 11 12 45
92 2 2 0 6 13 35 47
93 2 2 0 6 4 5 46
94 2 2 0 6 40 22 47
95 2 2 0 6 24 39 48
96 2 2 0 6 43 24 48
97 2 2 0 6 35 40 47
98 2 2 0 6 5 41 46
99 2 2 0 6 38 25 49
$EndElements
看起来maillage-version4.msh
像这样:
$MeshFormat
4.1 0 8
$EndMeshFormat
$Entities
3 3 1 0
1 0 0 0 0
2 3 0 0 0
3 0 3 0 0
1 0 2.220446049250313e-16 0 3 3 0 0 2 3 -2
2 0 0 0 0 3 0 0 2 1 -3
3 0 0 0 3 0 0 0 2 2 -1
6 0 0 0 3 3 0 0 3 1 3 2
$EndEntities
$Nodes
7 49 1 49
0 1 0 1
1
0 0 0
0 2 0 1
2
3 0 0
0 3 0 1
3
0 3 0
1 1 0 9
4
5
6
7
8
9
10
11
12
0.4693033963404087 2.963065021592229 0
0.927050985688588 2.853169548052449 0
1.361971502971016 2.673019570653173 0
1.763355761304841 2.427050979908132 0
2.121320348549485 2.121320338569801 0
2.427050986323072 1.763355752475434 0
2.673019574643209 1.361971495140128 0
2.853169549732512 0.9270509805178855 0
2.963065021991164 0.4693033938216338 0
1 2 0 5
13
14
15
16
17
0 0.499999999997822 0
0 0.9999999999960245 0
0 1.499999999994285 0
0 1.999999999996158 0
0 2.499999999998079 0
1 3 0 5
18
19
20
21
22
2.500000000003167 0 0
2.000000000001941 0 0
1.500000000004168 0 0
1.00000000000281 0 0
0.5000000000014051 0 0
2 6 0 27
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
0.4324208618787972 1.254526258340053 0
1.964179242223375 1.677567546495472 0
1.277646354647664 0.4113155914951311 0
1.331385884279466 2.208153696956179 0
2.408333487391826 0.9570142841403682 0
0.4806120485258751 2.21192748111512 0
2.199842564949955 0.4740583806850691 0
0.4383482110825652 1.744285474319584 0
0.8583628800522819 1.500701899336962 0
0.8225535882961561 0.9953960076673578 0
1.281083415964582 1.237393204562323 0
0.8915779045171567 1.969788703743087 0
0.4204627438899584 0.7566691502573124 0
1.736929708778206 0.4257397652798222 0
1.278622231642468 1.746395721121067 0
1.524726655147985 0.8206048256661349 0
1.76486136704753 1.246517525545464 0
0.7904684345601101 0.4733411038827577 0
0.9693508624533295 2.418048746306837 0
1.982120034150953 0.8846091911536498 0
1.677597399498234 1.959155701651377 0
2.21890810757101 1.334757699095549 0
2.584882124813725 0.5654854078329913 0
0.5692634586016403 2.589242159412943 0
0.3706919352530829 0.3706919352521562 0
1.606720928989769 1.574445926857611 0
1.141924419829695 0.779315042507347 0
$EndNodes
$Elements
7 99 1 99
0 1 15 1
1 1
0 2 15 1
2 2
0 3 15 1
3 3
1 1 1 10
4 3 4
5 4 5
6 5 6
7 6 7
8 7 8
9 8 9
10 9 10
11 10 11
12 11 12
13 12 2
1 2 1 6
14 1 13
15 13 14
16 14 15
17 15 16
18 16 17
19 17 3
1 3 1 6
20 2 18
21 18 19
22 19 20
23 20 21
24 21 22
25 22 1
2 6 2 74
26 17 4 46
27 12 18 45
28 12 2 18
29 3 4 17
30 42 39 44
31 27 42 44
32 28 17 46
33 18 29 45
34 35 32 40
35 27 29 42
36 40 32 49
37 34 28 41
38 34 26 37
39 29 27 45
40 23 30 31
41 23 15 30
42 13 14 35
43 30 28 34
44 41 28 46
45 29 19 36
46 31 30 34
47 16 28 30
48 16 17 28
49 18 19 29
50 14 23 35
51 20 25 36
52 32 31 33
53 14 15 23
54 37 26 43
55 23 31 32
56 19 20 36
57 15 16 30
58 20 21 25
59 31 34 37
60 26 34 41
61 6 7 26
62 8 9 24
63 23 32 35
64 10 11 27
65 39 24 44
66 33 31 37
67 29 36 42
68 21 22 40
69 38 33 39
70 36 25 38
71 37 43 48
72 5 6 41
73 25 21 40
74 6 26 41
75 22 1 47
76 1 13 47
77 32 33 49
78 38 39 42
79 33 38 49
80 25 40 49
81 36 38 42
82 7 8 43
83 9 10 44
84 26 7 43
85 8 24 43
86 24 9 44
87 10 27 44
88 39 33 48
89 27 11 45
90 33 37 48
91 11 12 45
92 13 35 47
93 4 5 46
94 40 22 47
95 24 39 48
96 43 24 48
97 35 40 47
98 5 41 46
99 38 25 49
$EndElements
观察结果
文件的结构
msh
发生了变化,比较版本 2 和版本 4,luamesh
包正在崩溃。我猜想包
luamplib
在某个时候发生了变化,也许某些切换选项会对未知的颜色命令有所帮助?添加\usepackage{xcolor}
没有帮助。
更新 1
tikz
尽管文档中有许多多余的字符,但这在一定程度上帮助了没有的版本 2 :
\let\mplibcolor=\mpcolor
\def\luameshmpcolor{black}
更新 2
这是针对版本 2 的解决方法,无需tikz
:
\documentclass{article}
\usepackage{xcolor}
\usepackage{luamesh}
\def\mplibcolor#1{}
\def\luameshmpcolor{blue}
\begin{document}
\drawGmsh[color=]{maillage-version2.msh}
\end{document}
更新 3
这是从格式 4 到格式 2 的转换:
gmsh maillage-version4.msh -save -format msh2 -o maillage-v4-to-v2.msh
此后这对我有用/Metapost/:
\documentclass{article}
\usepackage{luamesh}
\def\mplibcolor#1{}
\def\luameshmpcolor{blue}
\begin{document}
\drawGmsh[color=]{maillage-v4-to-v2.msh}
\end{document}
这部分对我来说和 TikZ 一起工作:
\documentclass{article}
\usepackage{luamesh}
%\def\mplibcolor#1{}
%\def\luameshmpcolor{blue}
\begin{document}
\drawGmsh[tikz,color=blue]{maillage-v4-to-v2.msh}
\end{document}
答案1
感谢您的报告。我更新了软件包(至版本 0.6),我不知道 luamplib 的变化,也不知道新的 MSH ASCII 文件格式。现在一切都正常(版本 0.6):