now understands packed geom-files (much faster processing...)

This commit is contained in:
Philip Eisenlohr 2013-06-21 21:19:14 +00:00
parent 4cf2e75dc1
commit 8b5ba9f8f0
1 changed files with 8 additions and 1 deletions

View File

@ -130,7 +130,14 @@ for file in files:
structure = vtk.vtkIntArray() structure = vtk.vtkIntArray()
structure.SetName('Microstructures') structure.SetName('Microstructures')
for line in content: for line in content:
for item in map(int,line.split()): items = line.split()
if len(items) > 2:
if items[1].lower() == 'of': items = [int(items[2])]*int(items[0])
elif items[1].lower() == 'to': items = xrange(int(items[0]),1+int(items[2]))
else: items = map(int,items)
else: items = map(int,items)
for item in items:
structure.InsertNextValue(item) structure.InsertNextValue(item)
grid.GetCellData().AddArray(structure) grid.GetCellData().AddArray(structure)