output results for all constituents
This commit is contained in:
parent
5359e05fd3
commit
b9b26cb2cc
|
@ -300,7 +300,7 @@ class Result:
|
||||||
constituent : int
|
constituent : int
|
||||||
Constituent to consider for phase data
|
Constituent to consider for phase data
|
||||||
tagged : bool
|
tagged : bool
|
||||||
tag Table.column name with '#component'
|
tag Table.column name with '#constituent'
|
||||||
defaults to False
|
defaults to False
|
||||||
split : bool
|
split : bool
|
||||||
split Table by increment and return dictionary of Tables
|
split Table by increment and return dictionary of Tables
|
||||||
|
@ -309,7 +309,7 @@ class Result:
|
||||||
"""
|
"""
|
||||||
sets = datasets if hasattr(datasets,'__iter__') and not isinstance(datasets,str) else \
|
sets = datasets if hasattr(datasets,'__iter__') and not isinstance(datasets,str) else \
|
||||||
[datasets]
|
[datasets]
|
||||||
tag = f'#{component}' if tagged else ''
|
tag = f'#{constituent}' if tagged else ''
|
||||||
tbl = {} if split else None
|
tbl = {} if split else None
|
||||||
inGeom = {}
|
inGeom = {}
|
||||||
inData = {}
|
inData = {}
|
||||||
|
@ -323,8 +323,8 @@ class Result:
|
||||||
if prop == 'geometry':
|
if prop == 'geometry':
|
||||||
inGeom[key] = inData[key] = np.arange(self.N_materialpoints)
|
inGeom[key] = inData[key] = np.arange(self.N_materialpoints)
|
||||||
elif prop == 'phase':
|
elif prop == 'phase':
|
||||||
inGeom[key] = np.where(f['mapping/phase'][:,component]['Name'] == str.encode(name))[0]
|
inGeom[key] = np.where(f['mapping/phase'][:,constituent]['Name'] == str.encode(name))[0]
|
||||||
inData[key] = f['mapping/phase'][inGeom[key],component]['Position']
|
inData[key] = f['mapping/phase'][inGeom[key],constituent]['Position']
|
||||||
elif prop == 'homogenization':
|
elif prop == 'homogenization':
|
||||||
inGeom[key] = np.where(f['mapping/homogenization']['Name'] == str.encode(name))[0]
|
inGeom[key] = np.where(f['mapping/homogenization']['Name'] == str.encode(name))[0]
|
||||||
inData[key] = f['mapping/homogenization'][inGeom[key].tolist()]['Position']
|
inData[key] = f['mapping/homogenization'][inGeom[key].tolist()]['Position']
|
||||||
|
@ -1237,6 +1237,7 @@ class Result:
|
||||||
with h5py.File(self.fname,'r') as f:
|
with h5py.File(self.fname,'r') as f:
|
||||||
v = VTK.from_unstructured_grid(f['/geometry/x_n'][()],
|
v = VTK.from_unstructured_grid(f['/geometry/x_n'][()],
|
||||||
f['/geometry/T_c'][()]-1,
|
f['/geometry/T_c'][()]-1,
|
||||||
|
f['/geometry/T_c'].attrs['VTK_TYPE'] if h5py3 else \
|
||||||
f['/geometry/T_c'].attrs['VTK_TYPE'].decode())
|
f['/geometry/T_c'].attrs['VTK_TYPE'].decode())
|
||||||
elif mode.lower()=='point':
|
elif mode.lower()=='point':
|
||||||
v = VTK.from_poly_data(self.cell_coordinates)
|
v = VTK.from_poly_data(self.cell_coordinates)
|
||||||
|
@ -1249,27 +1250,29 @@ class Result:
|
||||||
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 o in self.iterate('out_type_ph'):
|
for o in self.iterate('out_type_ph'):
|
||||||
if o != 'mechanics':
|
for c in range(self.N_constituents):
|
||||||
for c in self.iterate('phases'):
|
prefix = '' if self.N_constituents == 1 else f'constituent{c}/'
|
||||||
path = self.get_dataset_location(label)
|
if o != 'mechanics':
|
||||||
if len(path) == 0:
|
for _ in self.iterate('phases'):
|
||||||
|
path = self.get_dataset_location(label)
|
||||||
|
if len(path) == 0:
|
||||||
|
continue
|
||||||
|
array = self.read_dataset(path,c)
|
||||||
|
v.add(array,prefix+path[0].split('/',1)[1])
|
||||||
|
else:
|
||||||
|
paths = self.get_dataset_location(label)
|
||||||
|
if len(paths) == 0:
|
||||||
continue
|
continue
|
||||||
array = self.read_dataset(path,0)
|
array = self.read_dataset(paths,c)
|
||||||
v.add(array,'1_'+path[0].split('/',1)[1]) #ToDo: hard coded 1!
|
ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanics))') # identify phase name
|
||||||
else:
|
dset_name = prefix+re.sub(ph_name,r'',paths[0].split('/',1)[1]) # remove phase name
|
||||||
paths = self.get_dataset_location(label)
|
v.add(array,dset_name)
|
||||||
if len(paths) == 0:
|
|
||||||
continue
|
|
||||||
array = self.read_dataset(paths,0)
|
|
||||||
ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanics))') # identify phase name
|
|
||||||
dset_name = '1_' + re.sub(ph_name,r'',paths[0].split('/',1)[1]) # removing phase 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 o in self.iterate('out_type_ho'):
|
for _ in self.iterate('out_type_ho'):
|
||||||
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