Formatting cleanups.

这个提交包含在:
Craig Warren
2018-01-02 17:19:42 +00:00
父节点 a784459ee6
当前提交 f83ec97fa9
共有 2 个文件被更改,包括 28 次插入12 次删除

查看文件

@@ -24,10 +24,10 @@ import numpy as np
from struct import pack
from gprMax._version import __version__
from gprMax.geometry_outputs_ext import define_normal_geometry
from gprMax.geometry_outputs_ext import define_fine_geometry
from gprMax.utilities import round_value
from .geometry_outputs_ext import define_fine_geometry, define_normal_geometry
class GeometryView(object):
"""Views of the geometry of the model."""
@@ -70,7 +70,7 @@ class GeometryView(object):
self.vtk_yfcells = self.yf // self.dy
self.vtk_zscells = self.zs // self.dz
self.vtk_zfcells = self.zf // self.dz
self.vtk_nxcells = self.nx // self.dx
self.vtk_nxcells = self.nx // self.dx
self.vtk_nycells = self.ny // self.dy
self.vtk_nzcells = self.nz // self.dz
self.n_vtk_cells = self.vtk_nxcells * self.vtk_nycells * self.vtk_nzcells
@@ -136,7 +136,7 @@ class GeometryView(object):
f.write('<DataArray type="Int8" Name="Receivers" format="appended" offset="{}" />\n'.format(vtk_rxs_offset).encode('utf-8'))
f.write('</CellData>\n'.encode('utf-8'))
f.write('</Piece>\n</ImageData>\n<AppendedData encoding="raw">\n_'.encode('utf-8'))
solid_geometry = np.zeros((self.n_vtk_cells), dtype=np.uint32)
srcs_pml_geometry = np.zeros((self.n_vtk_cells), dtype=np.int8)
rxs_geometry = np.zeros((self.n_vtk_cells), dtype=np.int8)
@@ -197,8 +197,8 @@ class GeometryView(object):
f.write('</CellData>\n'.encode('utf-8'))
f.write('</Piece>\n</PolyData>\n<AppendedData encoding="raw">\n_'.encode('utf-8'))
# Coordinates of each point
# Coordinates of each point
n_points = (self.nx + 1) * (self.ny + 1) * (self.nz + 1)
points = np.zeros((n_points, 3), dtype=np.float32)

查看文件

@@ -1,7 +1,26 @@
# Copyright (C) 2015-2018: The University of Edinburgh
# Authors: Craig Warren and Antonis Giannopoulos
#
# This file is part of gprMax.
#
# gprMax is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# gprMax is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
cimport numpy as np
from gprMax.constants cimport floattype_t
cpdef void define_fine_geometry(
int nx,
int ny,
@@ -24,7 +43,7 @@ cpdef void define_fine_geometry(
np.uint32_t[:, :] z_lines,
np.uint32_t[:] z_materials
):
cdef Py_ssize_t i, j, k
cdef Py_ssize_t label = 0
cdef Py_ssize_t counter_x = 0
@@ -62,6 +81,7 @@ cpdef void define_fine_geometry(
label = label + 1
cpdef void define_normal_geometry(
int xs,
int xf,
@@ -78,9 +98,8 @@ cpdef void define_normal_geometry(
np.uint32_t[:] solid_geometry,
np.int8_t[:] srcs_pml_geometry,
np.int8_t[:] rxs_geometry,
):
cdef Py_ssize_t i, j, k
cdef Py_ssize_t counter = 0
@@ -91,6 +110,3 @@ cpdef void define_normal_geometry(
srcs_pml_geometry[counter] = srcs_pml[i, j, k]
rxs_geometry[counter] = rxs[i, j, k]
counter = counter + 1