| 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, |
nothing calls this directly
no test coverage detected