MCPcopy Create free account
hub / github.com/Kitware/VTK / BuildLocatorInternal

Method BuildLocatorInternal

Common/DataModel/vtkKdTree.cxx:772–918  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Build the kdtree structure based on location of cell centroids.

Source from the content-addressed store, hash-verified

770//------------------------------------------------------------------------------
771// Build the kdtree structure based on location of cell centroids.
772void vtkKdTree::BuildLocatorInternal()
773{
774 SCOPETIMER("BuildLocator");
775
776 this->UpdateProgress(0);
777 int nCells = 0;
778 int i;
779
780 if (this->NewGeometry() == 0)
781 {
782 return;
783 }
784
785 nCells = this->GetNumberOfCells();
786
787 if (nCells == 0)
788 {
789 vtkErrorMacro(<< "vtkKdTree::BuildLocator - No cells to subdivide");
790 return;
791 }
792
793 vtkDebugMacro(<< "Creating Kdtree");
794 this->InvokeEvent(vtkCommand::StartEvent);
795
796 if ((this->Timing) && (this->TimerLog == nullptr))
797 {
798 this->TimerLog = vtkTimerLog::New();
799 }
800
801 TIMER("Set up to build k-d tree");
802
803 this->FreeSearchStructure();
804
805 // volume bounds - push out a little if flat
806 vtkCollectionSimpleIterator cookie;
807 this->DataSets->InitTraversal(cookie);
808 vtkDataSet* iset = this->DataSets->GetNextDataSet(cookie);
809 double volBounds[6];
810 iset->GetBounds(volBounds);
811
812 while ((iset = this->DataSets->GetNextDataSet(cookie)))
813 {
814 double setBounds[6];
815 iset->GetBounds(setBounds);
816 volBounds[0] = std::min(setBounds[0], volBounds[0]);
817 volBounds[2] = std::min(setBounds[2], volBounds[2]);
818 volBounds[4] = std::min(setBounds[4], volBounds[4]);
819 volBounds[1] = std::max(setBounds[1], volBounds[1]);
820 volBounds[3] = std::max(setBounds[3], volBounds[3]);
821 volBounds[5] = std::max(setBounds[5], volBounds[5]);
822 }
823
824 double diff[3], aLittle = 0.0;
825 this->MaxWidth = 0.0;
826
827 for (i = 0; i < 3; i++)
828 {
829 diff[i] = volBounds[2 * i + 1] - volBounds[2 * i];

Callers 2

BuildLocatorMethod · 0.95
ForceBuildLocatorMethod · 0.95

Calls 15

UpdateProgressMethod · 0.95
NewGeometryMethod · 0.95
GetNumberOfCellsMethod · 0.95
FreeSearchStructureMethod · 0.95
ComputeCellCentersMethod · 0.95
DivideRegionMethod · 0.95
BuildRegionListMethod · 0.95
UpdateBuildTimeMethod · 0.95
SetCalculatorMethod · 0.95
InvokeEventMethod · 0.80
NewFunction · 0.50

Tested by

no test coverage detected