parent
c2b4f5516e
commit
b75e98ca3f
|
@ -432,10 +432,8 @@ class Result:
|
|||
"""
|
||||
with h5py.File(self.fname,'r') as f:
|
||||
shape = (self.Nmaterialpoints,) + np.shape(f[path[0]])[1:]
|
||||
print(path[0])
|
||||
if len(shape) == 1: shape = shape +(1,)
|
||||
dataset = np.full(shape,np.nan,dtype=np.dtype(f[path[0]]))
|
||||
print('dataset shape', dataset.shape)
|
||||
for pa in path:
|
||||
label = pa.split('/')[2]
|
||||
|
||||
|
@ -443,19 +441,12 @@ class Result:
|
|||
dataset = np.array(f[pa])
|
||||
continue
|
||||
|
||||
print(label)
|
||||
p = np.where(f['mapping/cellResults/constituent'][:,c]['Name'] == str.encode(label))[0]
|
||||
print(len(p))
|
||||
if len(p)>0:
|
||||
u = (f['mapping/cellResults/constituent']['Position'][p,c])
|
||||
print('pa',pa)
|
||||
a = np.array(f[pa])
|
||||
print(a.shape)
|
||||
if len(a.shape) == 1:
|
||||
a=a.reshape([a.shape[0],1])
|
||||
print('u',u)
|
||||
print('a[u]',a[u,:].shape)
|
||||
print('dataset[p]',dataset[p,:].shape)
|
||||
dataset[p,:] = a[u,:]
|
||||
|
||||
p = np.where(f['mapping/cellResults/materialpoint']['Name'] == str.encode(label))[0]
|
||||
|
@ -1061,7 +1052,7 @@ class Result:
|
|||
raise NotImplementedError
|
||||
|
||||
xdmf=ET.Element('Xdmf')
|
||||
xdmf.attrib={'Version': '3.0',
|
||||
xdmf.attrib={'Version': '2.0',
|
||||
'xmlns:xi': 'http://www.w3.org/2001/XInclude'}
|
||||
|
||||
domain=ET.SubElement(xdmf, 'Domain')
|
||||
|
@ -1074,7 +1065,9 @@ class Result:
|
|||
time.attrib={'TimeType': 'List'}
|
||||
|
||||
time_data = ET.SubElement(time, 'DataItem')
|
||||
time_data.attrib={'Dimensions': '{}'.format(len(self.times))}
|
||||
time_data.attrib={'Format': 'XML',
|
||||
'NumberType': 'Float',
|
||||
'Dimensions': '{}'.format(len(self.times))}
|
||||
time_data.text = ' '.join(map(str,self.times))
|
||||
|
||||
attributes = []
|
||||
|
@ -1087,7 +1080,7 @@ class Result:
|
|||
'Name': inc}
|
||||
|
||||
topology=ET.SubElement(grid, 'Topology')
|
||||
topology.attrib={'TopologyType': '3DCORECTMESH',
|
||||
topology.attrib={'TopologyType': '3DCoRectMesh',
|
||||
'Dimensions': '{} {} {}'.format(*self.grid+1)}
|
||||
|
||||
geometry=ET.SubElement(grid, 'Geometry')
|
||||
|
|
Loading…
Reference in New Issue