From b75e98ca3f01a7b56137a03bb079aa5c99d9b878 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 7 May 2020 19:12:05 +0200 Subject: [PATCH] forgotten debug statements + polishing of XDMF output --- python/damask/_result.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 622f38919..9993e90bd 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -66,7 +66,7 @@ class Result: self.Nmaterialpoints, self.Nconstituents = np.shape(f['mapping/cellResults/constituent']) self.materialpoints = [m.decode() for m in np.unique(f['mapping/cellResults/materialpoint']['Name'])] self.constituents = [c.decode() for c in np.unique(f['mapping/cellResults/constituent'] ['Name'])] - + # faster, but does not work with (deprecated) DADF5_postResults #self.materialpoints = [m for m in f['inc0/materialpoint']] #self.constituents = [c for c in f['inc0/constituent']] @@ -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')