------------------------------------------------------------------------------
| 34 | |
| 35 | //------------------------------------------------------------------------------ |
| 36 | bool vtkAbstractCellLocator::StoreCellBounds() |
| 37 | { |
| 38 | if (this->CellBounds) |
| 39 | { |
| 40 | return false; |
| 41 | } |
| 42 | if (!this->DataSet) |
| 43 | { |
| 44 | return false; |
| 45 | } |
| 46 | // Allocate space for cell bounds storage, then fill |
| 47 | vtkIdType numCells = this->DataSet->GetNumberOfCells(); |
| 48 | this->CellBoundsSharedPtr = std::make_shared<std::vector<double>>(numCells * 6); |
| 49 | this->CellBounds = this->CellBoundsSharedPtr->data(); |
| 50 | |
| 51 | // This is done to cause non-thread safe initialization to occur due to |
| 52 | // side effects from GetCellBounds(). |
| 53 | this->DataSet->GetCellBounds(0, &this->CellBounds[0]); |
| 54 | |
| 55 | vtkSMPTools::For(1, numCells, |
| 56 | [&](vtkIdType begin, vtkIdType end) |
| 57 | { |
| 58 | for (vtkIdType cellId = begin; cellId < end; cellId++) |
| 59 | { |
| 60 | this->DataSet->GetCellBounds(cellId, &this->CellBounds[cellId * 6]); |
| 61 | } |
| 62 | }); |
| 63 | return true; |
| 64 | } |
| 65 | |
| 66 | //------------------------------------------------------------------------------ |
| 67 | void vtkAbstractCellLocator::FreeCellBounds() |
no test coverage detected