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

Method GetVertexIndex

Infovis/BoostGraphAlgorithms/vtkBoostBreadthFirstSearchTree.cxx:158–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158vtkIdType vtkBoostBreadthFirstSearchTree::GetVertexIndex(
159 vtkAbstractArray* abstract, vtkVariant value)
160{
161
162 // Okay now what type of array is it
163 if (abstract->IsNumeric())
164 {
165 vtkDataArray* dataArray = vtkArrayDownCast<vtkDataArray>(abstract);
166 int intValue = value.ToInt();
167 for (int i = 0; i < dataArray->GetNumberOfTuples(); ++i)
168 {
169 if (intValue == static_cast<int>(dataArray->GetTuple1(i)))
170 {
171 return i;
172 }
173 }
174 }
175 else
176 {
177 vtkStringArray* stringArray = vtkArrayDownCast<vtkStringArray>(abstract);
178 std::string stringValue(value.ToString());
179 for (int i = 0; i < stringArray->GetNumberOfTuples(); ++i)
180 {
181 if (stringValue == stringArray->GetValue(i))
182 {
183 return i;
184 }
185 }
186 }
187
188 // Failed
189 vtkErrorMacro("Did not find a valid vertex index...");
190 return 0;
191}
192
193int vtkBoostBreadthFirstSearchTree::FillInputPortInformation(
194 int vtkNotUsed(port), vtkInformation* info)

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