Changed #rx_box to #rx_array, and allowed it to do lines of receivers as well as 2D grids.

这个提交包含在:
craig-warren
2016-06-15 12:19:55 +08:00
父节点 c9c627720a
当前提交 6eee175620
共有 4 个文件被更改,包括 8 次插入10 次删除

查看文件

@@ -771,14 +771,14 @@ Allows you to introduce output points into the model. These are locations where
* When the optional parameters ``str1`` and ``str2`` are not given all the electric and magnetic field components and currents will be output with the receiver point.
#rx_box:
#rx_array:
--------
Provides a simple method of defining multiple output points in the model. The syntax of the command is:
.. code-block:: none
#rx_box: f1 f2 f3 f4 f5 f6 f7 f8 f9
#rx_array: f1 f2 f3 f4 f5 f6 f7 f8 f9
* ``f1 f2 f3`` are the lower left (x,y,z) coordinates of the output volume, and ``f4 f5 f6`` are the upper right (x,y,z) coordinates of the output volume.
* ``f7 f8 f9`` are the increments (x,y,z) which define the number of output points in each direction. The minimum value of ``f7`` is :math:`\Delta x`, the minimum value of ``f8`` is :math:`\Delta y`, and the minimum value of ``f9`` is :math:`\Delta z`.
@@ -793,7 +793,7 @@ Provides a simple method to allow you to move the location of all simple sources
#src_steps: f1 f2 f3
#rx_steps: f1 f2 f3
``f1 f2 f3`` are increments (x,y,z) to move all simple sources (``#hertzian_dipole`` or ``#magnetic_dipole``) or all receivers (created using either ``#rx`` or ``#rx_box`` commands).
``f1 f2 f3`` are increments (x,y,z) to move all simple sources (``#hertzian_dipole`` or ``#magnetic_dipole``) or all receivers (created using either ``#rx`` or ``#rx_array`` commands).
.. note::

查看文件

@@ -34,8 +34,6 @@ def process_python_include_code(inputfile, usernamespace):
processedlines (list): Input commands after Python processing.
"""
userpython = False
with open(inputfile, 'r') as f:
# Strip out any newline characters and comments that must begin with double hashes
inputlines = [line.rstrip() for line in f if(not line.startswith('##') and line.rstrip('\n'))]
@@ -150,7 +148,7 @@ def check_cmd_names(processedlines, checkessential=True):
singlecmds = dict.fromkeys(['#domain', '#dx_dy_dz', '#time_window', '#title', '#messages', '#num_threads', '#time_step_stability_factor', '#pml_cells', '#excitation_file', '#src_steps', '#rx_steps', '#taguchi', '#end_taguchi'], 'None')
# Commands that there can be multiple instances of in a model - these will be lists within the dictionary
multiplecmds = {key: [] for key in ['#geometry_view', '#material', '#soil_peplinski', '#add_dispersion_debye', '#add_dispersion_lorentz', '#add_dispersion_drude', '#waveform', '#voltage_source', '#hertzian_dipole', '#magnetic_dipole', '#transmission_line', '#rx', '#rx_box', '#snapshot', '#pml_cfs']}
multiplecmds = {key: [] for key in ['#geometry_view', '#material', '#soil_peplinski', '#add_dispersion_debye', '#add_dispersion_lorentz', '#add_dispersion_drude', '#waveform', '#voltage_source', '#hertzian_dipole', '#magnetic_dipole', '#transmission_line', '#rx', '#rx_array', '#snapshot', '#pml_cfs']}
# Geometry object building commands that there can be multiple instances of in a model - these will be lists within the dictionary
geometrycmds = ['#geometry_objects_file', '#edge', '#plate', '#triangle', '#box', '#sphere', '#cylinder', '#cylindrical_sector', '#fractal_box', '#add_surface_roughness', '#add_surface_water', '#add_grass']

查看文件

@@ -358,7 +358,7 @@ def process_multicmds(multicmds, G):
# Receiver box
cmdname = '#rx_box'
cmdname = '#rx_array'
if multicmds[cmdname] != 'None':
for cmdinstance in multicmds[cmdname]:
tmp = cmdinstance.split()
@@ -382,7 +382,7 @@ def process_multicmds(multicmds, G):
if xcoord < G.pmlthickness[0] or xcoord > G.nx - G.pmlthickness[3] or ycoord < G.pmlthickness[1] or ycoord > G.ny - G.pmlthickness[4] or zcoord < G.pmlthickness[2] or zcoord > G.nz - G.pmlthickness[5]:
print("WARNING: '" + cmdname + ': ' + ' '.join(tmp) + "'" + ' sources and receivers should not normally be positioned within the PML.\n')
if xs >= xf or ys >= yf or zs >= zf:
if xs > xf or ys > yf or zs > zf:
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the lower coordinates should be less than the upper coordinates')
if dx < 0 or dy < 0 or dz < 0:
raise CmdInputError("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' the step size should not be less than zero')

查看文件

@@ -142,7 +142,7 @@ while(lindex < len(inputlines)):
elif cmdname == '#rx_box':
if model2D:
# Syntax of old command: #rx_box: x1 y1 x2 y2 dx dy
replacement = '#rx_box: {} {} {} {} {} {} {} {} {}'.format(params[0], params[1], 0, params[2], params[3], dx_dy_dz[2], params[4], params[5], dx_dy_dz[2])
replacement = '#rx_array: {} {} {} {} {} {} {} {} {}'.format(params[0], params[1], 0, params[2], params[3], dx_dy_dz[2], params[4], params[5], dx_dy_dz[2])
print("Command '{}', replaced with '{}'".format(inputlines[lindex], replacement))
inputlines.pop(lindex)
inputlines.insert(lindex, replacement)