VTK Filter With Arrays

Hello,

I was wandering if it is possible to use vtk filters without passing an object read by the reader. In my case I would like to apply the filter by passing the necessary arrays but not the full grid. Is this somehow possible? For example I would like to use the clean filter but without providing a .vtu but rather the arrays in it (e.g. connectivity, point data ecc…)

Best

In the VTK design, the filters take a vtkDataObject (mainly a vtkDataSet, i.e. a grid with its data). But note that there is no unnecessary copy.
For instance a Calculator just create a new array for the result, grid and other arrays are just forwarded.

Thanks for the answer, I was trying to make a “clean to grid” at the moment of writing the vtu file but I was not able to figure out a proper way to renumber the connectivity array. Any insights on that?

What goes wrong with the different “Clean” filter ?

The connectivity renumbering doesn’t match, once I find the points and point data within the specified tolerance I miss the connectivity renumbering

I’m not sure of what you mean by “doesn’t match”.

In any case, the Connectivity array is a special array and is not intended to be manipulated directly as other data array. This should be seen as an implementation details on how the mesh is defined.

I’m not sure of what you mean by “doesn’t match”

I’ve saved the output of a clean to grid from paraview and then compared the connectivity array before and after the filter. I’m able to properly generate the connectivity array before the filter (it is the one of the original vtu file) but after the filter the array changes (as well as Points and PointData arrays)

The Clean to Grid modifies the number of cells, so it is expected that it modifies the Connectivity.