你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 23:14:03 +08:00
Refactor Materials UserObject build process
这个提交包含在:
@@ -1256,7 +1256,7 @@ class Material(UserObjectMulti):
|
||||
self.order = 10
|
||||
self.hash = "#material"
|
||||
|
||||
def build(self, grid, uip):
|
||||
def build(self, model, uip):
|
||||
try:
|
||||
er = self.kwargs["er"]
|
||||
se = self.kwargs["se"]
|
||||
@@ -1289,13 +1289,13 @@ class Material(UserObjectMulti):
|
||||
if sm < 0:
|
||||
logger.exception(f"{self.params_str()} requires a positive value for magnetic loss.")
|
||||
raise ValueError
|
||||
if any(x.ID == material_id for x in grid.materials):
|
||||
if any(x.ID == material_id for x in model.materials):
|
||||
logger.exception(f"{self.params_str()} with ID {material_id} already exists")
|
||||
raise ValueError
|
||||
|
||||
# Create a new instance of the Material class material
|
||||
# (start index after pec & free_space)
|
||||
m = MaterialUser(len(grid.materials), material_id)
|
||||
m = MaterialUser(len(model.materials), material_id)
|
||||
m.se = se
|
||||
m.mr = mr
|
||||
m.sm = sm
|
||||
@@ -1306,12 +1306,12 @@ class Material(UserObjectMulti):
|
||||
|
||||
m.er = er
|
||||
logger.info(
|
||||
f"{self.grid_name(grid)}Material {m.ID} with eps_r={m.er:g}, "
|
||||
f"{[model.title]} Material {m.ID} with eps_r={m.er:g}, "
|
||||
f"sigma={m.se:g} S/m; mu_r={m.mr:g}, sigma*={m.sm:g} Ohm/m "
|
||||
f"created."
|
||||
)
|
||||
|
||||
grid.materials.append(m)
|
||||
model.materials.append(m)
|
||||
|
||||
|
||||
class AddDebyeDispersion(UserObjectMulti):
|
||||
|
@@ -76,7 +76,6 @@ class FDTDGrid:
|
||||
# TODO: Add type information.
|
||||
# Currently importing GeometryObjects, GeometryView, and
|
||||
# SubGridBaseGrid cause cyclic dependencies
|
||||
self.materials: List[Material] = []
|
||||
self.mixingmodels = []
|
||||
self.averagevolumeobjects = True
|
||||
self.fractalvolumes = []
|
||||
|
@@ -28,6 +28,7 @@ from colorama import Fore, Style, init
|
||||
|
||||
from gprMax.grid.cuda_grid import CUDAGrid
|
||||
from gprMax.grid.opencl_grid import OpenCLGrid
|
||||
from gprMax.materials import Material
|
||||
from gprMax.subgrids.grid import SubGridBaseGrid
|
||||
|
||||
init()
|
||||
@@ -64,6 +65,7 @@ class Model:
|
||||
|
||||
self.G = self._create_grid()
|
||||
self.subgrids: List[SubGridBaseGrid] = []
|
||||
self.materials: List[Material] = []
|
||||
|
||||
# Monitor memory usage
|
||||
self.p = None
|
||||
|
在新工单中引用
屏蔽一个用户