Build the map and other structures to support locator operations
| 756 | |
| 757 | // Build the map and other structures to support locator operations |
| 758 | void BuildLocator() override |
| 759 | { |
| 760 | // Place each point in a bucket |
| 761 | auto points = this->DataSet->GetPoints()->GetData(); |
| 762 | MapPointsArrayWorker worker; |
| 763 | if (!vtkArrayDispatch::DispatchByArray<vtkArrayDispatch::AllPointArrays>::Execute( |
| 764 | points, worker, this)) |
| 765 | { |
| 766 | worker(points, this); |
| 767 | } |
| 768 | |
| 769 | // Now group the points into contiguous runs within buckets (recall that |
| 770 | // sorting is occurring based on bin/bucket id). |
| 771 | vtkSMPTools::Sort(this->Map, this->Map + this->NumPts); |
| 772 | |
| 773 | // Build the offsets into the Map. The offsets are the positions of |
| 774 | // each bucket into the sorted list. They mark the beginning of the |
| 775 | // list of points in each bucket. Amazingly, this can be done in |
| 776 | // parallel. |
| 777 | int numBatches = static_cast<int>(ceil(static_cast<double>(this->NumPts) / this->BatchSize)); |
| 778 | MapOffsets<TIds> offMapper(this); |
| 779 | vtkSMPTools::For(0, numBatches, offMapper); |
| 780 | } |
| 781 | }; |
| 782 | |
| 783 | VTK_ABI_NAMESPACE_END |