Returns a tuple with a reference to the unpickling function and a state dictionary with entries: - Type : a string with the class name for the data object - Serialized : a numpy array with the serialized data object This is exactly the state dictionary that unserialize_VTK_dat
(data_object)
| 56 | return new_data_object |
| 57 | |
| 58 | def serialize_VTK_data_object(data_object): |
| 59 | """Returns a tuple with a reference to the unpickling function and a state dictionary |
| 60 | with entries: |
| 61 | - Type : a string with the class name for the data object |
| 62 | - Serialized : a numpy array with the serialized data object |
| 63 | |
| 64 | This is exactly the state dictionary that unserialize_VTK_data_object expects. |
| 65 | """ |
| 66 | |
| 67 | if not data_object.IsA("vtkDataObject"): |
| 68 | raise TypeError("Object passed to pickling should be a vtkDataObject") |
| 69 | data_object_type = data_object.GetClassName() |
| 70 | char_array = vtkCharArray() |
| 71 | if vtkCommunicator.MarshalDataObject(data_object, char_array) == 0: |
| 72 | raise RuntimeError("UnMarshaling data object failed") |
| 73 | return unserialize_VTK_data_object, ( |
| 74 | { "Type" : data_object_type, |
| 75 | "Serialized" : numpy.frombuffer(char_array, numpy.int8, char_array.GetNumberOfValues()) },) |
| 76 | |
| 77 | |
| 78 | # Fill in global dispatch table for most vtkDataObject types |
nothing calls this directly
no test coverage detected