你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Merge branch 'devel-reframe' into mpi
这个提交包含在:
@@ -26,7 +26,13 @@ def convert_files(input_file_paths, discretization, colors=[(0, 0, 0)], pad=1, p
|
||||
|
||||
for input_file_path in input_file_paths:
|
||||
mesh_obj = mesh.Mesh.from_file(input_file_path)
|
||||
org_mesh = np.hstack((mesh_obj.v0[:, np.newaxis], mesh_obj.v1[:, np.newaxis], mesh_obj.v2[:, np.newaxis]))
|
||||
org_mesh = np.hstack(
|
||||
(
|
||||
mesh_obj.v0[:, np.newaxis],
|
||||
mesh_obj.v1[:, np.newaxis],
|
||||
mesh_obj.v2[:, np.newaxis],
|
||||
)
|
||||
)
|
||||
meshes.append(org_mesh)
|
||||
vol, scale, shift = convert_meshes(meshes, discretization, parallel)
|
||||
vol = np.transpose(vol)
|
||||
|
@@ -19,7 +19,12 @@ def mesh_to_plane(mesh, bounding_box, parallel):
|
||||
|
||||
current_mesh_indices = set()
|
||||
z = 0
|
||||
with tqdm(total=bounding_box[2], desc="Processing Layers", ncols=get_terminal_width() - 1, file=sys.stdout) as pbar:
|
||||
with tqdm(
|
||||
total=bounding_box[2],
|
||||
desc="Processing Layers",
|
||||
ncols=get_terminal_width() - 1,
|
||||
file=sys.stdout,
|
||||
) as pbar:
|
||||
for event_z, status, tri_ind in generate_tri_events(mesh):
|
||||
while event_z - z >= 0:
|
||||
mesh_subset = [mesh[ind] for ind in current_mesh_indices]
|
||||
|
@@ -17,9 +17,15 @@ if __name__ == "__main__":
|
||||
usage="cd gprMax; python -m toolboxes.STLtoVoxel.stltovoxel stlfilename -matindex -dxdydz",
|
||||
)
|
||||
parser.add_argument(
|
||||
"stlfiles", help="can be the filename of a single STL file, or the path to folder containing multiple STL files"
|
||||
"stlfiles",
|
||||
help="can be the filename of a single STL file, or the path to folder containing multiple STL files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-dxdydz",
|
||||
type=float,
|
||||
required=True,
|
||||
help="discretisation to use in voxelisation process",
|
||||
)
|
||||
parser.add_argument("-dxdydz", type=float, required=True, help="discretisation to use in voxelisation process")
|
||||
args = parser.parse_args()
|
||||
|
||||
if os.path.isdir(args.stlfiles):
|
||||
@@ -29,16 +35,18 @@ if __name__ == "__main__":
|
||||
filename_mats = os.path.join(path, os.path.basename(path) + "_mats.txt")
|
||||
elif os.path.isfile(args.stlfiles):
|
||||
path = os.path.dirname(args.stlfiles)
|
||||
files = args.stlfiles
|
||||
filename_hdf5 = os.path.join(path, os.path.split(os.path.basename(path))[0] + "_geo.h5")
|
||||
filename_mats = os.path.join(path, os.path.split(os.path.basename(path))[0] + "_mats.txt")
|
||||
files = [args.stlfiles]
|
||||
filename_hdf5 = os.path.splitext(args.stlfiles)[0] + "_geo.h5"
|
||||
filename_mats = os.path.splitext(args.stlfiles)[0] + "_mats.txt"
|
||||
|
||||
dxdydz = (args.dxdydz, args.dxdydz, args.dxdydz)
|
||||
|
||||
newline = "\n\t"
|
||||
logger.info(f"\nConverting STL file(s): {newline.join(files)}")
|
||||
model_array = convert_files(files, dxdydz)
|
||||
logger.info(f"Number of voxels: {model_array.shape[0]} x {model_array.shape[1]} x {model_array.shape[2]}")
|
||||
logger.info(
|
||||
f"Number of voxels: {model_array.shape[0]} x {model_array.shape[1]} x {model_array.shape[2]}"
|
||||
)
|
||||
logger.info(f"Spatial discretisation: {dxdydz[0]} x {dxdydz[1]} x {dxdydz[2]}m")
|
||||
|
||||
# Write HDF5 file for gprMax using voxels
|
||||
|
在新工单中引用
屏蔽一个用户