# Is there a way to get the raw data array in vtkDataArray by zero-copy ?

**URL:** https://discourse.vtk.org/t/is-there-a-way-to-get-the-raw-data-array-in-vtkdataarray-by-zero-copy/5061
**Category:** Support
**Created:** [January 26, 2021, 3:14pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-get-the-raw-data-array-in-vtkdataarray-by-zero-copy/5061 "2021-01-26T15:14:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![1116](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1116/32/1506_2.png) [@1116](https://discourse.vtk.org/u/1116)
#### Post date: [January 26, 2021, 3:14pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-get-the-raw-data-array-in-vtkdataarray-by-zero-copy/5061/1 "2021-01-26T15:14:16Z")

</div>

Hello,

I try to get the offsetArray and the connectivityArray from the cellArray, and then transfer them to other program for further processing. I noticed that the return value of `GetConnectivityArray()` function is vtkDataArray. I’m curious how to get the raw data and the array size of it? (The alternative way is to go through every element and copy it to an extra memory space) I’m just curious if we can access the inner data of the vtkDataArray directly.

Thanks for your help!

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.vtk.org/user_avatar/discourse.vtk.org/olesenm/32/10443_2.png) [@olesenm](https://discourse.vtk.org/u/olesenm)
#### Post date: [January 26, 2021, 3:49pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-get-the-raw-data-array-in-vtkdataarray-by-zero-copy/5061/2 "2021-01-26T15:49:04Z")

</div>

Look at the low-level methods, something like

```auto
if (cells.IsStorage64Bits())
{
    auto* offsets = cells.GetOffsetsArray64();
    ...
}
else
{
    ...
}

```

---

<div class="post-metadata">

### Author: ![1116](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1116/32/1506_2.png) [@1116](https://discourse.vtk.org/u/1116)
#### Post date: [January 26, 2021, 4:06pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-get-the-raw-data-array-in-vtkdataarray-by-zero-copy/5061/3 "2021-01-26T16:06:42Z")

</div>

yeah, that might works, but how could we know the size of the data in that case? @olesenm

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.vtk.org/user_avatar/discourse.vtk.org/olesenm/32/10443_2.png) [@olesenm](https://discourse.vtk.org/u/olesenm)
#### Post date: [January 26, 2021, 4:12pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-get-the-raw-data-array-in-vtkdataarray-by-zero-copy/5061/4 "2021-01-26T16:12:06Z")

</div>

Not sure what you mean, this returns a pointer to a vtkTypeInt64Array, which has all of the usual size information. What exactly is missing?

---

<div class="post-metadata">

### Author: ![1116](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1116/32/1506_2.png) [@1116](https://discourse.vtk.org/u/1116)
#### Post date: [January 27, 2021, 2:12am UTC](https://discourse.vtk.org/t/is-there-a-way-to-get-the-raw-data-array-in-vtkdataarray-by-zero-copy/5061/5 "2021-01-27T02:12:36Z")

</div>

Thanks, let me check it to see if this solution works for my case.
