MCPcopy Create free account
hub / github.com/Kitware/VTK / Deserialize_vtkGraph

Function Deserialize_vtkGraph

Common/DataModel/vtkGraphSerDesHelper.cxx:90–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90static void Deserialize_vtkGraph(
91 const nlohmann::json& state, vtkObjectBase* object, vtkDeserializer* deserializer)
92{
93 auto* graph = vtkGraph::SafeDownCast(object);
94 if (!graph)
95 {
96 return;
97 }
98
99 if (auto superDeserializer = deserializer->GetHandler(typeid(vtkGraph::Superclass)))
100 {
101 superDeserializer(state, object, deserializer);
102 }
103
104 vtkGraphInternals* internals = graph->GetGraphInternals(true);
105 std::vector<vtkVertexAdjacencyList> adjacency;
106 for (const auto& adj : state["InternalAdjacency"])
107 {
108 vtkVertexAdjacencyList adjList;
109
110 for (const auto& edge : adj["InEdges"])
111 {
112 adjList.InEdges.emplace_back(edge[1], edge[0]);
113 }
114 for (const auto& edge : adj["OutEdges"])
115 {
116 adjList.OutEdges.emplace_back(edge[1], edge[0]);
117 }
118 adjacency.push_back(adjList);
119 }
120 internals->Adjacency = adjacency;
121 internals->NumberOfEdges = state["NumberOfEdges"];
122 internals->UsingPedigreeIds = state["UsingPedigreeIds"];
123
124 {
125 auto iter = state.find("VertexData");
126 if ((iter != state.end()) && !iter->is_null())
127 {
128 auto* context = deserializer->GetContext();
129 const auto identifier = iter->at("Id").get<vtkTypeUInt32>();
130 vtkSmartPointer<vtkObjectBase> subObject =
131 reinterpret_cast<vtkObjectBase*>(graph->GetVertexData());
132 if (subObject == nullptr)
133 {
134 vtkErrorWithObjectMacro(context, << "An internal collection object is null!");
135 }
136 else
137 {
138 if (context->GetObjectAtId(identifier) != subObject)
139 {
140 auto registrationId = identifier;
141 context->RegisterObject(subObject, registrationId);
142 }
143 deserializer->DeserializeJSON(identifier, subObject);
144 }
145 }
146 }
147 {

Callers

nothing calls this directly

Calls 13

GetGraphInternalsMethod · 0.80
GetVertexDataMethod · 0.80
DeserializeJSONMethod · 0.80
GetEdgeDataMethod · 0.80
GetHandlerMethod · 0.45
emplace_backMethod · 0.45
push_backMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetContextMethod · 0.45
atMethod · 0.45
GetObjectAtIdMethod · 0.45

Tested by

no test coverage detected