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

Method RequestData

Infovis/BoostGraphAlgorithms/vtkBoostBiconnectedComponents.cxx:39–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39int vtkBoostBiconnectedComponents::RequestData(vtkInformation* vtkNotUsed(request),
40 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
41{
42 // get the info objects
43 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
44 vtkInformation* outInfo = outputVector->GetInformationObject(0);
45
46 // get the input and output
47 vtkUndirectedGraph* input =
48 vtkUndirectedGraph::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
49 vtkUndirectedGraph* output =
50 vtkUndirectedGraph::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
51
52 // Send the data to output.
53 output->ShallowCopy(input);
54
55 // Create edge biconnected component array.
56 // This will be populated directly by the boost algorithm.
57 vtkSmartPointer<vtkIntArray> edgeCompArr = vtkSmartPointer<vtkIntArray>::New();
58 edgeCompArr->SetNumberOfTuples(input->GetNumberOfEdges());
59 for (vtkIdType i = 0; i < input->GetNumberOfEdges(); ++i)
60 {
61 edgeCompArr->SetValue(i, -1);
62 }
63 if (this->OutputArrayName)
64 {
65 edgeCompArr->SetName(this->OutputArrayName);
66 }
67 else
68 {
69 edgeCompArr->SetName("biconnected component");
70 }
71 vtkGraphEdgePropertyMapHelper<vtkIntArray*> helper(edgeCompArr);
72
73 // Create vector of articulation points and set it up for insertion
74 // by the algorithm.
75 std::vector<vtkIdType> artPoints;
76 std::pair<size_t, std::back_insert_iterator<std::vector<vtkIdType>>> res(
77 0, std::back_inserter(artPoints));
78
79 // Call BGL biconnected_components.
80 // It appears that the signature for this
81 // algorithm has changed in 1.32, 1.33, and 1.34 ;p
82#if BOOST_VERSION < 103300 // Boost 1.32.x
83 // TODO I have no idea what the 1.32 signature is suppose to be
84 // res = biconnected_components(
85 // output, helper, std::back_inserter(artPoints), vtkGraphIndexMap());
86#elif BOOST_VERSION < 103400 // Boost 1.33.x
87 res = biconnected_components(output, helper, std::back_inserter(artPoints), vtkGraphIndexMap());
88#else // Anything after Boost 1.34.x
89 res = biconnected_components(
90 output, helper, std::back_inserter(artPoints), vertex_index_map(vtkGraphIndexMap()));
91#endif
92
93 size_t numComp = res.first;
94
95 // Assign component values to vertices based on the first edge.
96 // If isolated, assign a new value.

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
GetNumberOfVerticesMethod · 0.80
GetVerticesMethod · 0.80
GetOutEdgesMethod · 0.80
GetEdgeDataMethod · 0.80
GetVertexDataMethod · 0.80
NewFunction · 0.50
GetMethod · 0.45
ShallowCopyMethod · 0.45
SetNumberOfTuplesMethod · 0.45
GetNumberOfEdgesMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected