Different Behavior from vtkAVSucdReader + vtkGeometryFilter going from 9.0.3 to >= 9.1

Hello

I have been using python VTK, as packaged by Anaconda, for about two years now to analyze data contained in unstructured cell data (UCD) meshes. My basic read process is as follows:

reader = vtkAVSucdReader()
reader.SetFileName(filename)
reader.Update()
data = reader.GetOutput()
geomfilt = vtkGeometryFilter()
geomfilt.SetInputData(data)
geomfilt.Update()
data = geomfilt.GetOutput()

in which filename is a Windows path to a UCD file. This code segment of course has the goal of obtaining a vtkPolyData object from which I extract points (coords), cells (elems), and point data items (uang, vang) for further analysis. I eventually save additional data (in the form of vtkDoubleArrays) to the vtkPolyData object, and then to .vtk files, for visualization. My extraction process is as follows:

n_nodes = data.GetNumberOfPoints()
n_elems = data.GetNumberOfCells()
coords = vtk_to_numpy(data.GetPoints().GetData())
temp = vtk_to_numpy(data.GetPolys().GetData())
elems = temp.reshape(self.n_elems, 4)[:,1:4]
uang = vtk_to_numpy(data.GetPointData().GetArray('u'))
vang = vtk_to_numpy(data.GetPointData().GetArray('v'))

I started w/VTK-8.2.0, eventually updated to 9.0.3, and things worked flawlessly. Upon upgrading to 9.1 I found it stopped working correctly but just stuck with 9.0.3 for some time and have finally decided to figure out the problem.

So - the problem, as I see it, is that something seems to have changed in one of the two objects mentioned in the subject (vtkAVSucdReader or vtkGeometryFilter). I base this on my use of numpy.savetxt to save the extracted mesh variables (coords, elems, uang, vang) to .csv files and comparing them between 9.0.3 and 9.2.2. My findings are:

  • The point data, coords, are unchanged between versions.
  • The point data items, uang and vang, are unchanged between versions.
  • The cells (connectivity), elems, are read consistently by 9.0.3 (and previously by 8.2.0) - by which I mean, I can compare the saved .csv output to the original values in the ASCII .ucd file, and they are identical. However, in 9.2.2, usually about the first half of the values are consistent with the .ucd file; but the rest are randomly ordered, or simply incorrect. Even more strangely, this output changes from run to run - it’s not deterministic!

When I see random behavior I usually suspect a memory problem, so maybe this is on me. I greatly simplified my original code (in which the lines above were happening in different objects), and strangely, it all worked. I’ve also bunched all the above code together in a single object in the more complex code, and the problem exists there. Finally, I note that the more complex original code worked fine in 8.2.0 and 9.0.3. I’m at a loss. Is there anything that changed in the two objects that could cause this problem?

Thanks

KSH