| 545 | |
| 546 | public: |
| 547 | CellTreeBuilder(vtkCellTreeLocator* locator, TCellTree& tree, vtkDataSet* dataSet, |
| 548 | int numberOfBuckets, int numberOfNodesPerLeaf) |
| 549 | : Locator(locator) |
| 550 | , Tree(tree) |
| 551 | , DataSet(dataSet) |
| 552 | , NumberOfBuckets(numberOfBuckets) |
| 553 | , NumberOfNodesPerLeaf(numberOfNodesPerLeaf) |
| 554 | { |
| 555 | const auto numberOfCells = static_cast<T>(this->DataSet->GetNumberOfCells()); |
| 556 | this->CellsInfo.resize(static_cast<size_t>(numberOfCells)); |
| 557 | |
| 558 | double min[3] = { VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX }; |
| 559 | double max[3] = { |
| 560 | -VTK_DOUBLE_MAX, |
| 561 | -VTK_DOUBLE_MAX, |
| 562 | -VTK_DOUBLE_MAX, |
| 563 | }; |
| 564 | |
| 565 | double cellBounds[6], *cellBoundsPtr; |
| 566 | cellBoundsPtr = cellBounds; |
| 567 | for (T i = 0; i < numberOfCells; ++i) |
| 568 | { |
| 569 | this->CellsInfo[i].Ind = i; |
| 570 | this->Locator->GetCellBounds(i, cellBoundsPtr); |
| 571 | |
| 572 | for (uint8_t d = 0; d < 3; ++d) |
| 573 | { |
| 574 | this->CellsInfo[i].Min[d] = cellBoundsPtr[2 * d + 0]; |
| 575 | this->CellsInfo[i].Max[d] = cellBoundsPtr[2 * d + 1]; |
| 576 | |
| 577 | if (this->CellsInfo[i].Min[d] < min[d]) |
| 578 | { |
| 579 | min[d] = this->CellsInfo[i].Min[d]; |
| 580 | } |
| 581 | if (this->CellsInfo[i].Max[d] > max[d]) |
| 582 | { |
| 583 | max[d] = this->CellsInfo[i].Max[d]; |
| 584 | } |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | this->Tree.DataBBox[0] = min[0]; |
| 589 | this->Tree.DataBBox[1] = max[0]; |
| 590 | this->Tree.DataBBox[2] = min[1]; |
| 591 | this->Tree.DataBBox[3] = max[1]; |
| 592 | this->Tree.DataBBox[4] = min[2]; |
| 593 | this->Tree.DataBBox[5] = max[2]; |
| 594 | |
| 595 | TCellTreeNode root; |
| 596 | root.MakeLeaf(0, numberOfCells); |
| 597 | this->Nodes.push_back(root); |
| 598 | |
| 599 | this->SplitStack.emplace(0, min, max); |
| 600 | } |
| 601 | |
| 602 | void Initialize() |
| 603 | { |
nothing calls this directly
no test coverage detected