你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-08 07:24:19 +08:00
simple voxel export for subgrid. entire subgrid only
这个提交包含在:
@@ -1250,7 +1250,10 @@ class GeometryView(UserObjectMulti):
|
||||
except KeyError:
|
||||
self.multi_grid = False
|
||||
if output_type == 'n':
|
||||
from .geometry_outputs import GeometryViewVoxels as GeometryViewUser
|
||||
if isinstance(grid, SubGridBase):
|
||||
from .geometry_outputs import GeometryViewSubgridVoxels as GeometryViewUser
|
||||
else:
|
||||
from .geometry_outputs import GeometryViewVoxels as GeometryViewUser
|
||||
else:
|
||||
from .geometry_outputs import GeometryViewLines as GeometryViewUser
|
||||
|
||||
@@ -1279,6 +1282,7 @@ class GeometryView(UserObjectMulti):
|
||||
|
||||
dx, dy, dz = uip.discretise_static_point(dl)
|
||||
|
||||
|
||||
if dx < 0 or dy < 0 or dz < 0:
|
||||
logger.exception(self.params_str() + ' the step size should not be less than zero')
|
||||
raise ValueError
|
||||
|
@@ -256,7 +256,6 @@ class GeometryViewVoxels(GeometryView):
|
||||
else:
|
||||
# this array is contiguous by design.
|
||||
solid = self.grid.solid
|
||||
|
||||
return solid
|
||||
|
||||
def get_coordinates(self, solid):
|
||||
@@ -296,9 +295,15 @@ class GeometryViewSubgridVoxels(GeometryViewVoxels):
|
||||
"""Views of the geometry of the model."""
|
||||
|
||||
def __init__(self, *args):
|
||||
# for sub-grid we are only going to export the entire grid. temporary fix.
|
||||
xs, ys, zs, xf, yf, zf, dx, dy, dz, filename, grid = args
|
||||
xs, ys, zs = 0, 0, 0
|
||||
xf, yf, zf = grid.nx, grid.ny, grid.nz
|
||||
dx, dy, dz = 1, 1, 1
|
||||
args = xs, ys, zs, xf, yf, zf, dx, dy, dz, filename, grid
|
||||
super().__init__(*args)
|
||||
self.output_type = 'normal'
|
||||
|
||||
"""
|
||||
def get_coordinates(self, solid):
|
||||
# (length is number of vertices in each direction) * (size of each block [m]) + (starting offset) + grid offset
|
||||
x = np.arange(
|
||||
@@ -308,6 +313,7 @@ class GeometryViewSubgridVoxels(GeometryViewVoxels):
|
||||
z = np.arange(
|
||||
0, solid.shape[2] + 1) * (self.grid.dz * self.dz) + ((self.zs - self.grid.n_boundary_cells_z) * self.grid.dz)# + self.grid.z1
|
||||
return x, y, z
|
||||
"""
|
||||
|
||||
class Comments():
|
||||
|
||||
|
@@ -6,8 +6,6 @@
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import gprMax
|
||||
from user_libs.antennas.GSSI import antenna_like_GSSI_400
|
||||
|
||||
import numpy as np
|
||||
|
||||
# file path step
|
||||
@@ -73,37 +71,14 @@ scene.add(material)
|
||||
plastic_box = gprMax.Box(p1=(30*dl, 30*dl, 30*dl), p2=(31*dl, 31*dl, 31*dl), material_id='plastic')
|
||||
sg.add(plastic_box)
|
||||
|
||||
# create a geometry view of the main grid and the sub grid stitched together
|
||||
gv = gprMax.GeometryView(p1=(0, 0, 0),
|
||||
p2=domain.props.p1,
|
||||
dl=dl,
|
||||
filename=fn.with_suffix('').parts[-1],
|
||||
output_type='f',
|
||||
multi_grid=True)
|
||||
|
||||
# create a geometry view of the sub grid only
|
||||
gv_sg = gprMax.GeometryView(p1=sg_p0,
|
||||
p2=sg_p1,
|
||||
dl=(1e-3, 1e-3, 1e-3),
|
||||
filename=fn.with_suffix('').parts[-1] + '_only',
|
||||
output_type='f')
|
||||
|
||||
# create a geometry view of the sub grid only
|
||||
# create a geometry view of the sub grid only. This command currently exports the entire subgrid regardless of p1, p2
|
||||
gv_sg_normal = gprMax.GeometryView(p1=sg_p0,
|
||||
p2=sg_p1,
|
||||
dl=(1e-3, 1e-3, 1e-3),
|
||||
filename=fn.with_suffix('').parts[-1] + '_only',
|
||||
filename=fn.with_suffix('').parts[-1] + '_subgrid_normal',
|
||||
output_type='n')
|
||||
|
||||
# create a geometry view of the main grid and the sub grid stitched together
|
||||
gv_normal = gprMax.GeometryView(p1=(0, 0, 0),
|
||||
p2=domain.props.p1,
|
||||
dl=dl,
|
||||
filename=fn.with_suffix('').parts[-1] + '_voxels',
|
||||
output_type='n')
|
||||
scene.add(gv)
|
||||
sg.add(gv_sg)
|
||||
# add the subgrid geometry view to the sub grid object
|
||||
sg.add(gv_sg_normal)
|
||||
#scene.add(gv_normal)
|
||||
|
||||
gprMax.run(scenes=[scene], n=1, geometry_only=False, outputfile=fn, subgrid=True, autotranslate=True)
|
||||
|
在新工单中引用
屏蔽一个用户