From dd36401f12b4d92ba29345675cb6d904bbe728c6 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Thu, 5 May 2016 11:45:39 +0100 Subject: [PATCH] Added message printing for geometry objects file. --- gprMax/input_cmds_geometry.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gprMax/input_cmds_geometry.py b/gprMax/input_cmds_geometry.py index abf333ee..ff374a53 100644 --- a/gprMax/input_cmds_geometry.py +++ b/gprMax/input_cmds_geometry.py @@ -53,7 +53,7 @@ def process_geometrycmds(geometry, G): # See if material file exists at specified path and if not try input file directory if not os.path.isfile(matfile): - matfile = os.path.join(G.inputdirectory, matfile) + matfile = os.path.abspath(os.path.join(G.inputdirectory, matfile)) # Read materials from file with open(matfile, 'r') as f: @@ -70,25 +70,21 @@ def process_geometrycmds(geometry, G): # See if geometry object file exists at specified path and if not try input file directory if not os.path.isfile(geofile): - geofile = os.path.join(G.inputdirectory, geofile) + geofile = os.path.abspath(os.path.join(G.inputdirectory, geofile)) - # Open geometry object file and read spatial resolution attribute + # Open geometry object file and read/check spatial resolution attribute f = h5py.File(geofile, 'r') dx_dy_dz = f.attrs['dx, dy, dz'] if dx_dy_dz[0] != G.dx or dx_dy_dz[1] != G.dy or dx_dy_dz[2] != G.dz: - raise CmdInputError("'" + ' '.join(tmp) + "'" + ' requires the spatial resolution of the objects file to match the spatial resolution of the model') + raise CmdInputError("'" + ' '.join(tmp) + "'" + ' requires the spatial resolution of the geometry objects file to match the spatial resolution of the model') data = f['/data'][:] - nx = data.shape[0] - ny = data.shape[1] - nz = data.shape[2] - - if (xs + nx) > G.nx or (ys + ny) > G.ny or (zs + nz) > G.nz: - raise CmdInputError("'" + ' '.join(tmp) + "'" + ' the requested geometry objects do not fit within the model domain') - data += numexistmaterials build_voxels_from_array(xs, ys, zs, data, G.solid, G.rigidE, G.rigidH, G.ID) + if G.messages: + print('Geometry objects from file {} inserted at {:g}m, {:g}m, {:g}m, with corresponding materials file {}.'.format(geofile, xs * G.dx, ys * G.dy, zs * G.dz, matfile)) + elif tmp[0] == '#edge:': if len(tmp) != 8: