Commit 985fcaec authored by Jonathan Lambrechts's avatar Jonathan Lambrechts Committed by Philippe Delandmeter
Browse files

update mesh.py to new 3.0 mesh format

parent 1bd9dd71
Pipeline #1347 failed with stage
in 37 minutes and 19 seconds
......@@ -46,9 +46,15 @@ class mesh() :
for name, tag in plist.items() :
output.write("%i %i \"%s\"\n" % (dim, tag, name))
output.write("$EndPhysicalNames\n")
output.write("$Entities\n%i\n" % (len(self.entities)))
output.write("$Entities\n")
ebydim = [[],[],[],[]]
for e in self.entities :
output.write("%i %i %i %s\n" % (e.tag, e.dimension, len(e.physicals), " ".join(repr(ip) for ip in e.physicals)))
ebydim[e.dimension].append(e)
for es in ebydim :
output.write("%i\n" % len(es))
for es in ebydim :
for e in es :
output.write("%i 0 %i %s\n" % (e.tag, len(e.physicals), " ".join(repr(ip) for ip in e.physicals)))
output.write("$EndEntities\n")
output.write("$Nodes\n%d\n" % len(self.vertices))
for (x, y, z, j) in self.vertices :
......@@ -104,12 +110,14 @@ class mesh() :
self.physicals[int(dim)][name[1:-1]] = int(tag)
fin.readline()
elif w[0] == "$Entities" and self.useFormat3:
n = int(fin.readline())
for i in range(n) :
l = fin.readline().split()
j, dim, nphys = int(l[0]), int(l[1]), int(l[2])
self.entities.append(mesh.entity(j, dim, [int(ip) for ip in l[3:3+nphys]]))
entitymap[(dim, j)] = self.entities[-1]
n = [int(fin.readline()) for i in range(4)]
for dim in range(4) :
for i in range(n[dim]) :
l = fin.readline().split()
j, nbnd = int(l[0]), int(l[1])
nphys = int(l[2+nbnd])
self.entities.append(mesh.entity(j, dim, [int(ip) for ip in l[3+nbnd:3+nbnd+nphys]]))
entitymap[(dim, j)] = self.entities[-1]
fin.readline()
elif w[0] == "$Nodes" :
n = int(fin.readline())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment