Fixed PV rendering colour bug

这个提交包含在:
craig-warren
2024-01-04 12:15:29 +00:00
父节点 8d7ff8b1be
当前提交 116ea7904e

查看文件

@@ -74,7 +74,7 @@ def display_pmls(pmlthick, dx_dy_dz, nx_ny_nz):
pml_names = ["x0", "y0", "z0", "xmax", "ymax", "zmax"] pml_names = ["x0", "y0", "z0", "xmax", "ymax", "zmax"]
pmls = dict.fromkeys(pml_names, None) pmls = dict.fromkeys(pml_names, None)
SetActiveSource(pv_src) SetActiveSource(pv_data)
if pmlthick[0] != 0: if pmlthick[0] != 0:
x0 = Box( x0 = Box(
@@ -159,15 +159,13 @@ def display_pmls(pmlthick, dx_dy_dz, nx_ny_nz):
# Get whatever source is loaded - should be loaded file (.vt*) or files (.pvd) # Get whatever source is loaded - should be loaded file (.vt*) or files (.pvd)
data = GetActiveSource() pv_data = GetActiveSource()
# Hide display of root data # Hide display of root data
Hide(data) Hide(pv_data)
# Single .vti or .vtu file # Single .vti or .vtu file
file = data.FileName file = pv_data.FileName[0]
dirname = os.path.dirname(file[0])
# Read and display data from file, i.e. materials, sources, receivers, and PMLs # Read and display data from file, i.e. materials, sources, receivers, and PMLs
with open(file, "rb") as f: with open(file, "rb") as f:
@@ -187,12 +185,8 @@ with open(file, "rb") as f:
################ ################
pv_view = GetActiveView() pv_view = GetActiveView()
pv_view.AxesGrid.Visibility = 1 # Show Data Axes Grid pv_view.AxesGrid.Visibility = 1 # Show Data Axes Grid
pv_data = OpenDataFile(file)
pv_disp = Show(pv_data, pv_view) pv_disp = Show(pv_data, pv_view)
pv_src = GetActiveSource() pv_disp.ColorArrayName = ["CELLS", "Material"]
Hide(pv_src)
src_name = os.path.split(file)
RenameSource(src_name[1])
# Discretisation # Discretisation
dl = c["dx_dy_dz"] dl = c["dx_dy_dz"]
@@ -202,7 +196,7 @@ nl = c["nx_ny_nz"]
# Materials # Materials
try: try:
for i, mat in enumerate(c["Materials"]): for i, mat in enumerate(c["Materials"]):
threshold = threshold_filt(pv_src, i, i, ["CELLS", "Material"]) threshold = threshold_filt(pv_data, i, i, ["CELLS", "Material"])
RenameSource(mat, threshold) RenameSource(mat, threshold)
# Show data in view, except for free_space # Show data in view, except for free_space