| 296 | { |
| 297 | template <class OffsetsT, class ConnectivityT> |
| 298 | void operator()( |
| 299 | OffsetsT* offsets, ConnectivityT* vtkNotUsed(conn), vtkIdType& isHomogeneous) const |
| 300 | { |
| 301 | using ValueType = GetAPIType<OffsetsT>; |
| 302 | |
| 303 | const vtkIdType numCells = offsets->GetNumberOfValues() - 1; |
| 304 | if (numCells == 0) |
| 305 | { |
| 306 | isHomogeneous = 0; |
| 307 | return; |
| 308 | } |
| 309 | |
| 310 | // Initialize using the first cell: |
| 311 | const vtkIdType firstCellSize = GetCellSize(offsets, 0); |
| 312 | |
| 313 | // Verify the rest: |
| 314 | auto offsetsRange = GetRange(offsets); |
| 315 | auto it = std::adjacent_find(offsetsRange.begin() + 1, offsetsRange.end(), |
| 316 | [&](const ValueType a, const ValueType b) -> bool |
| 317 | { return static_cast<vtkIdType>(b - a) != firstCellSize; }); |
| 318 | |
| 319 | if (it != offsetsRange.end()) |
| 320 | { // Found a cell that doesn't match the size of the first cell: |
| 321 | isHomogeneous = -1; |
| 322 | return; |
| 323 | } |
| 324 | |
| 325 | isHomogeneous = firstCellSize; |
| 326 | } |
| 327 | }; |
| 328 | |
| 329 | struct AllocateExactImpl : public vtkCellArray::DispatchUtilities |
nothing calls this directly
no test coverage detected