Coreform-Cubit-Mesh-Export 0.9.6__tar.gz → 0.9.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Coreform-Cubit-Mesh-Export might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Coreform_Cubit_Mesh_Export
3
- Version: 0.9.6
3
+ Version: 0.9.7
4
4
  Summary: Cubit mesh export to various formats including Gmsh, Nastran, and VTK
5
5
  Author-email: Kengo Sugahara <ksugahar@gmail.com>
6
6
  Maintainer-email: Kengo Sugahara <ksugahar@gmail.com>
@@ -5,5 +5,4 @@ Coreform_Cubit_Mesh_Export.egg-info/PKG-INFO
5
5
  Coreform_Cubit_Mesh_Export.egg-info/SOURCES.txt
6
6
  Coreform_Cubit_Mesh_Export.egg-info/dependency_links.txt
7
7
  Coreform_Cubit_Mesh_Export.egg-info/requires.txt
8
- Coreform_Cubit_Mesh_Export.egg-info/top_level.txt
9
- file_format/ngsolve_read_gmsh.py
8
+ Coreform_Cubit_Mesh_Export.egg-info/top_level.txt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Coreform_Cubit_Mesh_Export
3
- Version: 0.9.6
3
+ Version: 0.9.7
4
4
  Summary: Cubit mesh export to various formats including Gmsh, Nastran, and VTK
5
5
  Author-email: Kengo Sugahara <ksugahar@gmail.com>
6
6
  Maintainer-email: Kengo Sugahara <ksugahar@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "Coreform_Cubit_Mesh_Export"
7
- version = "0.9.6"
7
+ version = "0.9.7"
8
8
  authors = [
9
9
  {name = "Kengo Sugahara", email = "ksugahar@gmail.com"},
10
10
  ]
@@ -1,218 +0,0 @@
1
- from netgen.meshing import *
2
-
3
- def ReadGmsh(filename):
4
- if not filename.endswith(".msh"):
5
- filename += ".msh"
6
- meshdim = 1
7
- with open(filename, 'r') as f:
8
- while f.readline().split()[0] != "$Elements":
9
- pass
10
- nelem = int(f.readline())
11
- for i in range(nelem):
12
- line = f.readline()
13
- eltype = int(line.split()[1])
14
- if eltype > 1 and eltype != 15:
15
- meshdim = 2
16
- if eltype > 3 and eltype != 15:
17
- meshdim = 3
18
- break
19
-
20
- f = open(filename, 'r')
21
- mesh = Mesh(dim=meshdim)
22
-
23
- pointmap = {}
24
- facedescriptormap = {}
25
- namemap = { 0 : { 0 : "default" },
26
- 1: { 0 : "default" },
27
- 2: { 0 : "default" },
28
- 3: { 0 : "default" } }
29
- materialmap = {}
30
- bbcmap = {}
31
-
32
- segm = 1
33
- trig = 2
34
- quad = 3
35
- tet = 4
36
- hex = 5
37
- prism = 6
38
- pyramid = 7
39
- segm3 = 8 # 2nd order line
40
- trig6 = 9 # 2nd order trig
41
- tet10 = 11 # 2nd order tet
42
- point = 15
43
- quad8 = 16 # 2nd order quad
44
- hex20 = 17 # 2nd order hex
45
- prism15 = 18 # 2nd order prism
46
- pyramid13 = 19 # 2nd order pyramid
47
- segms = [segm, segm3]
48
- trigs = [trig, trig6]
49
- quads = [quad, quad8]
50
- tets = [tet, tet10]
51
- hexes = [hex, hex20]
52
- prisms = [prism, prism15]
53
- pyramids = [pyramid, pyramid13]
54
- elem0d = [point]
55
- elem1d = segms
56
- elem2d = trigs + quads
57
- elem3d = tets + hexes + prisms + pyramids
58
-
59
- num_nodes_map = { segm : 2,
60
- trig : 3,
61
- quad : 4,
62
- tet : 4,
63
- hex : 8,
64
- prism : 6,
65
- pyramid : 5,
66
- segm3 : 3,
67
- trig6 : 6,
68
- tet10 : 10,
69
- point : 1,
70
- quad8 : 8,
71
- hex20 : 20,
72
- prism15 : 18,
73
- pyramid13 : 19 }
74
-
75
- while True:
76
- line = f.readline()
77
- if line == "":
78
- break
79
-
80
- if line.split()[0] == "$PhysicalNames":
81
- print('WARNING: Physical groups detected - Be sure to define them for every geometrical entity.')
82
- numnames = int(f.readline())
83
- for i in range(numnames):
84
- f.readline
85
- line = f.readline()
86
- namemap[int(line.split()[0])][int(line.split()[1])] = line.split()[2][1:-1]
87
-
88
- if line.split()[0] == "$Nodes":
89
- num = int(f.readline().split()[0])
90
- for i in range(num):
91
- line = f.readline()
92
- nodenum, x, y, z = line.split()[0:4]
93
- !!! pnum = mesh.Add(MeshPoint(Pnt(float(x), float(y), float(z))))
94
- pointmap[int(nodenum)] = pnum
95
-
96
- if line.split()[0] == "$Elements":
97
- num = int(f.readline().split()[0])
98
-
99
- for i in range(num):
100
- line = f.readline().split()
101
- elmnum = int(line[0])
102
- elmtype = int(line[1])
103
- numtags = int(line[2])
104
- # the first tag is the physical group nr, the second tag is the group nr of the dim
105
- tags = [int(line[3 + k]) for k in range(numtags)]
106
-
107
- if elmtype not in num_nodes_map:
108
- raise Exception("element type", elmtype, "not implemented")
109
- num_nodes = num_nodes_map[elmtype]
110
-
111
- nodenums = line[3 + numtags:3 + numtags + num_nodes]
112
- nodenums2 = [pointmap[int(nn)] for nn in nodenums]
113
-
114
- if elmtype in elem1d:
115
- if meshdim == 3:
116
- if tags[1] in bbcmap:
117
- index = bbcmap[tags[1]]
118
- else:
119
- index = len(bbcmap) + 1
120
- if len(namemap):
121
- !!! mesh.SetCD2Name(index, namemap[1][tags[0]])
122
- else:
123
- !!! mesh.SetCD2Name(index, "line" + str(tags[1]))
124
- bbcmap[tags[1]] = index
125
-
126
- elif meshdim == 2:
127
- if tags[1] in facedescriptormap.keys():
128
- index = facedescriptormap[tags[1]]
129
- else:
130
- index = len(facedescriptormap) + 1
131
- !!! fd = FaceDescriptor(bc=index)
132
- if len(namemap):
133
- !!! fd.bcname = namemap[1][tags[0]]
134
- else:
135
- fd.bcname = 'line' + str(tags[1])
136
- !!! mesh.SetBCName(index - 1, fd.bcname)
137
- !!! mesh.Add(fd)
138
- facedescriptormap[tags[1]] = index
139
- else:
140
- if tags[1] in materialmap:
141
- index = materialmap[tags[1]]
142
- else:
143
- index = len(materialmap) + 1
144
- if len(namemap):
145
- !!! mesh.SetMaterial(index, namemap[1][tags[0]])
146
- else:
147
- !!! mesh.SetMaterial(index, "line" + str(tags[1]))
148
- materialmap[tags[1]] = index
149
-
150
- !!! mesh.Add(Element1D(index=index, vertices=nodenums2))
151
-
152
- if elmtype in elem2d: # 2d elements
153
- if meshdim == 3:
154
- if tags[1] in facedescriptormap.keys():
155
- index = facedescriptormap[tags[1]]
156
- else:
157
- index = len(facedescriptormap) + 1
158
- fd = FaceDescriptor(bc=index)
159
- if len(namemap):
160
- !!! fd.bcname = namemap[2][tags[0]]
161
- else:
162
- !!! fd.bcname = "surf" + str(tags[1])
163
- !!! mesh.SetBCName(index - 1, fd.bcname)
164
- !!! mesh.Add(fd)
165
- facedescriptormap[tags[1]] = index
166
- else:
167
- if tags[1] in materialmap:
168
- index = materialmap[tags[1]]
169
- else:
170
- index = len(materialmap) + 1
171
- if len(namemap):
172
- !!! mesh.SetMaterial(index, namemap[2][tags[0]])
173
- else:
174
- !!! mesh.SetMaterial(index, "surf" + str(tags[1]))
175
- materialmap[tags[1]] = index
176
-
177
- if elmtype in trigs:
178
- ordering = [i for i in range(3)]
179
- if elmtype == trig6:
180
- !! ordering += [4,5,3]
181
- if elmtype in quads:
182
- ordering = [i for i in range(4)]
183
- if elmtype == quad8:
184
- !! ordering += [4, 6, 7, 5]
185
- !!! mesh.Add(Element2D(index, [nodenums2[i] for i in ordering]))
186
-
187
- if elmtype in elem3d: # volume elements
188
- if tags[1] in materialmap:
189
- index = materialmap[tags[1]]
190
- else:
191
- index = len(materialmap) + 1
192
- if len(namemap):
193
- !!! mesh.SetMaterial(index, namemap[3][tags[0]])
194
- else:
195
- !!! mesh.SetMaterial(index, "vol" + str(tags[1]))
196
- materialmap[tags[1]] = index
197
-
198
- nodenums2 = [pointmap[int(nn)] for nn in nodenums]
199
-
200
- if elmtype in tets:
201
- !! ordering = [0,1,2,3]
202
- if elmtype == tet10:
203
- !! ordering += [4,6,7,5,9,8]
204
- elif elmtype in hexes:
205
- !! ordering = [0,1,5,4,3,2,6,7]
206
- if elmtype == hex20:
207
- !! ordering += [8,16,10,12,13,19,15,14,9,11,18,17]
208
- elif elmtype in prisms:
209
- !! ordering = [0,2,1,3,5,4]
210
- if elmtype == prism15:
211
- !! ordering += [7,6,9,8,11,10,13,12,14]
212
- elif elmtype in pyramids:
213
- !! ordering = [3,2,1,0,4]
214
- if elmtype == pyramid13:
215
- !! ordering += [10,5,6,8,12,11,9,7]
216
- !!! mesh.Add(Element3D(index, [nodenums2[i] for i in ordering]))
217
-
218
- return mesh