VTK-9.0.1 crashes on code that was fine with VTK-8.x
Error indicated in comment on the Insert Next cell to the vtkUnstructuredGrid grid. Seems GetPointer is no longer in 9.2 and attempts to cast to the required type causes crash during run time. Thanks
int generate_poly_cell(vtkSmartPointer<vtkPoints> mesh_points,
vtkSmartPointer<vtkUnstructuredGrid> poly_mesh,
POBJ particle,
POBJ_Geo particleGeo,
POBJ_ROT particle_rot,
int vertex_offset)
{
std::vector<vtkIdType> vert_id;
for (int i=0; i < particle.num_vertex; ++i)
{
float3 vertex = particle_rot.Vertex[i] / DEMAnalysisOptions.UnitScale;
vert_id.push_back(i + vertex_offset);
mesh_points->InsertNextPoint(vertex.x, vertex.y, vertex.z);
}
vtkSmartPointer<vtkCellArray> faces = vtkSmartPointer<vtkCellArray>::New();
for (int i=0; i < particle.num_faces; ++i)
{
std::vector<vtkIdType> face_id;
for (int j=0; j < particleGeo.PolyGeometry_Faces[i].num_vertex; ++j)
{
face_id.push_back(particleGeo.PolyGeometry_Faces[i].vertex_Order[j] + vertex_offset);
}
faces->InsertNextCell(particleGeo.PolyGeometry_Faces[i].num_vertex, face_id.data());
}
/* ERROR is here GetPointer is not longer in 9.2 and attempts to cast to the required type causes crash*/
poly_mesh->InsertNextCell(VTK_POLYHEDRON, particle.num_vertex, vert_id.data(), particle.num_faces, faces->GetPointer());
return vertex_offset + particle.num_vertex;
}```
Edited by nicolin govender