你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Fix bug preventing turning material averaging off
这个提交包含在:
@@ -24,7 +24,6 @@ from .user_objects.cmds_geometry.add_grass import AddGrass
|
||||
from .user_objects.cmds_geometry.add_surface_roughness import AddSurfaceRoughness
|
||||
from .user_objects.cmds_geometry.add_surface_water import AddSurfaceWater
|
||||
from .user_objects.cmds_geometry.box import Box
|
||||
from .user_objects.cmds_geometry.cmds_geometry import check_averaging
|
||||
from .user_objects.cmds_geometry.cone import Cone
|
||||
from .user_objects.cmds_geometry.cylinder import Cylinder
|
||||
from .user_objects.cmds_geometry.cylindrical_sector import CylindricalSector
|
||||
@@ -124,14 +123,13 @@ def process_geometrycmds(geometry):
|
||||
|
||||
# Isotropic case with user specified averaging
|
||||
elif len(tmp) == 13:
|
||||
averaging = check_averaging(tmp[12].lower())
|
||||
triangle = Triangle(
|
||||
p1=p1,
|
||||
p2=p2,
|
||||
p3=p3,
|
||||
thickness=thickness,
|
||||
material_id=tmp[11],
|
||||
averaging=averaging,
|
||||
averaging=tmp[12],
|
||||
)
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
@@ -158,7 +156,7 @@ def process_geometrycmds(geometry):
|
||||
|
||||
# Isotropic case with user specified averaging
|
||||
elif len(tmp) == 9:
|
||||
box = Box(p1=p1, p2=p2, material_id=tmp[7], averaging=tmp[8].lower())
|
||||
box = Box(p1=p1, p2=p2, material_id=tmp[7], averaging=tmp[8])
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
elif len(tmp) == 10:
|
||||
@@ -185,7 +183,7 @@ def process_geometrycmds(geometry):
|
||||
|
||||
# Isotropic case with user specified averaging
|
||||
elif len(tmp) == 10:
|
||||
cylinder = Cylinder(p1=p1, p2=p2, r=r, material_id=tmp[8], averaging=tmp[9].lower())
|
||||
cylinder = Cylinder(p1=p1, p2=p2, r=r, material_id=tmp[8], averaging=tmp[9])
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
elif len(tmp) == 11:
|
||||
@@ -219,7 +217,7 @@ def process_geometrycmds(geometry):
|
||||
r1=r1,
|
||||
r2=r2,
|
||||
material_id=tmp[9],
|
||||
averaging=tmp[10].lower(),
|
||||
averaging=tmp[10],
|
||||
)
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
@@ -271,7 +269,7 @@ def process_geometrycmds(geometry):
|
||||
r=r,
|
||||
start=start,
|
||||
end=end,
|
||||
averaging=tmp[10].lower(),
|
||||
averaging=tmp[10],
|
||||
material_id=tmp[9],
|
||||
)
|
||||
|
||||
@@ -309,7 +307,7 @@ def process_geometrycmds(geometry):
|
||||
|
||||
# Isotropic case with user specified averaging
|
||||
elif len(tmp) == 7:
|
||||
sphere = Sphere(p1=p1, r=r, material_id=tmp[5], averaging=tmp[6].lower())
|
||||
sphere = Sphere(p1=p1, r=r, material_id=tmp[5], averaging=tmp[6])
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
elif len(tmp) == 8:
|
||||
@@ -337,9 +335,13 @@ def process_geometrycmds(geometry):
|
||||
|
||||
# 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
|
||||
p1=p1,
|
||||
xr=xr,
|
||||
yr=yr,
|
||||
zr=zr,
|
||||
material_id=tmp[7],
|
||||
averaging=tmp[8],
|
||||
)
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
@@ -400,7 +402,7 @@ def process_geometrycmds(geometry):
|
||||
mixing_model_id=mixing_model_id,
|
||||
id=ID,
|
||||
seed=tmp[14],
|
||||
averaging=tmp[15].lower(),
|
||||
averaging=tmp[15],
|
||||
)
|
||||
else:
|
||||
logger.exception("'" + " ".join(tmp) + "'" + " too many parameters have been given")
|
||||
|
@@ -27,7 +27,7 @@ from gprMax.materials import Material
|
||||
from gprMax.user_objects.rotatable import RotatableMixin
|
||||
from gprMax.user_objects.user_objects import GeometryUserObject
|
||||
|
||||
from .cmds_geometry import rotate_2point_object
|
||||
from .cmds_geometry import check_averaging, rotate_2point_object
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -85,7 +85,7 @@ class Box(RotatableMixin, GeometryUserObject):
|
||||
# Check averaging
|
||||
try:
|
||||
# Try user-specified averaging
|
||||
averagebox = self.kwargs["averaging"]
|
||||
averagebox = check_averaging(self.kwargs["averaging"])
|
||||
except KeyError:
|
||||
# Otherwise go with the grid default
|
||||
averagebox = grid.averagevolumeobjects
|
||||
|
@@ -37,9 +37,9 @@ def check_averaging(averaging):
|
||||
averaging: boolean for geometry object material averaging.
|
||||
"""
|
||||
|
||||
if averaging == "y":
|
||||
if averaging.lower() == "y":
|
||||
averaging = True
|
||||
elif averaging == "n":
|
||||
elif averaging.lower() == "n":
|
||||
averaging = False
|
||||
else:
|
||||
logger.exception("Averaging should be either y or n")
|
||||
|
@@ -23,6 +23,7 @@ import numpy as np
|
||||
from gprMax.cython.geometry_primitives import build_cone
|
||||
from gprMax.grid.fdtd_grid import FDTDGrid
|
||||
from gprMax.materials import Material
|
||||
from gprMax.user_objects.cmds_geometry.cmds_geometry import check_averaging
|
||||
from gprMax.user_objects.user_objects import GeometryUserObject
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -65,7 +66,7 @@ class Cone(GeometryUserObject):
|
||||
# Check averaging
|
||||
try:
|
||||
# Try user-specified averaging
|
||||
averagecone = self.kwargs["averaging"]
|
||||
averagecone = check_averaging(self.kwargs["averaging"])
|
||||
except KeyError:
|
||||
# Otherwise go with the grid default
|
||||
averagecone = grid.averagevolumeobjects
|
||||
|
@@ -23,6 +23,7 @@ import numpy as np
|
||||
from gprMax.cython.geometry_primitives import build_cylinder
|
||||
from gprMax.grid.fdtd_grid import FDTDGrid
|
||||
from gprMax.materials import Material
|
||||
from gprMax.user_objects.cmds_geometry.cmds_geometry import check_averaging
|
||||
from gprMax.user_objects.user_objects import GeometryUserObject
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -62,7 +63,7 @@ class Cylinder(GeometryUserObject):
|
||||
# Check averaging
|
||||
try:
|
||||
# Try user-specified averaging
|
||||
averagecylinder = self.kwargs["averaging"]
|
||||
averagecylinder = check_averaging(self.kwargs["averaging"])
|
||||
except KeyError:
|
||||
# Otherwise go with the grid default
|
||||
averagecylinder = grid.averagevolumeobjects
|
||||
|
@@ -23,6 +23,7 @@ import numpy as np
|
||||
from gprMax.cython.geometry_primitives import build_cylindrical_sector
|
||||
from gprMax.grid.fdtd_grid import FDTDGrid
|
||||
from gprMax.materials import Material
|
||||
from gprMax.user_objects.cmds_geometry.cmds_geometry import check_averaging
|
||||
from gprMax.user_objects.user_objects import GeometryUserObject
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -102,7 +103,7 @@ class CylindricalSector(GeometryUserObject):
|
||||
# Check averaging
|
||||
try:
|
||||
# Try user-specified averaging
|
||||
averagecylindricalsector = self.kwargs["averaging"]
|
||||
averagecylindricalsector = check_averaging(self.kwargs["averaging"])
|
||||
except KeyError:
|
||||
# Otherwise go with the grid default
|
||||
averagecylindricalsector = grid.averagevolumeobjects
|
||||
|
@@ -23,6 +23,7 @@ import numpy as np
|
||||
from gprMax.cython.geometry_primitives import build_ellipsoid
|
||||
from gprMax.grid.fdtd_grid import FDTDGrid
|
||||
from gprMax.materials import Material
|
||||
from gprMax.user_objects.cmds_geometry.cmds_geometry import check_averaging
|
||||
from gprMax.user_objects.user_objects import GeometryUserObject
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -63,7 +64,7 @@ class Ellipsoid(GeometryUserObject):
|
||||
# Check averaging
|
||||
try:
|
||||
# Try user-specified averaging
|
||||
averageellipsoid = self.kwargs["averaging"]
|
||||
averageellipsoid = check_averaging(self.kwargs["averaging"])
|
||||
except KeyError:
|
||||
# Otherwise go with the grid default
|
||||
averageellipsoid = grid.averagevolumeobjects
|
||||
|
@@ -25,7 +25,7 @@ from gprMax.cython.geometry_primitives import build_voxels_from_array, build_vox
|
||||
from gprMax.fractals import FractalVolume
|
||||
from gprMax.grid.fdtd_grid import FDTDGrid
|
||||
from gprMax.materials import ListMaterial
|
||||
from gprMax.user_objects.cmds_geometry.cmds_geometry import rotate_2point_object
|
||||
from gprMax.user_objects.cmds_geometry.cmds_geometry import check_averaging, rotate_2point_object
|
||||
from gprMax.user_objects.rotatable import RotatableMixin
|
||||
from gprMax.user_objects.user_objects import GeometryUserObject
|
||||
|
||||
@@ -100,7 +100,7 @@ class FractalBox(RotatableMixin, GeometryUserObject):
|
||||
# Check averaging
|
||||
try:
|
||||
# Go with user specified averaging
|
||||
averagefractalbox = self.kwargs["averaging"]
|
||||
averagefractalbox = check_averaging(self.kwargs["averaging"])
|
||||
except KeyError:
|
||||
# If they havent specified - default is no dielectric smoothing for
|
||||
# a fractal box.
|
||||
|
@@ -23,6 +23,7 @@ import numpy as np
|
||||
from gprMax.cython.geometry_primitives import build_sphere
|
||||
from gprMax.grid.fdtd_grid import FDTDGrid
|
||||
from gprMax.materials import Material
|
||||
from gprMax.user_objects.cmds_geometry.cmds_geometry import check_averaging
|
||||
from gprMax.user_objects.user_objects import GeometryUserObject
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -58,7 +59,7 @@ class Sphere(GeometryUserObject):
|
||||
# Check averaging
|
||||
try:
|
||||
# Try user-specified averaging
|
||||
averagesphere = self.kwargs["averaging"]
|
||||
averagesphere = check_averaging(self.kwargs["averaging"])
|
||||
except KeyError:
|
||||
# Otherwise go with the grid default
|
||||
averagesphere = grid.averagevolumeobjects
|
||||
|
@@ -26,7 +26,7 @@ from gprMax.materials import Material
|
||||
from gprMax.user_objects.rotatable import RotatableMixin
|
||||
from gprMax.user_objects.user_objects import GeometryUserObject
|
||||
|
||||
from .cmds_geometry import rotate_point
|
||||
from .cmds_geometry import check_averaging, rotate_point
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -79,7 +79,7 @@ class Triangle(RotatableMixin, GeometryUserObject):
|
||||
# Check averaging
|
||||
try:
|
||||
# Try user-specified averaging
|
||||
averagetriangularprism = self.kwargs["averaging"]
|
||||
averagetriangularprism = check_averaging(self.kwargs["averaging"])
|
||||
except KeyError:
|
||||
# Otherwise go with the grid default
|
||||
averagetriangularprism = grid.averagevolumeobjects
|
||||
|
在新工单中引用
屏蔽一个用户