open file only once

This commit is contained in:
Martin Diehl 2021-04-05 15:58:10 +02:00
parent c3a7a85f7a
commit faa9e6aa6a
1 changed files with 20 additions and 21 deletions

View File

@ -1059,6 +1059,7 @@ class Result:
attributes = []
data_items = []
with h5py.File(self.fname,'r') as f:
for inc in self.visible['increments']:
grid=ET.SubElement(collection,'Grid')
@ -1084,8 +1085,6 @@ class Result:
'Dimensions': '3'}
delta.text="{} {} {}".format(*(self.size/self.cells))
with h5py.File(self.fname,'r') as f:
attributes.append(ET.SubElement(grid, 'Attribute'))
attributes[-1].attrib={'Name': 'u / m',
'Center': 'Node',