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

Method GetVertexIndex

Infovis/BoostGraphAlgorithms/vtkBoostBreadthFirstSearch.cxx:132–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132vtkIdType vtkBoostBreadthFirstSearch::GetVertexIndex(vtkAbstractArray* abstract, vtkVariant value)
133{
134
135 // Okay now what type of array is it
136 if (abstract->IsNumeric())
137 {
138 vtkDataArray* dataArray = vtkArrayDownCast<vtkDataArray>(abstract);
139 int intValue = value.ToInt();
140 for (int i = 0; i < dataArray->GetNumberOfTuples(); ++i)
141 {
142 if (intValue == static_cast<int>(dataArray->GetTuple1(i)))
143 {
144 return i;
145 }
146 }
147 }
148 else
149 {
150 vtkStringArray* stringArray = vtkArrayDownCast<vtkStringArray>(abstract);
151 std::string stringValue(value.ToString());
152 for (int i = 0; i < stringArray->GetNumberOfTuples(); ++i)
153 {
154 if (stringValue == stringArray->GetValue(i))
155 {
156 return i;
157 }
158 }
159 }
160
161 // Failed
162 vtkErrorMacro("Did not find a valid vertex index...");
163 return 0;
164}
165
166int vtkBoostBreadthFirstSearch::RequestData(vtkInformation* vtkNotUsed(request),
167 vtkInformationVector** inputVector, vtkInformationVector* outputVector)

Callers 1

RequestDataMethod · 0.95

Calls 6

GetTuple1Method · 0.80
IsNumericMethod · 0.45
ToIntMethod · 0.45
GetNumberOfTuplesMethod · 0.45
ToStringMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected