| 50 | } |
| 51 | |
| 52 | static void Deserialize_vtkCellArray( |
| 53 | const nlohmann::json& state, vtkObjectBase* object, vtkDeserializer* deserializer) |
| 54 | { |
| 55 | if (auto* cellArray = vtkCellArray::SafeDownCast(object)) |
| 56 | { |
| 57 | if (auto superDeserializer = deserializer->GetHandler(typeid(vtkCellArray::Superclass))) |
| 58 | { |
| 59 | superDeserializer(state, object, deserializer); |
| 60 | } |
| 61 | const auto numberOfCells = state["NumberOfCells"].get<vtkIdType>(); |
| 62 | if (numberOfCells == 0) |
| 63 | { |
| 64 | return; |
| 65 | } |
| 66 | vtkSmartPointer<vtkDataArray> offsets; |
| 67 | vtkSmartPointer<vtkDataArray> connectivity; |
| 68 | auto* context = deserializer->GetContext(); |
| 69 | { |
| 70 | const auto identifier = state["Offsets"]["Id"].get<vtkTypeUInt32>(); |
| 71 | auto subObject = context->GetObjectAtId(identifier); |
| 72 | deserializer->DeserializeJSON(identifier, subObject); |
| 73 | offsets = vtkDataArray::SafeDownCast(subObject); |
| 74 | } |
| 75 | { |
| 76 | const auto identifier = state["Connectivity"]["Id"].get<vtkTypeUInt32>(); |
| 77 | auto subObject = context->GetObjectAtId(identifier); |
| 78 | deserializer->DeserializeJSON(identifier, subObject); |
| 79 | connectivity = vtkDataArray::SafeDownCast(subObject); |
| 80 | } |
| 81 | if (offsets == nullptr) |
| 82 | { |
| 83 | vtkErrorWithObjectMacro(context, << deserializer->GetObjectDescription() |
| 84 | << " gave offsets=nullptr for " |
| 85 | << cellArray->GetObjectDescription()); |
| 86 | } |
| 87 | else if (connectivity == nullptr) |
| 88 | { |
| 89 | vtkErrorWithObjectMacro(context, << deserializer->GetObjectDescription() |
| 90 | << " gave connectivity=nullptr for " |
| 91 | << cellArray->GetObjectDescription()); |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | cellArray->SetData(offsets, connectivity); |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | int RegisterHandlers_vtkCellArraySerDesHelper(void* ser, void* deser, void* vtkNotUsed(invoker)) |
| 101 | { |
nothing calls this directly
no test coverage detected