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

Method AllGetRegionContainingCell

Common/DataModel/vtkKdTree.cxx:4136–4176  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

4134
4135//------------------------------------------------------------------------------
4136int* vtkKdTree::AllGetRegionContainingCell()
4137{
4138 if (this->CellRegionList)
4139 {
4140 return this->CellRegionList;
4141 }
4142 this->CellRegionList = new int[this->GetNumberOfCells()];
4143
4144 if (!this->CellRegionList)
4145 {
4146 vtkErrorMacro(<< "vtkKdTree::AllGetRegionContainingCell memory allocation");
4147 return nullptr;
4148 }
4149
4150 int* listPtr = this->CellRegionList;
4151
4152 vtkCollectionSimpleIterator cookie;
4153 this->DataSets->InitTraversal(cookie);
4154 for (vtkDataSet* iset = this->DataSets->GetNextDataSet(cookie); iset != nullptr;
4155 iset = this->DataSets->GetNextDataSet(cookie))
4156 {
4157 int setCells = iset->GetNumberOfCells();
4158
4159 float* centers = this->ComputeCellCenters(iset);
4160
4161 float* pt = centers;
4162
4163 for (int cellId = 0; cellId < setCells; cellId++)
4164 {
4165 listPtr[cellId] = this->GetRegionContainingPoint(pt[0], pt[1], pt[2]);
4166
4167 pt += 3;
4168 }
4169
4170 listPtr += setCells;
4171
4172 delete[] centers;
4173 }
4174
4175 return this->CellRegionList;
4176}
4177
4178//------------------------------------------------------------------------------
4179int vtkKdTree::GetRegionContainingPoint(double x, double y, double z)

Callers 2

CreateCellListsMethod · 0.95

Calls 4

GetNumberOfCellsMethod · 0.95
ComputeCellCentersMethod · 0.95
InitTraversalMethod · 0.45

Tested by

no test coverage detected