Changed roundvalue function to round_value.

这个提交包含在:
Craig Warren
2016-01-14 18:04:07 +00:00
父节点 d0ae51f5f8
当前提交 760c180749

查看文件

@@ -20,7 +20,7 @@ import sys
import numpy as np
from struct import pack
from gprMax.utilities import roundvalue
from gprMax.utilities import round_value
class GeometryView:
@@ -76,12 +76,12 @@ class GeometryView:
self.filename += '.vti'
# Calculate number of cells according to requested sampling
self.vtk_xscells = roundvalue(self.xs / self.dx)
self.vtk_xfcells = roundvalue(self.xf / self.dx)
self.vtk_yscells = roundvalue(self.ys / self.dy)
self.vtk_yfcells = roundvalue(self.yf / self.dy)
self.vtk_zscells = roundvalue(self.zs / self.dz)
self.vtk_zfcells = roundvalue(self.zf / self.dz)
self.vtk_xscells = round_value(self.xs / self.dx)
self.vtk_xfcells = round_value(self.xf / self.dx)
self.vtk_yscells = round_value(self.ys / self.dy)
self.vtk_yfcells = round_value(self.yf / self.dy)
self.vtk_zscells = round_value(self.zs / self.dz)
self.vtk_zfcells = round_value(self.zf / self.dz)
with open(self.filename, 'wb') as f:
f.write('<?xml version="1.0"?>\n'.encode('utf-8'))
f.write('<VTKFile type="ImageData" version="1.0" byte_order="{}">\n'.format(GeometryView.byteorder).encode('utf-8'))
@@ -92,7 +92,7 @@ class GeometryView:
f.write('</CellData>\n</Piece>\n</ImageData>\n<AppendedData encoding="raw">\n_'.encode('utf-8'))
# Calculate number of bytes of appended data section
datasize = roundvalue(np.dtype(np.uint32).itemsize * (self.vtk_nx / self.dx) * (self.vtk_ny / self.dy) * (self.vtk_nz / self.dz))
datasize = round_value(np.dtype(np.uint32).itemsize * (self.vtk_nx / self.dx) * (self.vtk_ny / self.dy) * (self.vtk_nz / self.dz))
# Write number of bytes of appended data as UInt32
f.write(pack('I', datasize))
for k in range(self.zs, self.zf, self.dz):