vtkProbeLineFilter crashes in Python
This small code with vtkProbeLineFilter
crashes in Python with Segmentation fault (core dumped)
(vtk is installed using pip install vtk
). At the same time it runs fine with pvpython
provided by a Paraview package. Could this be related to !10640 (merged) somehow?
import vtk
# create mesh to probe from
pts = vtk.vtkPoints()
pts.InsertNextPoint([0, 0, 0])
pts.InsertNextPoint([1, 0, 0])
pts.InsertNextPoint([0, 1, 0])
pts.InsertNextPoint([0, 0, 1])
print(pts)
cells = vtk.vtkCellArray()
cells.AllocateExact(1, 4)
cells.InsertNextCell(4, [0, 1, 2, 3])
print(cells)
grid = vtk.vtkUnstructuredGrid()
grid.SetPoints(pts)
grid.SetCells(vtk.VTK_TETRA, cells)
data = vtk.vtkFloatArray()
data.SetNumberOfComponents(1)
data.SetName("Test")
data.InsertNextValue(1);
print(data)
grid.GetPointData().AddArray(data);
print(grid)
start = [0.25, 0.25, -1]
end = [0.25, 0.25, 1]
# create probing line
line = vtk.vtkLineSource()
line.SetPoint1(start)
line.SetPoint2(end)
line.SetResolution(1)
line.Update()
# create prober
prober = vtk.vtkProbeLineFilter()
prober.SetSourceConnection(line.GetOutputPort())
prober.SetInputData(grid)
prober.SetSamplingPattern(prober.SAMPLE_LINE_UNIFORMLY)
prober.SetLineResolution(10)
print(prober)
prober.Update() # <- crashes here