你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Prepare for reorganisation of updates.py
这个提交包含在:
@@ -20,7 +20,7 @@ import gprMax.config as config
|
||||
|
||||
from .grid import CUDAGrid, FDTDGrid, OpenCLGrid
|
||||
from .subgrids.updates import create_updates as create_subgrid_updates
|
||||
from .updates import CPUUpdates, CUDAUpdates, OpenCLUpdates
|
||||
from .updates.updates import CPUUpdates, CUDAUpdates, OpenCLUpdates
|
||||
|
||||
|
||||
def create_G():
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from ..updates import CPUUpdates
|
||||
from ..updates.updates import CPUUpdates
|
||||
from .precursor_nodes import PrecursorNodes, PrecursorNodesFiltered
|
||||
from .subgrid_hsg import SubGridHSG
|
||||
|
||||
|
@@ -25,14 +25,14 @@ from jinja2 import Environment, PackageLoader
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
from .cuda_opencl import knl_fields_updates, knl_snapshots, knl_source_updates, knl_store_outputs
|
||||
from .cython.fields_updates_normal import update_electric as update_electric_cpu
|
||||
from .cython.fields_updates_normal import update_magnetic as update_magnetic_cpu
|
||||
from .fields_outputs import store_outputs as store_outputs_cpu
|
||||
from .receivers import dtoh_rx_array, htod_rx_arrays
|
||||
from .snapshots import Snapshot, dtoh_snapshot_array, htod_snapshot_array
|
||||
from .sources import htod_src_arrays
|
||||
from .utilities.utilities import round32, timer
|
||||
from ..cuda_opencl import knl_fields_updates, knl_snapshots, knl_source_updates, knl_store_outputs
|
||||
from ..cython.fields_updates_normal import update_electric as update_electric_cpu
|
||||
from ..cython.fields_updates_normal import update_magnetic as update_magnetic_cpu
|
||||
from ..fields_outputs import store_outputs as store_outputs_cpu
|
||||
from ..receivers import dtoh_rx_array, htod_rx_arrays
|
||||
from ..snapshots import Snapshot, dtoh_snapshot_array, htod_snapshot_array
|
||||
from ..sources import htod_src_arrays
|
||||
from ..utilities.utilities import round32, timer
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -869,7 +869,7 @@ class OpenCLUpdates:
|
||||
|
||||
def _set_field_knls(self):
|
||||
"""Electric and magnetic field updates - prepares kernels, and
|
||||
gets kernel functions.
|
||||
gets kernel functions.
|
||||
"""
|
||||
|
||||
subs = {
|
||||
@@ -881,7 +881,7 @@ class OpenCLUpdates:
|
||||
"NY_ID": self.grid.ID.shape[2],
|
||||
"NZ_ID": self.grid.ID.shape[3],
|
||||
}
|
||||
|
||||
|
||||
self.update_electric_dev = self.elwiseknl(
|
||||
self.ctx,
|
||||
knl_fields_updates.update_electric["args_opencl"].substitute(
|
||||
@@ -921,7 +921,7 @@ class OpenCLUpdates:
|
||||
"NY_T": self.grid.Tx.shape[2],
|
||||
"NZ_T": self.grid.Tx.shape[3],
|
||||
}
|
||||
|
||||
|
||||
self.dispersive_update_a = self.elwiseknl(
|
||||
self.ctx,
|
||||
knl_fields_updates.update_electric_dispersive_A["args_opencl"].substitute(
|
||||
@@ -935,7 +935,7 @@ class OpenCLUpdates:
|
||||
preamble=self.knl_common,
|
||||
options=config.sim_config.devices["compiler_opts"],
|
||||
)
|
||||
|
||||
|
||||
self.dispersive_update_b = self.elwiseknl(
|
||||
self.ctx,
|
||||
knl_fields_updates.update_electric_dispersive_B["args_opencl"].substitute(
|
||||
@@ -1235,7 +1235,7 @@ class OpenCLUpdates:
|
||||
self.grid.Ty_dev,
|
||||
self.grid.Tz_dev,
|
||||
)
|
||||
|
||||
|
||||
def update_electric_pml(self):
|
||||
"""Updates electric field components with the PML correction."""
|
||||
for pml in self.grid.pmls["slabs"]:
|
||||
@@ -1308,7 +1308,7 @@ class OpenCLUpdates:
|
||||
self.event_marker1.wait()
|
||||
|
||||
def calculate_memory_used(self, iteration):
|
||||
"""Calculates memory used on last iteration.
|
||||
"""Calculates memory used on last iteration.
|
||||
|
||||
Args:
|
||||
iteration: int for iteration number.
|
@@ -8,7 +8,7 @@ from gprMax.grid import FDTDGrid
|
||||
from gprMax.materials import create_built_in_materials
|
||||
from gprMax.model_build_run import GridBuilder
|
||||
from gprMax.pml import CFS
|
||||
from gprMax.updates import CPUUpdates
|
||||
from gprMax.updates.updates import CPUUpdates
|
||||
|
||||
|
||||
def build_grid(nx, ny, nz, dl=0.001, dt=3e-9):
|
||||
@@ -94,7 +94,7 @@ def test_update_magnetic_pml_cpu(config_mock):
|
||||
assert np.equal(pml.EPhi2, 0).all()
|
||||
|
||||
|
||||
def test_update_magnetic_pml_cpu(config_mock, build_grid):
|
||||
def test_update_electric_pml_cpu(config_mock):
|
||||
grid = build_grid(100, 100, 100)
|
||||
|
||||
grid_expected_value = np.zeros((101, 101, 101))
|
||||
|
在新工单中引用
屏蔽一个用户