你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Updated for new visualisation of PML region and source/receiver positions.
这个提交包含在:
@@ -25,9 +25,6 @@ paraview.simple._DisableFirstRenderCameraReset()
|
||||
# Get whatever source is loaded (should be model)
|
||||
model = GetActiveSource()
|
||||
|
||||
# Get display properties
|
||||
dp = GetDisplayProperties(model)
|
||||
|
||||
# Get active view
|
||||
renderview = GetActiveView()
|
||||
|
||||
@@ -37,25 +34,24 @@ Show(model, renderview)
|
||||
# Reset view to fit data
|
||||
renderview.ResetCamera()
|
||||
|
||||
# Lists to hold material and sources/receiver identifiers written in VTK file in tags <gprMax3D> <Material> and <gprMax3D> <Sources_Receivers>
|
||||
# Lists to hold material and sources/receiver identifiers written in VTK file in tags <gprMax3D> <Material> and <gprMax3D> <Sources/Receivers>
|
||||
materials = []
|
||||
srcsrxs = []
|
||||
srcs_rxs_pml = []
|
||||
with open(model.FileName[0], 'r') as f:
|
||||
for line in f:
|
||||
if line.startswith('<Material'):
|
||||
line.rstrip('\n')
|
||||
tmp = (int(ET.fromstring(line).text), ET.fromstring(line).attrib.get('name'))
|
||||
materials.append(tmp)
|
||||
elif line.startswith('<Sources'):
|
||||
elif line.startswith('<Sources') or line.startswith('<PML'):
|
||||
line.rstrip('\n')
|
||||
tmp = (int(ET.fromstring(line).text), ET.fromstring(line).attrib.get('name'))
|
||||
srcsrxs.append(tmp)
|
||||
|
||||
# Get ranges of data
|
||||
matdatarange = model.CellData.GetArray(0).GetRange()
|
||||
srcrxdatarange = model.CellData.GetArray(1).GetRange()
|
||||
srcs_rxs_pml.append(tmp)
|
||||
|
||||
if materials:
|
||||
# Get range of data
|
||||
matdatarange = model.CellData.GetArray(0).GetRange()
|
||||
|
||||
# Create threshold for materials (name and numeric value)
|
||||
for x in range(0, int(matdatarange[1]) + 1):
|
||||
for y in range(len(materials)):
|
||||
@@ -71,21 +67,28 @@ if materials:
|
||||
thresholddisplay = Show(threshold, renderview)
|
||||
thresholddisplay.ColorArrayName = 'Material'
|
||||
|
||||
if srcsrxs:
|
||||
if srcs_rxs_pml:
|
||||
# Get ranges of data
|
||||
srcs_rxs_pml_datarange = model.CellData.GetArray(1).GetRange()
|
||||
|
||||
# Create threshold for sources/receivers (name and numeric value)
|
||||
for x in range(0, int(srcrxdatarange[1]) + 1):
|
||||
for y in range(len(srcsrxs)):
|
||||
if srcsrxs[y][0] == x:
|
||||
for x in range(0, int(srcs_rxs_pml_datarange[1]) + 1):
|
||||
for y in range(len(srcs_rxs_pml)):
|
||||
if srcs_rxs_pml[y][0] == x:
|
||||
threshold = Threshold(Input=model)
|
||||
threshold.Scalars = 'Sources_Receivers'
|
||||
threshold.ThresholdRange = [srcsrxs[y][0], srcsrxs[y][0]]
|
||||
threshold.Scalars = 'Sources_Receivers_PML'
|
||||
threshold.ThresholdRange = [srcs_rxs_pml[y][0], srcs_rxs_pml[y][0]]
|
||||
|
||||
RenameSource(srcsrxs[y][1], threshold)
|
||||
RenameSource(srcs_rxs_pml[y][1], threshold)
|
||||
|
||||
# Show data in view
|
||||
thresholddisplay = Show(threshold, renderview)
|
||||
thresholddisplay.ColorArrayName = 'Sources_Receivers'
|
||||
thresholddisplay.ColorArrayName = 'Sources_Receivers_PML'
|
||||
|
||||
Render()
|
||||
if srcs_rxs_pml[y][0] == 1:
|
||||
thresholddisplay.Opacity = 0.5
|
||||
|
||||
renderview.CameraParallelProjection = 1
|
||||
RenderAllViews()
|
||||
# Show color bar/color legend
|
||||
#thresholdDisplay.SetScalarBarVisibility(renderview, False)
|
在新工单中引用
屏蔽一个用户