Using vtkCutter on vtkPolyhedron cells with large number of vertices ( > 512)

I have a CFD dataset consisting of hex and polyhedral cells. When I try to apply vtkCutter using a plane on the dataset, VTK crashes for some polyhedral cells.
I then found that it was crashing when I tried to cut through a polyhedron which has more than 512 vertices.

I found a similar issue reported on Paraview : https://www.paraview.org/pipermail/paraview/2017-January/038874.html

I have a simple script which generates a polyhedron as shown below

polyhedron_10

In the script, I increase the number of the quadrilateral faces on the visible side in the image to increase the total number of vertices of the polyhedron.
I apply a vtkCutter on the polyhedron and my python VTK script crashes only when I have more than 512 vertices.

I am attaching a polyhedron cell with 514 vertices .
This polyhedron can be loaded in Paraview 5.4 and applying a slice filter on it crashes Paraview as well.

I am creating a simple polyhedron cell with all planar faces and bounds of the polyhedron are big enough (0,254,0,5,0,5)polyhedron_514verts.vtu (19.6 KB)

Thanks,
Santosh

I reproduce on master. Could you open an issue on our gitlab ?

Created an issue at https://gitlab.kitware.com/vtk/vtk/-/issues/18214

Hi,
This message is regarding vtkCutter on vtkPolyhedron with >512 verts. I am facing a similar issue. In my model I have more than 1000 verts for a polyhedron. Is there any immediate fix?
I am using Python.
Any suggestion would be helpful.
Thanks,
Swarna.

Hi Swarna,
You have fix the code in vtkCutter.cxx and then build the C++ binaries and the python bindings for them.

It is just a one line fix though
In the UnstructuredGridCutter function, you need to replace the following line
cellScalars->Allocate(VTK_CELL_SIZE*cutScalars->GetNumberOfComponents());
with
cellScalars->Allocate(input->GetMaxCellSize()*cutScalars->GetNumberOfComponents());

Thanks,
Santosh

1 Like