# Reuse vertex numpy buffer

**URL:** https://discourse.paraview.org/t/reuse-vertex-numpy-buffer/11110
**Category:** ParaView Support
**Created:** [January 2, 2023, 4:35pm UTC](https://discourse.paraview.org/t/reuse-vertex-numpy-buffer/11110 "2023-01-02T16:35:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Juan\_Jose\_Casafranca](https://discourse.paraview.org/user_avatar/discourse.paraview.org/juan_jose_casafranca/32/3499_2.png) [@Juan\_Jose\_Casafranca](https://discourse.paraview.org/u/Juan_Jose_Casafranca)
#### Post date: [January 2, 2023, 4:35pm UTC](https://discourse.paraview.org/t/reuse-vertex-numpy-buffer/11110/1 "2023-01-02T16:35:21Z")

</div>

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

```auto
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?
