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

Method operator()

Common/DataModel/vtkPolyData.cxx:761–787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759 // type are valid for the target cell array or throw a std::runtime_error.
760 template <typename OffsetsT, typename ConnectivityT, typename SizeToTypeFunctor>
761 void operator()(OffsetsT* offsets, ConnectivityT* vtkNotUsed(conn),
762 vtkPolyData_detail::CellMap* map, vtkIdType beginCellId, SizeToTypeFunctor&& typer)
763 {
764 const vtkIdType numCells = offsets->GetNumberOfValues() - 1;
765 if (numCells == 0)
766 {
767 return;
768 }
769
770 if (!vtkPolyData_detail::CellMap::ValidateCellId(numCells - 1))
771 {
772 throw std::runtime_error("Cell map storage capacity exceeded.");
773 }
774
775 auto buildCellsOperator = [&](vtkIdType begin, vtkIdType end)
776 {
777 for (vtkIdType cellId = begin, globalCellId = beginCellId + begin; cellId < end;
778 ++cellId, ++globalCellId)
779 {
780 map->InsertCell(globalCellId, cellId, typer(GetCellSize(offsets, cellId)));
781 }
782 };
783 // We use Threshold to test if the data size is small enough
784 // to execute the functor serially. This is faster.
785 // and also potentially avoids nested multithreading which creates race conditions.
786 vtkSMPTools::For(0, numCells, vtkSMPTools::THRESHOLD, buildCellsOperator);
787 }
788};
789
790} // end anon namespace

Callers

nothing calls this directly

Calls 5

ValidateCellIdFunction · 0.85
GetCellSizeFunction · 0.70
ForFunction · 0.50
GetNumberOfValuesMethod · 0.45
InsertCellMethod · 0.45

Tested by

no test coverage detected