你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 23:14:03 +08:00
Revert scene to operate on FDTDGrid not Model
这个提交包含在:
@@ -17,7 +17,7 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
from typing import List, Optional, Union
|
||||
from typing import List, Union
|
||||
|
||||
from gprMax.cmds_geometry.add_grass import AddGrass
|
||||
from gprMax.cmds_geometry.add_surface_roughness import AddSurfaceRoughness
|
||||
@@ -26,8 +26,8 @@ from gprMax.cmds_geometry.cmds_geometry import UserObjectGeometry
|
||||
from gprMax.cmds_geometry.fractal_box import FractalBox
|
||||
from gprMax.cmds_multiuse import UserObjectMulti
|
||||
from gprMax.cmds_singleuse import Discretisation, Domain, TimeWindow, UserObjectSingle
|
||||
from gprMax.grid.fdtd_grid import FDTDGrid
|
||||
from gprMax.materials import create_built_in_materials
|
||||
from gprMax.model import Model
|
||||
from gprMax.subgrids.grid import SubGridBaseGrid
|
||||
from gprMax.subgrids.user_objects import SubGridBase as SubGridUserBase
|
||||
from gprMax.user_inputs import create_user_input_points
|
||||
@@ -75,7 +75,7 @@ class Scene:
|
||||
logger.exception("Error creating user input object")
|
||||
raise
|
||||
|
||||
def process_subgrid_cmds(self, model: Model):
|
||||
def process_subgrid_cmds(self):
|
||||
"""Process all commands in any sub-grids."""
|
||||
|
||||
# Subgrid user objects
|
||||
@@ -89,17 +89,13 @@ class Scene:
|
||||
# object. This reference allows the multi and geo user objects
|
||||
# to build in the correct subgrid.
|
||||
sg = sg_cmd.subgrid
|
||||
self.process_cmds(sg_cmd.children_multiple, model, sg)
|
||||
self.process_cmds(sg_cmd.children_multiple, sg)
|
||||
self.process_geocmds(sg_cmd.children_geometry, sg)
|
||||
|
||||
def process_cmds(
|
||||
self,
|
||||
commands: Union[List[UserObjectMulti], List[UserObjectSingle]],
|
||||
model: Model,
|
||||
subgrid: Optional[SubGridBaseGrid] = None,
|
||||
self, commands: Union[List[UserObjectMulti], List[UserObjectSingle]], grid: FDTDGrid
|
||||
):
|
||||
"""Process list of commands."""
|
||||
grid = model.G if subgrid is None else subgrid
|
||||
cmds_sorted = sorted(commands, key=lambda cmd: cmd.order)
|
||||
for obj in cmds_sorted:
|
||||
self.build_obj(obj, grid)
|
||||
@@ -123,7 +119,7 @@ class Scene:
|
||||
|
||||
return self
|
||||
|
||||
def process_singlecmds(self, model: Model):
|
||||
def process_singlecmds(self, G: FDTDGrid):
|
||||
# Check for duplicate commands and warn user if they exist
|
||||
cmds_unique = list(set(self.single_cmds))
|
||||
if len(cmds_unique) != len(self.single_cmds):
|
||||
@@ -141,7 +137,7 @@ class Scene:
|
||||
)
|
||||
raise ValueError
|
||||
|
||||
self.process_cmds(cmds_unique, model)
|
||||
self.process_cmds(cmds_unique, G)
|
||||
|
||||
def create_internal_objects(self, G):
|
||||
"""Calls the UserObject.build() function in the correct way - API
|
||||
@@ -153,10 +149,10 @@ class Scene:
|
||||
create_built_in_materials(G)
|
||||
|
||||
# Process commands that can only have a single instance
|
||||
self.process_singlecmds(model)
|
||||
self.process_singlecmds(G)
|
||||
|
||||
# Process main grid multiple commands
|
||||
self.process_cmds(self.multiple_cmds, model)
|
||||
self.process_cmds(self.multiple_cmds, G)
|
||||
|
||||
# Initialise geometry arrays for main and subgrids
|
||||
for grid in [G] + G.subgrids:
|
||||
@@ -166,4 +162,4 @@ class Scene:
|
||||
self.process_geocmds(self.geometry_cmds, G)
|
||||
|
||||
# Process all the commands for subgrids
|
||||
self.process_subgrid_cmds(model)
|
||||
self.process_subgrid_cmds()
|
||||
|
在新工单中引用
屏蔽一个用户