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

Method FindCell

Common/DataModel/vtkStaticCellLocator.cxx:484–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482//------------------------------------------------------------------------------
483template <typename T>
484vtkIdType CellProcessor<T>::FindCell(
485 const double pos[3], vtkGenericCell* cell, int& subId, double pcoords[3], double* weights)
486{
487 // check if pos outside of bounds
488 if (!CellProcessor::IsInBounds(this->Bounds, pos))
489 {
490 return -1;
491 }
492 vtkIdType binId = this->Binner->GetBinIndex(pos);
493 T numIds = this->GetNumberOfIds(binId);
494
495 // Only thread the evaluation if enough cells need to be processed
496 if (numIds < 1)
497 {
498 return -1;
499 }
500 // Run through serially. A parallel implementation is possible but does
501 // not seem to be much faster.
502 else
503 {
504 const CellFragments<T>* cellIds = this->GetIds(binId);
505 double dist2;
506 T cellId;
507
508 for (T j = 0; j < numIds; j++)
509 {
510 cellId = cellIds[j].CellId;
511
512 if (this->InsideCellBounds(pos, cellId))
513 {
514 this->DataSet->GetCell(cellId, cell);
515 if (cell->EvaluatePosition(pos, nullptr, subId, pcoords, dist2, weights) == 1)
516 {
517 return cellId;
518 }
519 } // in bounding box
520 } // for cells in this bin
521
522 return -1; // nothing found
523 } // serial
524}
525
526//------------------------------------------------------------------------------
527template <typename T>

Callers

nothing calls this directly

Calls 8

GetNumberOfIdsMethod · 0.95
GetIdsMethod · 0.95
InsideCellBoundsMethod · 0.95
BuildLocatorMethod · 0.95
IsInBoundsFunction · 0.85
GetBinIndexMethod · 0.45
GetCellMethod · 0.45
EvaluatePositionMethod · 0.45

Tested by

no test coverage detected