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

Method GetNextCell

Common/ExecutionModel/vtkSimpleScalarTree.cxx:305–343  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Return the next cell that may contain scalar value specified to initialize traversal. The value nullptr is returned if the list is exhausted. Make sure that InitTraversal() has been invoked first or you'll get erratic behavior.

Source from the content-addressed store, hash-verified

303// exhausted. Make sure that InitTraversal() has been invoked first or
304// you'll get erratic behavior.
305vtkCell* vtkSimpleScalarTree::GetNextCell(
306 vtkIdType& cellId, vtkIdList*& cellPts, vtkDataArray* cellScalars)
307{
308 double s, min = VTK_DOUBLE_MAX, max = (-VTK_DOUBLE_MAX);
309 vtkIdType i, numScalars;
310 vtkCell* cell;
311 vtkIdType numCells = this->NumCells;
312
313 while (this->TreeIndex < this->TreeSize)
314 {
315 for (; this->ChildNumber < this->BranchingFactor && this->CellId < numCells;
316 this->ChildNumber++, this->CellId++)
317 {
318 cell = this->DataSet->GetCell(this->CellId);
319 cellPts = cell->GetPointIds();
320 numScalars = cellPts->GetNumberOfIds();
321 cellScalars->SetNumberOfTuples(numScalars);
322 this->Scalars->GetTuples(cellPts, cellScalars);
323 for (i = 0; i < numScalars; i++)
324 {
325 s = cellScalars->GetTuple1(i);
326 min = std::min(s, min);
327 max = std::max(s, max);
328 }
329 if (this->ScalarValue >= min && this->ScalarValue <= max)
330 {
331 cellId = this->CellId;
332 this->ChildNumber++; // prepare for next time
333 this->CellId++;
334 return cell;
335 }
336 } // for each cell in this leaf
337
338 // If here, must have not found anything in this leaf
339 this->FindNextLeaf(this->TreeIndex, this->Level);
340 } // while not all leafs visited
341
342 return nullptr;
343}
344
345//------------------------------------------------------------------------------
346// Return the number of cell batches.

Callers

nothing calls this directly

Calls 9

FindNextLeafMethod · 0.95
GetTuple1Method · 0.80
minFunction · 0.50
maxFunction · 0.50
GetCellMethod · 0.45
GetPointIdsMethod · 0.45
GetNumberOfIdsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
GetTuplesMethod · 0.45

Tested by

no test coverage detected