------------------------------------------------------------------------------
| 52 | |
| 53 | //------------------------------------------------------------------------------ |
| 54 | int vtkCellLocatorStrategy::Initialize(vtkPointSet* ps) |
| 55 | { |
| 56 | // See whether anything has changed. If not, just return. |
| 57 | if (this->PointSet != nullptr && ps == this->PointSet && this->MTime < this->InitializeTime) |
| 58 | { |
| 59 | return 1; |
| 60 | } |
| 61 | |
| 62 | // Set up the point set; return on failure. |
| 63 | if (this->Superclass::Initialize(ps) == 0) |
| 64 | { |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | // Use the point set's cell locator preferentially. If no cell locator, |
| 69 | // then we need to create one. If one is specified here in the strategy, |
| 70 | // use that. If not, then used the point set's default build cell locator |
| 71 | // method. |
| 72 | vtkAbstractCellLocator* psCL = ps->GetCellLocator(); |
| 73 | if (psCL == nullptr) |
| 74 | { |
| 75 | if (this->CellLocator != nullptr) |
| 76 | { |
| 77 | // only the owner of the locator can change it |
| 78 | if (this->OwnsLocator) |
| 79 | { |
| 80 | this->CellLocator->SetDataSet(ps); |
| 81 | this->CellLocator->BuildLocator(); |
| 82 | } |
| 83 | } |
| 84 | else |
| 85 | { |
| 86 | ps->BuildCellLocator(); |
| 87 | psCL = ps->GetCellLocator(); |
| 88 | this->CellLocator = psCL; |
| 89 | this->OwnsLocator = false; |
| 90 | } |
| 91 | } |
| 92 | else |
| 93 | { |
| 94 | if (psCL != this->CellLocator) |
| 95 | { |
| 96 | this->CellLocator = psCL; |
| 97 | this->OwnsLocator = false; |
| 98 | } |
| 99 | // ensure that the point-set's locator is up-to-date |
| 100 | // this should be done only by one thread |
| 101 | if (!this->IsACopy) |
| 102 | { |
| 103 | this->CellLocator->BuildLocator(); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | this->InitializeTime.Modified(); |
| 108 | |
| 109 | return 1; |
| 110 | } |
| 111 |
nothing calls this directly
no test coverage detected