

def encodePolyData(polyData):
    'Given a vtkPolyData, returns a numpy int8 array that contains\n    the serialization of the data.  This array can be passed to the\n    decodePolyData function to construct a new vtkPolyData object from\n    the serialized data.'
    if (not hasattr(vtk, 'vtkCommunicator')):
        w = vtk.vtkPolyDataWriter()
        w.WriteToOutputStringOn()
        w.SetInput(polyData)
        w.Write()
        return np.frombuffer(charArray.GetOutputStdString(), dtype=np.int8)
    charArray = vtk.vtkCharArray()
    vtk.vtkCommunicator.MarshalDataObject(polyData, charArray)
    numpyArray = vnp.numpy_support.vtk_to_numpy(charArray)
    assert (numpyArray.dtype == np.int8)
    return numpyArray

dataset/ETHPy150Open RobotLocomotion/director/src/python/director/geometryencoder.py encodePolyData/VarMisuse@57/160 `w`->`charArray`