I have a custom file format for which I have a big buffer of vertex positions and several meshes. The meshes have indices to the big buffer, and some vertices may be used by one mesh but not by the other.
When reading the file, for each mesh I read the whole buffer and create a numpy array, which I then pass to the vtkUnstructuredGrid
for each mesh on my file: if not "CELLS" in mesh_group: return None points = mesh_group["POINTS"][::] # The big points buffer ... mesh = vtkUnstructuredGrid() mesh.GetInformation().Set(vtkMultiBlockDataSet.NAME(), mesh_group.name) dsa_mesh = dsa.WrapDataObject(mesh) dsa_mesh.SetPoints(points) dsa_mesh.SetCells(cell_types, cell_offsets, cell_conn)
This is of course inefficient, as I am duplicating the data. If I pass always the same numpy array to
SetPoints, will it be reused or will vtk create copies internally for each mesh?