I’m using the vtkAppendFilter
to generate a vtkUnstructuredGrid
from two meshes but the input meshes have duplicate points and cells. The MergePoints
option for vtkAppendFilter
is great however it doesn’t properly handle the point data arrays. For example, load the following two meshes and run this:
mesh0.vtu (1.2 MB)
mesh1.vtu (1.2 MB)
... # Load those meshes
append_filter = vtk.vtkAppendFilter()
append_filter.AddInputData(mesh0)
append_filter.AddInputData(mesh1)
append_filter.SetMergePoints(True)
append_filter.Update()
merged = append_filter.GetOutput()
n_points = merged.GetNumberOfPoints()
n_values = merged.GetPointData().GetArray(0).GetNumberOfValues()
print(n_values, n_points)
153106 114730
The resulting output from vtkAppendFilter
isn’t useable because the PointData array has way more elements than there are points - how could I either fix this issue or not use the SetMergePoints(True)
option and clean the vtkUnstructuredGrid
?
It seems that when using SetMergePoints(True)
, both values are kept for the merged points - could I avoid this or take an average?