Build the map and other structures to support locator operations
| 527 | |
| 528 | // Build the map and other structures to support locator operations |
| 529 | void BuildLocator() override |
| 530 | { |
| 531 | // Place each point in a bucket |
| 532 | auto points = this->DataSet->GetPoints()->GetData(); |
| 533 | MapPointsArrayWorker worker; |
| 534 | if (!vtkArrayDispatch::DispatchByArray<vtkArrayDispatch::AllPointArrays>::Execute( |
| 535 | points, worker, this)) |
| 536 | { |
| 537 | worker(points, this); |
| 538 | } |
| 539 | |
| 540 | // Now gather the points into contiguous runs in buckets |
| 541 | // |
| 542 | vtkSMPTools::Sort(this->Map, this->Map + this->NumPts); |
| 543 | |
| 544 | // Build the offsets into the Map. The offsets are the positions of |
| 545 | // each bucket into the sorted list. They mark the beginning of the |
| 546 | // list of points in each bucket. Amazingly, this can be done in |
| 547 | // parallel. |
| 548 | // |
| 549 | int numBatches = static_cast<int>(ceil(static_cast<double>(this->NumPts) / this->BatchSize)); |
| 550 | MapOffsets<TIds> offMapper(this); |
| 551 | vtkSMPTools::For(0, numBatches, offMapper); |
| 552 | } |
| 553 | }; // BucketList2D |
| 554 | |
| 555 | VTK_ABI_NAMESPACE_END |