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

Method RequestData

Infovis/BoostGraphAlgorithms/vtkBoostBreadthFirstSearchTree.cxx:200–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200int vtkBoostBreadthFirstSearchTree::RequestData(vtkInformation* vtkNotUsed(request),
201 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
202{
203 // get the info objects
204 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
205 vtkInformation* outInfo = outputVector->GetInformationObject(0);
206
207 // get the input and output
208 vtkGraph* input = vtkGraph::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
209
210 // Now figure out the origin vertex of the
211 // breadth first search
212 if (this->ArrayNameSet)
213 {
214 vtkAbstractArray* abstract = input->GetVertexData()->GetAbstractArray(this->ArrayName);
215
216 // Does the array exist at all?
217 if (abstract == nullptr)
218 {
219 vtkErrorMacro("Could not find array named " << this->ArrayName);
220 return 0;
221 }
222
223 this->OriginVertexIndex = this->GetVertexIndex(abstract, this->OriginValue);
224 }
225
226 // Create tree to graph id map array
227 vtkIdTypeArray* treeToGraphIdMap = vtkIdTypeArray::New();
228
229 // Create graph to tree id map array
230 vtkIdTypeArray* graphToTreeIdMap = vtkIdTypeArray::New();
231
232 // Create a color map (used for marking visited nodes)
233 vector_property_map<default_color_type> color;
234
235 // Create a queue to hand off to the BFS
236 queue<int> q;
237
238 // Create the mutable graph to build the tree
239 vtkSmartPointer<vtkMutableDirectedGraph> temp = vtkSmartPointer<vtkMutableDirectedGraph>::New();
240 // Initialize copying data into tree
241 temp->GetFieldData()->PassData(input->GetFieldData());
242 temp->GetVertexData()->CopyAllocate(input->GetVertexData());
243 temp->GetEdgeData()->CopyAllocate(input->GetEdgeData());
244
245 // Create the visitor which will build the tree
246 bfs_tree_builder<vtkIdTypeArray*> builder(
247 graphToTreeIdMap, treeToGraphIdMap, input, temp, this->OriginVertexIndex);
248
249 // Run the algorithm
250 if (vtkDirectedGraph::SafeDownCast(input))
251 {
252 vtkDirectedGraph* g = vtkDirectedGraph::SafeDownCast(input);
253 if (this->ReverseEdges)
254 {
255#if BOOST_VERSION < 104100 // Boost 1.41.x
256 vtkErrorMacro("ReverseEdges requires Boost 1.41.x or higher");
257 return 0;

Callers

nothing calls this directly

Calls 15

GetVertexIndexMethod · 0.95
GetInformationObjectMethod · 0.80
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
GetEdgeDataMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetMethod · 0.45
PassDataMethod · 0.45
GetFieldDataMethod · 0.45
CopyAllocateMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected