From f83ec97fa9a8155f97ee84acca403e936854139b Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Tue, 2 Jan 2018 17:19:42 +0000 Subject: [PATCH] Formatting cleanups. --- gprMax/geometry_outputs.py | 12 ++++++------ gprMax/geometry_outputs_ext.pyx | 28 ++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/gprMax/geometry_outputs.py b/gprMax/geometry_outputs.py index b0a12e9b..65760bcc 100644 --- a/gprMax/geometry_outputs.py +++ b/gprMax/geometry_outputs.py @@ -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('\n'.format(vtk_rxs_offset).encode('utf-8')) f.write('\n'.encode('utf-8')) f.write('\n\n\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('\n'.encode('utf-8')) f.write('\n\n\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) diff --git a/gprMax/geometry_outputs_ext.pyx b/gprMax/geometry_outputs_ext.pyx index c1182a81..b2fc4aaa 100644 --- a/gprMax/geometry_outputs_ext.pyx +++ b/gprMax/geometry_outputs_ext.pyx @@ -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 . + 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 - - -