easier to understand
limit to same fields for homogenization and fields results in a little less flexibility (requires two views) but should be acceptable for such a little used feature
This commit is contained in:
parent
cf1ce6a1fe
commit
18afa217fe
|
@ -84,21 +84,17 @@ class Result:
|
||||||
self.phases = [c.decode() for c in np.unique(f[f'{grp}/phase']
|
self.phases = [c.decode() for c in np.unique(f[f'{grp}/phase']
|
||||||
['Name' if self.version_minor < 12 else 'label'])]
|
['Name' if self.version_minor < 12 else 'label'])]
|
||||||
|
|
||||||
self.out_type_ph = []
|
self.fields = []
|
||||||
for c in self.phases:
|
for c in self.phases:
|
||||||
self.out_type_ph += f['/'.join([self.increments[0],'phase',c])].keys()
|
self.fields += f['/'.join([self.increments[0],'phase',c])].keys()
|
||||||
self.out_type_ph = list(set(self.out_type_ph)) # make unique
|
|
||||||
|
|
||||||
self.out_type_ho = []
|
|
||||||
for m in self.homogenizations:
|
for m in self.homogenizations:
|
||||||
self.out_type_ho += f['/'.join([self.increments[0],'homogenization',m])].keys()
|
self.fields += f['/'.join([self.increments[0],'homogenization',m])].keys()
|
||||||
self.out_type_ho = list(set(self.out_type_ho)) # make unique
|
self.fields = list(set(self.fields)) # make unique
|
||||||
|
|
||||||
self.visible = {'increments': self.increments,
|
self.visible = {'increments': self.increments,
|
||||||
'phases': self.phases,
|
'phases': self.phases,
|
||||||
'homogenizations': self.homogenizations,
|
'homogenizations': self.homogenizations,
|
||||||
'out_type_ph': self.out_type_ph,
|
'fields': self.fields,
|
||||||
'out_type_ho': self.out_type_ho
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fname = Path(fname).absolute()
|
self.fname = Path(fname).absolute()
|
||||||
|
@ -392,7 +388,7 @@ class Result:
|
||||||
|
|
||||||
with h5py.File(self.fname,'r') as f:
|
with h5py.File(self.fname,'r') as f:
|
||||||
for i in self.iterate('increments'):
|
for i in self.iterate('increments'):
|
||||||
for o,p in zip(['phases','homogenizations'],['out_type_ph','out_type_ho']):
|
for o,p in zip(['phases','homogenizations'],['fields','fields']):
|
||||||
for oo in self.iterate(o):
|
for oo in self.iterate(o):
|
||||||
for pp in self.iterate(p):
|
for pp in self.iterate(p):
|
||||||
group = '/'.join([i,o[:-1],oo,pp]) # o[:-1]: plural/singular issue
|
group = '/'.join([i,o[:-1],oo,pp]) # o[:-1]: plural/singular issue
|
||||||
|
@ -414,7 +410,7 @@ class Result:
|
||||||
with h5py.File(self.fname,'r') as f:
|
with h5py.File(self.fname,'r') as f:
|
||||||
for i in self.iterate('increments'):
|
for i in self.iterate('increments'):
|
||||||
message += f'\n{i} ({self.times[self.increments.index(i)]}s)\n'
|
message += f'\n{i} ({self.times[self.increments.index(i)]}s)\n'
|
||||||
for o,p in zip(['phases','homogenizations'],['out_type_ph','out_type_ho']):
|
for o,p in zip(['phases','homogenizations'],['fields','fields']):
|
||||||
message += f' {o[:-1]}\n'
|
message += f' {o[:-1]}\n'
|
||||||
for oo in self.iterate(o):
|
for oo in self.iterate(o):
|
||||||
message += f' {oo}\n'
|
message += f' {oo}\n'
|
||||||
|
@ -448,7 +444,7 @@ class Result:
|
||||||
path.append(k)
|
path.append(k)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
for o,p in zip(['phases','homogenizations'],['out_type_ph','out_type_ho']):
|
for o,p in zip(['phases','homogenizations'],['fields','fields']):
|
||||||
for oo in self.iterate(o):
|
for oo in self.iterate(o):
|
||||||
for pp in self.iterate(p):
|
for pp in self.iterate(p):
|
||||||
k = '/'.join([i,o[:-1],oo,pp,label])
|
k = '/'.join([i,o[:-1],oo,pp,label])
|
||||||
|
@ -1222,7 +1218,7 @@ 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'],['out_type_ph','out_type_ho']):
|
for o,p in zip(['phases','homogenizations'],['fields','fields']):
|
||||||
for oo in getattr(self,o):
|
for oo in getattr(self,o):
|
||||||
for pp in getattr(self,p):
|
for pp in getattr(self,p):
|
||||||
g = '/'.join([inc,o[:-1],oo,pp])
|
g = '/'.join([inc,o[:-1],oo,pp])
|
||||||
|
@ -1286,7 +1282,7 @@ class Result:
|
||||||
viewed_backup_ho = self.visible['homogenizations'].copy()
|
viewed_backup_ho = self.visible['homogenizations'].copy()
|
||||||
self.view('homogenizations',False)
|
self.view('homogenizations',False)
|
||||||
for label in (labels if isinstance(labels,list) else [labels]):
|
for label in (labels if isinstance(labels,list) else [labels]):
|
||||||
for o in self.iterate('out_type_ph'):
|
for o in self.iterate('fields'):
|
||||||
for c in range(self.N_constituents):
|
for c in range(self.N_constituents):
|
||||||
prefix = '' if self.N_constituents == 1 else f'constituent{c}/'
|
prefix = '' if self.N_constituents == 1 else f'constituent{c}/'
|
||||||
if o not in ['mechanics', 'mechanical']: # compatibility hack
|
if o not in ['mechanics', 'mechanical']: # compatibility hack
|
||||||
|
@ -1312,7 +1308,7 @@ class Result:
|
||||||
viewed_backup_ph = self.visible['phases'].copy()
|
viewed_backup_ph = self.visible['phases'].copy()
|
||||||
self.view('phases',False)
|
self.view('phases',False)
|
||||||
for label in (labels if isinstance(labels,list) else [labels]):
|
for label in (labels if isinstance(labels,list) else [labels]):
|
||||||
for _ in self.iterate('out_type_ho'):
|
for _ in self.iterate('fields'):
|
||||||
paths = self.get_dataset_location(label)
|
paths = self.get_dataset_location(label)
|
||||||
if len(paths) == 0:
|
if len(paths) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue