grid is one vtkUnstructuredGrid,when use surfaceFilter to filter the surface,
after do that,for different grid,some globalIds is nullptr, and sometime globalIds is not nullptr; why?
(vtk Version is 9.2)
//grid : vtkUnstructuredGrid
grid->GetCellData()->SetGlobalIds(global_element_id);
grid->GetPointData()->SetGlobalIds(global_element_id);
auto surfaceFilter = vtkSmartPointer<vtkDataSetSurfaceFilter>::New();
auto mapper = vtkSmartPointer<vtkDataSetMapper>::New();
surfaceFilter->SetInputData(source);
mapper->SetInputConnection(surfaceFilter->GetOutputPort());
mapper->SetResolveCoincidentTopologyToPolygonOffset();
mapper->Update();
/*
when use surfaceFilter to filter the surface,
after do that,
sometime globalIds is nullptr, and sometime globalIds is not nullptr
*/
auto globalIds = mapper->GetInput()->GetPointData()->GetGlobalIds();
For me, the globalIds are set if the grid contains only linear elements, and unset if it contains quadratic elements (even when SetNonlinearSubdivisionLevel (0) is used).
Looking into the code a bit, it appears a vtkUnstructuredGridGeometryFilter is added in this case, here.
in the vtkUnstructuredGridGeometryFilter code after this line, and the global IDs are then set.
However, Iām not sure if copying the global IDs in this way actually makes sense in the context of the vtkUnstructuredGridGeometryFilter. Maybe someone with a better understanding of the ID handling can comment on this.
I also noticed that without changes, we can still get the vtkOriginalCellIds and vtkOriginalPointIds [1]. Are these the same as the global IDs? If not, how are they different?
[1] These are controlled by the SetPassThrough<..>Ids calls I believe
Adding to this, in our case the behavior changed when upgrading from an older VTK version (7.1.1). I believe the change is due to commit 320464e6a249b598f5d98f7839cfcb2d477d4ba9: