MCPcopy Create free account
hub / github.com/Kitware/VTK / operator()

Method operator()

Common/DataModel/vtkCellArray.cxx:33–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31{
32 template <class OffsetsT, class ConnectivityT>
33 void operator()(
34 OffsetsT* offsets, ConnectivityT* vtkNotUsed(conn), vtkIdType location, vtkIdType& cellId) const
35 {
36 using ValueType = GetAPIType<OffsetsT>;
37
38 const auto offsetsRange = GetRange(offsets);
39
40 // Use a binary-search to find the location:
41 auto it = this->BinarySearchOffset(
42 offsetsRange.begin(), offsetsRange.end() - 1, static_cast<ValueType>(location));
43
44 cellId = std::distance(offsetsRange.begin(), it);
45
46 if (it == offsetsRange.end() - 1 /* no match found */ ||
47 static_cast<vtkIdType>(*it + cellId) != location /* `location` not at cell head */)
48 { // Location invalid.
49 cellId = -1;
50 return;
51 }
52 }
53
54 template <typename IterT>
55 IterT BinarySearchOffset(const IterT& beginIter, const IterT& endIter,

Callers

nothing calls this directly

Calls 5

BinarySearchOffsetMethod · 0.95
GetRangeFunction · 0.50
distanceFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected