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

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!

Look at the low-level methods, something like

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

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

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

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