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

Method operator()

Common/DataModel/vtkCellArray.cxx:298–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
329struct AllocateExactImpl : public vtkCellArray::DispatchUtilities

Callers

nothing calls this directly

Calls 6

adjacent_findFunction · 0.85
GetCellSizeFunction · 0.70
GetRangeFunction · 0.50
GetNumberOfValuesMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected