你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Tidy up some imports and syntax
这个提交包含在:
@@ -25,8 +25,9 @@ from .cmds_geometry.triangle import Triangle
|
||||
from .cmds_multiuse import (PMLCFS, AddDebyeDispersion, AddDrudeDispersion,
|
||||
AddLorentzDispersion, GeometryObjectsWrite,
|
||||
GeometryView, HertzianDipole, MagneticDipole,
|
||||
Material, Rx, RxArray, Snapshot, SoilPeplinski,
|
||||
TransmissionLine, VoltageSource, Waveform, MaterialRange, MaterialList)
|
||||
Material, MaterialList, MaterialRange, Rx, RxArray,
|
||||
Snapshot, SoilPeplinski, TransmissionLine,
|
||||
VoltageSource, Waveform)
|
||||
from .cmds_singleuse import (Discretisation, Domain, ExcitationFile,
|
||||
OMPThreads, PMLProps, RxSteps, SrcSteps,
|
||||
TimeStepStabilityFactor, TimeWindow, Title)
|
||||
|
@@ -212,6 +212,7 @@ def check_cmd_names(processedlines, checkessential=True):
|
||||
# - these will be lists within the dictionary
|
||||
multiplecmds = {key: [] for key in ['#geometry_view',
|
||||
'#geometry_objects_write', '#material',
|
||||
'#material_range', '#material_list',
|
||||
'#soil_peplinski',
|
||||
'#add_dispersion_debye',
|
||||
'#add_dispersion_lorentz',
|
||||
@@ -219,14 +220,14 @@ def check_cmd_names(processedlines, checkessential=True):
|
||||
'#waveform', '#voltage_source',
|
||||
'#hertzian_dipole', '#magnetic_dipole',
|
||||
'#transmission_line', '#rx', '#rx_array',
|
||||
'#snapshot', '#include_file', '#material_range', '#material_list']}
|
||||
'#snapshot', '#include_file']}
|
||||
|
||||
# Geometry object building commands that there can be multiple instances
|
||||
# of in a model - these will be lists within the dictionary
|
||||
geometrycmds = ['#geometry_objects_read', '#edge', '#plate', '#triangle',
|
||||
'#box', '#sphere', '#ellipsoid', '#cone', '#cylinder', '#cylindrical_sector',
|
||||
'#fractal_box', '#add_surface_roughness',
|
||||
'#add_surface_water', '#add_grass']
|
||||
'#box', '#sphere', '#ellipsoid', '#cone', '#cylinder',
|
||||
'#cylindrical_sector', '#fractal_box',
|
||||
'#add_surface_roughness', '#add_surface_water', '#add_grass']
|
||||
# List to store all geometry object commands in order from input file
|
||||
geometry = []
|
||||
|
||||
|
@@ -17,21 +17,22 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
|
||||
from .cmds_geometry.add_grass import AddGrass
|
||||
from .cmds_geometry.add_surface_roughness import AddSurfaceRoughness
|
||||
from .cmds_geometry.add_surface_water import AddSurfaceWater
|
||||
from .cmds_geometry.box import Box
|
||||
from .cmds_geometry.cylinder import Cylinder
|
||||
from .cmds_geometry.cone import Cone
|
||||
from .cmds_geometry.cylinder import Cylinder
|
||||
from .cmds_geometry.cylindrical_sector import CylindricalSector
|
||||
from .cmds_geometry.edge import Edge
|
||||
from .cmds_geometry.ellipsoid import Ellipsoid
|
||||
from .cmds_geometry.fractal_box import FractalBox
|
||||
from .cmds_geometry.plate import Plate
|
||||
from .cmds_geometry.sphere import Sphere
|
||||
from .cmds_geometry.triangle import Triangle
|
||||
from .cmds_geometry.ellipsoid import Ellipsoid
|
||||
from .utilities.utilities import round_value
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -76,7 +77,8 @@ def process_geometrycmds(geometry):
|
||||
tmp = object.split()
|
||||
|
||||
if tmp[0] == '#geometry_objects_read:':
|
||||
from .cmds_geometry.geometry_objects_read import GeometryObjectsRead
|
||||
from .cmds_geometry.geometry_objects_read import \
|
||||
GeometryObjectsRead
|
||||
|
||||
if len(tmp) != 6:
|
||||
logger.exception("'" + ' '.join(tmp) + "'" +
|
||||
@@ -219,7 +221,6 @@ def process_geometrycmds(geometry):
|
||||
|
||||
scene_objects.append(cylinder)
|
||||
|
||||
|
||||
elif tmp[0] == '#cone:':
|
||||
if len(tmp) < 10:
|
||||
logger.exception("'" + ' '.join(tmp) + "'" +
|
||||
@@ -239,7 +240,7 @@ def process_geometrycmds(geometry):
|
||||
elif len(tmp) == 11:
|
||||
averaging = check_averaging(tmp[10].lower())
|
||||
cone = Cone(p1=p1, p2=p2, r1=r1, r2=r2, material_id=tmp[9],
|
||||
averaging=averaging)
|
||||
averaging=averaging)
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
elif len(tmp) == 12:
|
||||
@@ -252,7 +253,6 @@ def process_geometrycmds(geometry):
|
||||
|
||||
scene_objects.append(cone)
|
||||
|
||||
|
||||
elif tmp[0] == '#cylindrical_sector:':
|
||||
if len(tmp) < 10:
|
||||
logger.exception("'" + ' '.join(tmp) + "'" +
|
||||
@@ -331,7 +331,6 @@ def process_geometrycmds(geometry):
|
||||
|
||||
scene_objects.append(sphere)
|
||||
|
||||
|
||||
elif tmp[0] == '#ellipsoid:':
|
||||
if len(tmp) < 8:
|
||||
logger.exception("'" + ' '.join(tmp) + "'" +
|
||||
@@ -345,17 +344,19 @@ def process_geometrycmds(geometry):
|
||||
|
||||
# Isotropic case with no user specified averaging
|
||||
if len(tmp) == 8:
|
||||
ellipsoid = Ellipsoid(p1=p1, xr=xr, yr=yr, zr=zr, material_id=tmp[7])
|
||||
ellipsoid = Ellipsoid(p1=p1, xr=xr, yr=yr, zr=zr,
|
||||
material_id=tmp[7])
|
||||
|
||||
# Isotropic case with user specified averaging
|
||||
elif len(tmp) == 9:
|
||||
averaging = check_averaging(tmp[8].lower())
|
||||
ellipsoid = Ellipsoid(p1=p1, xr=xr, yr=yr, zr=zr, material_id=tmp[7],
|
||||
averaging=averaging)
|
||||
ellipsoid = Ellipsoid(p1=p1, xr=xr, yr=yr, zr=zr,
|
||||
material_id=tmp[7], averaging=averaging)
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
elif len(tmp) == 8:
|
||||
ellipsoid = Ellipsoid(p1=p1, xr=xr, yr=yr, zr=zr, material_id=tmp[7:])
|
||||
ellipsoid = Ellipsoid(p1=p1, xr=xr, yr=yr, zr=zr,
|
||||
material_id=tmp[7:])
|
||||
|
||||
else:
|
||||
logger.exception("'" + ' '.join(tmp) + "'" +
|
||||
@@ -364,8 +365,6 @@ def process_geometrycmds(geometry):
|
||||
|
||||
scene_objects.append(ellipsoid)
|
||||
|
||||
|
||||
|
||||
elif tmp[0] == '#fractal_box:':
|
||||
# Default is no dielectric smoothing for a fractal box
|
||||
|
||||
@@ -479,4 +478,4 @@ def process_geometrycmds(geometry):
|
||||
|
||||
scene_objects.append(grass)
|
||||
|
||||
return scene_objects
|
||||
return scene_objects
|
@@ -21,8 +21,9 @@ import logging
|
||||
from .cmds_multiuse import (AddDebyeDispersion, AddDrudeDispersion,
|
||||
AddLorentzDispersion, GeometryObjectsWrite,
|
||||
GeometryView, HertzianDipole, MagneticDipole,
|
||||
Material, Rx, RxArray, Snapshot, SoilPeplinski,
|
||||
TransmissionLine, VoltageSource, Waveform, MaterialRange, MaterialList)
|
||||
Material, MaterialList, MaterialRange, Rx, RxArray,
|
||||
Snapshot, SoilPeplinski, TransmissionLine,
|
||||
VoltageSource, Waveform)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -352,17 +353,16 @@ def process_multicmds(multicmds):
|
||||
' requires at exactly nine parameters')
|
||||
raise ValueError
|
||||
material_range = MaterialRange(er_lower=float(tmp[0]),
|
||||
er_upper=float(tmp[1]),
|
||||
sigma_lower=float(tmp[2]),
|
||||
sigma_upper=float(tmp[3]),
|
||||
mr_lower=float(tmp[4]),
|
||||
mr_upper=float(tmp[5]),
|
||||
ro_lower=float(tmp[6]),
|
||||
ro_upper=float(tmp[7]),
|
||||
id=tmp[8])
|
||||
er_upper=float(tmp[1]),
|
||||
sigma_lower=float(tmp[2]),
|
||||
sigma_upper=float(tmp[3]),
|
||||
mr_lower=float(tmp[4]),
|
||||
mr_upper=float(tmp[5]),
|
||||
ro_lower=float(tmp[6]),
|
||||
ro_upper=float(tmp[7]),
|
||||
id=tmp[8])
|
||||
scene_objects.append(material_range)
|
||||
|
||||
|
||||
cmdname = '#material_list'
|
||||
if multicmds[cmdname] is not None:
|
||||
for cmdinstance in multicmds[cmdname]:
|
||||
@@ -375,14 +375,11 @@ def process_multicmds(multicmds):
|
||||
|
||||
tokens = len(tmp)
|
||||
lmats = []
|
||||
for iter in range(0,tokens-1):
|
||||
for iter in range(tokens-1):
|
||||
lmats.append(tmp[iter])
|
||||
|
||||
|
||||
|
||||
material_list = MaterialList(list_of_materials=lmats,
|
||||
id=tmp[tokens-1])
|
||||
material_list = MaterialList(list_of_materials=lmats,
|
||||
id=tmp[tokens-1])
|
||||
scene_objects.append(material_list)
|
||||
|
||||
|
||||
return scene_objects
|
||||
return scene_objects
|
在新工单中引用
屏蔽一个用户