mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
Merge branch 'fix_gmsh_name_parsing' into 'master'
fix gmsh physical group parsing See merge request ngsolve/netgen!624
This commit is contained in:
commit
61366f4c8e
@ -22,7 +22,10 @@ def ReadGmsh(filename):
|
|||||||
|
|
||||||
pointmap = {}
|
pointmap = {}
|
||||||
facedescriptormap = {}
|
facedescriptormap = {}
|
||||||
namemap = { 0 : "default" }
|
namemap = { 0 : { 0 : "default" },
|
||||||
|
1: { 0 : "default" },
|
||||||
|
2: { 0 : "default" },
|
||||||
|
3: { 0 : "default" } }
|
||||||
materialmap = {}
|
materialmap = {}
|
||||||
bbcmap = {}
|
bbcmap = {}
|
||||||
|
|
||||||
@ -80,7 +83,7 @@ def ReadGmsh(filename):
|
|||||||
for i in range(numnames):
|
for i in range(numnames):
|
||||||
f.readline
|
f.readline
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
namemap[int(line.split()[1])] = line.split()[2][1:-1]
|
namemap[int(line.split()[0])][int(line.split()[1])] = line.split()[2][1:-1]
|
||||||
|
|
||||||
if line.split()[0] == "$Nodes":
|
if line.split()[0] == "$Nodes":
|
||||||
num = int(f.readline().split()[0])
|
num = int(f.readline().split()[0])
|
||||||
@ -115,7 +118,7 @@ def ReadGmsh(filename):
|
|||||||
else:
|
else:
|
||||||
index = len(bbcmap) + 1
|
index = len(bbcmap) + 1
|
||||||
if len(namemap):
|
if len(namemap):
|
||||||
mesh.SetCD2Name(index, namemap[tags[0]])
|
mesh.SetCD2Name(index, namemap[1][tags[0]])
|
||||||
else:
|
else:
|
||||||
mesh.SetCD2Name(index, "line" + str(tags[1]))
|
mesh.SetCD2Name(index, "line" + str(tags[1]))
|
||||||
bbcmap[tags[1]] = index
|
bbcmap[tags[1]] = index
|
||||||
@ -127,7 +130,7 @@ def ReadGmsh(filename):
|
|||||||
index = len(facedescriptormap) + 1
|
index = len(facedescriptormap) + 1
|
||||||
fd = FaceDescriptor(bc=index)
|
fd = FaceDescriptor(bc=index)
|
||||||
if len(namemap):
|
if len(namemap):
|
||||||
fd.bcname = namemap[tags[0]]
|
fd.bcname = namemap[1][tags[0]]
|
||||||
else:
|
else:
|
||||||
fd.bcname = 'line' + str(tags[1])
|
fd.bcname = 'line' + str(tags[1])
|
||||||
mesh.SetBCName(index - 1, fd.bcname)
|
mesh.SetBCName(index - 1, fd.bcname)
|
||||||
@ -139,7 +142,7 @@ def ReadGmsh(filename):
|
|||||||
else:
|
else:
|
||||||
index = len(materialmap) + 1
|
index = len(materialmap) + 1
|
||||||
if len(namemap):
|
if len(namemap):
|
||||||
mesh.SetMaterial(index, namemap[tags[0]])
|
mesh.SetMaterial(index, namemap[1][tags[0]])
|
||||||
else:
|
else:
|
||||||
mesh.SetMaterial(index, "line" + str(tags[1]))
|
mesh.SetMaterial(index, "line" + str(tags[1]))
|
||||||
materialmap[tags[1]] = index
|
materialmap[tags[1]] = index
|
||||||
@ -154,7 +157,7 @@ def ReadGmsh(filename):
|
|||||||
index = len(facedescriptormap) + 1
|
index = len(facedescriptormap) + 1
|
||||||
fd = FaceDescriptor(bc=index)
|
fd = FaceDescriptor(bc=index)
|
||||||
if len(namemap):
|
if len(namemap):
|
||||||
fd.bcname = namemap[tags[0]]
|
fd.bcname = namemap[2][tags[0]]
|
||||||
else:
|
else:
|
||||||
fd.bcname = "surf" + str(tags[1])
|
fd.bcname = "surf" + str(tags[1])
|
||||||
mesh.SetBCName(index - 1, fd.bcname)
|
mesh.SetBCName(index - 1, fd.bcname)
|
||||||
@ -166,7 +169,7 @@ def ReadGmsh(filename):
|
|||||||
else:
|
else:
|
||||||
index = len(materialmap) + 1
|
index = len(materialmap) + 1
|
||||||
if len(namemap):
|
if len(namemap):
|
||||||
mesh.SetMaterial(index, namemap[tags[0]])
|
mesh.SetMaterial(index, namemap[2][tags[0]])
|
||||||
else:
|
else:
|
||||||
mesh.SetMaterial(index, "surf" + str(tags[1]))
|
mesh.SetMaterial(index, "surf" + str(tags[1]))
|
||||||
materialmap[tags[1]] = index
|
materialmap[tags[1]] = index
|
||||||
@ -187,7 +190,7 @@ def ReadGmsh(filename):
|
|||||||
else:
|
else:
|
||||||
index = len(materialmap) + 1
|
index = len(materialmap) + 1
|
||||||
if len(namemap):
|
if len(namemap):
|
||||||
mesh.SetMaterial(index, namemap[tags[0]])
|
mesh.SetMaterial(index, namemap[3][tags[0]])
|
||||||
else:
|
else:
|
||||||
mesh.SetMaterial(index, "vol" + str(tags[1]))
|
mesh.SetMaterial(index, "vol" + str(tags[1]))
|
||||||
materialmap[tags[1]] = index
|
materialmap[tags[1]] = index
|
||||||
|
Loading…
Reference in New Issue
Block a user