From c8b60416b9946491f05ee129f8c39bf40b04fa7e Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Wed, 29 Jun 2016 13:36:06 +0100 Subject: [PATCH] Work on #rx_array command in progress. --- gprMax/input_cmds_multiuse.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gprMax/input_cmds_multiuse.py b/gprMax/input_cmds_multiuse.py index 0e960e80..c8245069 100644 --- a/gprMax/input_cmds_multiuse.py +++ b/gprMax/input_cmds_multiuse.py @@ -357,7 +357,7 @@ def process_multicmds(multicmds, G): G.rxs.append(r) - # Receiver box + # Receiver array cmdname = '#rx_array' if multicmds[cmdname] != 'None': for cmdinstance in multicmds[cmdname]: @@ -387,8 +387,18 @@ def process_multicmds(multicmds, G): if dx < 0 or dy < 0 or dz < 0: raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the step size should not be less than zero') if dx < G.dx or dy < G.dy or dz < G.dz: - raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the step size should not be less than the spatial discretisation') - + if dx == 0: + dx = 1 + elif dy == 0: + dy = 1 + elif dz == 0: + dz = 1 + else: + raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the step size should not be less than the spatial discretisation') + + if G.messages: + print('Receiver array {:g}m, {:g}m, {:g}m, to {:g}m, {:g}m, {:g}m with steps {:g}m, {:g}m, {:g} created.'.format(xs * G.dx, ys * G.dy, zs * G.dz, xf * G.dx, yf * G.dy, zf * G.dz, dx * G.dx, dy * G.dy, dz * G.dz)) + for x in range(xs, xf, dx): for y in range(ys, yf, dy): for z in range(zs, zf, dz): @@ -399,12 +409,12 @@ def process_multicmds(multicmds, G): r.xcoordbase = x r.ycoordbase = y r.zcoordbase = z + r.outputs = Rx.availableoutputs[0:9] r.ID = 'Rx(' + str(x) + ',' + str(y) + ',' + str(z) + ')' + if G.messages: + print('Receiver at {:g}m, {:g}m, {:g}m with output(s) {} created.'.format(r.xcoord * G.dx, r.ycoord * G.dy, r.zcoord * G.dz, ', '.join(r.outputs))) G.rxs.append(r) - if G.messages: - print('Receiver box {:g}m, {:g}m, {:g}m, to {:g}m, {:g}m, {:g}m with steps {:g}m, {:g}m, {:g} created.'.format(xs * G.dx, ys * G.dy, zs * G.dz, xf * G.dx, yf * G.dy, zf * G.dz, dx * G.dx, dy * G.dy, dz * G.dz)) - # Snapshot cmdname = '#snapshot'