use 'view' and standardized calling signature

This commit is contained in:
Martin Diehl 2021-04-04 20:28:48 +02:00
parent 0e5f693fea
commit 1d6b56346a
1 changed files with 7 additions and 8 deletions

View File

@ -1096,7 +1096,7 @@ class Result:
pool.join() pool.join()
def save_XDMF(self): def save_XDMF(self,output='*'):
""" """
Write XDMF file to directly visualize data in DADF5 file. Write XDMF file to directly visualize data in DADF5 file.
@ -1139,7 +1139,7 @@ class Result:
attributes = [] attributes = []
data_items = [] data_items = []
for inc in self.increments: for inc in self.visible['increments']:
grid=ET.SubElement(collection,'Grid') grid=ET.SubElement(collection,'Grid')
grid.attrib = {'GridType': 'Uniform', grid.attrib = {'GridType': 'Uniform',
@ -1176,12 +1176,11 @@ class Result:
'Dimensions': '{} {} {} 3'.format(*(self.cells+1))} 'Dimensions': '{} {} {} 3'.format(*(self.cells+1))}
data_items[-1].text=f'{os.path.split(self.fname)[1]}:/{inc}/geometry/u_n' data_items[-1].text=f'{os.path.split(self.fname)[1]}:/{inc}/geometry/u_n'
for o,p in zip(['phases','homogenizations'],['fields','fields']): for ty in ['phases','homogenizations']:
for oo in getattr(self,o): for label in self.visible[ty]:
for pp in getattr(self,p): for field in self.visible['fields']:
g = '/'.join([inc,o[:-1],oo,pp]) for out in _match(output,f['/'.join((inc,ty[:-1],label,field))].keys()):
for l in f[g]: name = '/'.join([inc,ty[:-1],label,field,out])
name = '/'.join([g,l])
shape = f[name].shape[1:] shape = f[name].shape[1:]
dtype = f[name].dtype dtype = f[name].dtype