Remove unnecessary extra cells from GeometryObject arrays.

这个提交包含在:
Craig Warren
2021-02-24 10:11:19 +00:00
父节点 fc24d61e63
当前提交 9d7a480ff2

查看文件

@@ -335,9 +335,9 @@ class GeometryObjects(object):
self.materialsfilename = basefilename + '_materials.txt'
# Sizes of arrays to write necessary to update progress bar
self.solidsize = (self.nx + 1) * (self.ny + 1) * (self.nz + 1) * np.dtype(np.int16).itemsize
self.rigidsize = 18 * (self.nx + 1) * (self.ny + 1) * (self.nz + 1) * np.dtype(np.int8).itemsize
self.IDsize = 6 * (self.nx + 1) * (self.ny + 1) * (self.nz + 1) * np.dtype(np.uint32).itemsize
self.solidsize = self.nx * self.ny * self.nz * np.dtype(np.int16).itemsize
self.rigidsize = 18 * self.nx * self.ny * self.nz * np.dtype(np.int8).itemsize
self.IDsize = 6 * self.nx * self.ny * self.nz * np.dtype(np.uint32).itemsize
self.datawritesize = self.solidsize + self.rigidsize + self.IDsize
def write_hdf5(self, G, pbar):
@@ -355,14 +355,14 @@ class GeometryObjects(object):
fdata.attrs['dx_dy_dz'] = (G.dx, G.dy, G.dz)
# Get minimum and maximum integers of materials in geometry objects volume
minmat = np.amin(G.ID[:, self.xs:self.xf + 1, self.ys:self.yf + 1, self.zs:self.zf + 1])
maxmat = np.amax(G.ID[:, self.xs:self.xf + 1, self.ys:self.yf + 1, self.zs:self.zf + 1])
fdata['/data'] = G.solid[self.xs:self.xf + 1, self.ys:self.yf + 1, self.zs:self.zf + 1].astype('int16') - minmat
minmat = np.amin(G.ID[:, self.xs:self.xf, self.ys:self.yf, self.zs:self.zf])
maxmat = np.amax(G.ID[:, self.xs:self.xf, self.ys:self.yf, self.zs:self.zf])
fdata['/data'] = G.solid[self.xs:self.xf, self.ys:self.yf, self.zs:self.zf].astype('int16') - minmat
pbar.update(self.solidsize)
fdata['/rigidE'] = G.rigidE[:, self.xs:self.xf + 1, self.ys:self.yf + 1, self.zs:self.zf + 1]
fdata['/rigidH'] = G.rigidH[:, self.xs:self.xf + 1, self.ys:self.yf + 1, self.zs:self.zf + 1]
fdata['/rigidE'] = G.rigidE[:, self.xs:self.xf, self.ys:self.yf, self.zs:self.zf]
fdata['/rigidH'] = G.rigidH[:, self.xs:self.xf, self.ys:self.yf, self.zs:self.zf]
pbar.update(self.rigidsize)
fdata['/ID'] = G.ID[:, self.xs:self.xf + 1, self.ys:self.yf + 1, self.zs:self.zf + 1] - minmat
fdata['/ID'] = G.ID[:, self.xs:self.xf, self.ys:self.yf, self.zs:self.zf] - minmat
pbar.update(self.IDsize)
# Write materials list to a text file