always merge homogenization results

This commit is contained in:
Martin Diehl 2020-11-18 23:12:29 +01:00
parent 4bf802a28e
commit 5359e05fd3
1 changed files with 16 additions and 24 deletions

View File

@ -1248,41 +1248,33 @@ class Result:
picked_backup_ho = self.selection['homogenizations'].copy() picked_backup_ho = self.selection['homogenizations'].copy()
self.pick('homogenizations',False) self.pick('homogenizations',False)
for label in (labels if isinstance(labels,list) else [labels]): for label in (labels if isinstance(labels,list) else [labels]):
for p in self.iterate('out_type_ph'): for o in self.iterate('out_type_ph'):
if p != 'mechanics': if o != 'mechanics':
for c in self.iterate('phases'): for c in self.iterate('phases'):
x = self.get_dataset_location(label) path = self.get_dataset_location(label)
if len(x) == 0: if len(path) == 0:
continue continue
array = self.read_dataset(x,0) array = self.read_dataset(path,0)
v.add(array,'1_'+x[0].split('/',1)[1]) #ToDo: hard coded 1! v.add(array,'1_'+path[0].split('/',1)[1]) #ToDo: hard coded 1!
else: else:
x = self.get_dataset_location(label) paths = self.get_dataset_location(label)
if len(x) == 0: if len(paths) == 0:
continue continue
array = self.read_dataset(x,0) array = self.read_dataset(paths,0)
ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanics))') # identify phase name ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanics))') # identify phase name
dset_name = '1_' + re.sub(ph_name,r'',x[0].split('/',1)[1]) # removing phase name dset_name = '1_' + re.sub(ph_name,r'',paths[0].split('/',1)[1]) # removing phase name
v.add(array,dset_name) v.add(array,dset_name)
self.pick('homogenizations',picked_backup_ho) self.pick('homogenizations',picked_backup_ho)
picked_backup_ph = self.selection['phases'].copy() picked_backup_ph = self.selection['phases'].copy()
self.pick('phases',False) self.pick('phases',False)
for label in (labels if isinstance(labels,list) else [labels]): for label in (labels if isinstance(labels,list) else [labels]):
for p in self.iterate('out_type_ho'): for o in self.iterate('out_type_ho'):
if p != 'mechanics': paths = self.get_dataset_location(label)
for m in self.iterate('homogenizations'): if len(paths) == 0:
x = self.get_dataset_location(label) continue
if len(x) == 0: array = self.read_dataset(paths)
continue v.add(array,paths[0].split('/',1)[1])
array = self.read_dataset(x,0)
v.add(array,'1_'+x[0].split('/',1)[1]) #ToDo: why 1_?
else:
x = self.get_dataset_location(label)
if len(x) == 0:
continue
array = self.read_dataset(x,0)
v.add(array,'1_'+x[0].split('/',1)[1])
self.pick('phases',picked_backup_ph) self.pick('phases',picked_backup_ph)
u = self.read_dataset(self.get_dataset_location('u_n' if mode.lower() == 'cell' else 'u_p')) u = self.read_dataset(self.get_dataset_location('u_n' if mode.lower() == 'cell' else 'u_p'))