你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Updated a few more files to make their code much cleaner and better.
这个提交包含在:
@@ -88,24 +88,25 @@ class CylindricalSector(UserObjectGeometry):
|
||||
try:
|
||||
materialsrequested = self.kwargs['material_ids']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' No materials have been specified')
|
||||
logger.exception(f'{self.__str__()} No materials have been specified')
|
||||
raise
|
||||
|
||||
sectorstartangle = 2 * np.pi * (start / 360)
|
||||
sectorangle = 2 * np.pi * (end / 360)
|
||||
|
||||
if normal != 'x' and normal != 'y' and normal != 'z':
|
||||
logger.exception(self.__str__() + ' the normal direction must be either x, y or z.')
|
||||
if normal not in ['x', 'y', 'z']:
|
||||
logger.exception(f'{self.__str__()} the normal direction must be either ' +
|
||||
f'x, y or z.')
|
||||
raise ValueError
|
||||
if r <= 0:
|
||||
logger.exception(self.__str__() + f' the radius {r:g} should be a positive value.')
|
||||
logger.exception(f'{self.__str__()} the radius {r:g} should be a positive value.')
|
||||
if sectorstartangle < 0 or sectorangle <= 0:
|
||||
logger.exception(self.__str__() + ' the starting angle and sector ' +
|
||||
'angle should be a positive values.')
|
||||
logger.exception(f'{self.__str__()} the starting angle and sector angle should be ' +
|
||||
f'a positive values.')
|
||||
raise ValueError
|
||||
if sectorstartangle >= 2 * np.pi or sectorangle >= 2 * np.pi:
|
||||
logger.exception(self.__str__() + ' the starting angle and sector ' +
|
||||
'angle must be less than 360 degrees.')
|
||||
logger.exception(f'{self.__str__()} the starting angle and sector angle must be ' +
|
||||
f'less than 360 degrees.')
|
||||
raise ValueError
|
||||
|
||||
# Look up requested materials in existing list of material instances
|
||||
@@ -113,7 +114,7 @@ class CylindricalSector(UserObjectGeometry):
|
||||
|
||||
if len(materials) != len(materialsrequested):
|
||||
notfound = [x for x in materialsrequested if x not in materials]
|
||||
logger.exception(self.__str__() + f' material(s) {notfound} do not exist')
|
||||
logger.exception(f'{self.__str__()} material(s) {notfound} do not exist')
|
||||
raise ValueError
|
||||
|
||||
if thickness > 0:
|
||||
@@ -122,13 +123,12 @@ class CylindricalSector(UserObjectGeometry):
|
||||
averaging = materials[0].averagable and averagecylindricalsector
|
||||
numID = numIDx = numIDy = numIDz = materials[0].numID
|
||||
|
||||
# Uniaxial anisotropic case
|
||||
elif len(materials) == 3:
|
||||
averaging = False
|
||||
numIDx = materials[0].numID
|
||||
numIDy = materials[1].numID
|
||||
numIDz = materials[2].numID
|
||||
requiredID = materials[0].ID + '+' + materials[1].ID + '+' + materials[2].ID
|
||||
requiredID = f'{materials[0].ID}+{materials[1].ID}+{materials[2].ID}'
|
||||
averagedmaterial = [x for x in grid.materials if x.ID == requiredID]
|
||||
if averagedmaterial:
|
||||
numID = averagedmaterial.numID
|
||||
|
@@ -62,15 +62,15 @@ class Edge(UserObjectGeometry):
|
||||
p2 = self.kwargs['p2']
|
||||
material_id = self.kwargs['material_id']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' requires exactly 3 parameters')
|
||||
logger.exception(f'{self.__str__()} requires exactly 3 parameters')
|
||||
raise
|
||||
|
||||
if self.do_rotate:
|
||||
self._do_rotate()
|
||||
|
||||
|
||||
p3 = uip.round_to_grid_static_point(p1)
|
||||
p4 = uip.round_to_grid_static_point(p2)
|
||||
|
||||
|
||||
p1, p2 = uip.check_box_points(p1, p2, self.__str__())
|
||||
xs, ys, zs = p1
|
||||
xf, yf, zf = p2
|
||||
@@ -83,31 +83,24 @@ class Edge(UserObjectGeometry):
|
||||
|
||||
# Check for valid orientations
|
||||
# x-orientated edge
|
||||
if xs != xf:
|
||||
if ys != yf or zs != zf:
|
||||
logger.exception(self.__str__() + ' the edge is not specified correctly')
|
||||
raise ValueError
|
||||
else:
|
||||
for i in range(xs, xf):
|
||||
build_edge_x(i, ys, zs, material.numID, grid.rigidE, grid.rigidH, grid.ID)
|
||||
if (xs != xf
|
||||
and (ys != yf or zs != zf)
|
||||
or xs == xf
|
||||
and ys != yf
|
||||
and zs != zf):
|
||||
logger.exception(f'{self.__str__()} the edge is not specified correctly')
|
||||
raise ValueError
|
||||
elif xs != xf:
|
||||
for i in range(xs, xf):
|
||||
build_edge_x(i, ys, zs, material.numID, grid.rigidE, grid.rigidH, grid.ID)
|
||||
|
||||
# y-orientated edge
|
||||
elif ys != yf:
|
||||
if xs != xf or zs != zf:
|
||||
logger.exception(self.__str__() + ' the edge is not specified correctly')
|
||||
raise ValueError
|
||||
else:
|
||||
for j in range(ys, yf):
|
||||
build_edge_y(xs, j, zs, material.numID, grid.rigidE, grid.rigidH, grid.ID)
|
||||
for j in range(ys, yf):
|
||||
build_edge_y(xs, j, zs, material.numID, grid.rigidE, grid.rigidH, grid.ID)
|
||||
|
||||
# z-orientated edge
|
||||
elif zs != zf:
|
||||
if xs != xf or ys != yf:
|
||||
logger.exception(self.__str__() + ' the edge is not specified correctly')
|
||||
raise ValueError
|
||||
else:
|
||||
for k in range(zs, zf):
|
||||
build_edge_z(xs, ys, k, material.numID, grid.rigidE, grid.rigidH, grid.ID)
|
||||
for k in range(zs, zf):
|
||||
build_edge_z(xs, ys, k, material.numID, grid.rigidE, grid.rigidH, grid.ID)
|
||||
|
||||
logger.info(self.grid_name(grid) + f'Edge from {p3[0]:g}m, {p3[1]:g}m, ' +
|
||||
f'{p3[2]:g}m, to {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m of ' +
|
||||
|
@@ -53,7 +53,7 @@ class Ellipsoid(UserObjectGeometry):
|
||||
zr = self.kwargs['zr']
|
||||
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' please specify a point and the three semiaxes.')
|
||||
logger.exception(f'{self.__str__()} please specify a point and the three semiaxes.')
|
||||
raise
|
||||
|
||||
# Check averaging
|
||||
@@ -73,7 +73,7 @@ class Ellipsoid(UserObjectGeometry):
|
||||
try:
|
||||
materialsrequested = self.kwargs['material_ids']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' no materials have been specified')
|
||||
logger.exception(f'{self.__str__()} no materials have been specified')
|
||||
raise
|
||||
|
||||
# Centre of sphere
|
||||
@@ -86,7 +86,7 @@ class Ellipsoid(UserObjectGeometry):
|
||||
|
||||
if len(materials) != len(materialsrequested):
|
||||
notfound = [x for x in materialsrequested if x not in materials]
|
||||
logger.exception(self.__str__() + f' material(s) {notfound} do not exist')
|
||||
logger.exception(f'{self.__str__()} material(s) {notfound} do not exist')
|
||||
raise ValueError
|
||||
|
||||
# Isotropic case
|
||||
|
在新工单中引用
屏蔽一个用户