------------------------------------------------------------------------------ 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. This is serial traversal.
| 588 | // exhausted. Make sure that InitTraversal() has been invoked first or |
| 589 | // you'll get erratic behavior. This is serial traversal. |
| 590 | vtkCell* vtkSpanSpace::GetNextCell( |
| 591 | vtkIdType& cellId, vtkIdList*& cellPts, vtkDataArray* cellScalars) |
| 592 | { |
| 593 | // Where are we in the current span space row? If at the end, need to get the |
| 594 | // next row (or return if the last row) |
| 595 | while (this->CurrentIdx >= this->CurrentNumCells) |
| 596 | { |
| 597 | this->CurrentRow++; |
| 598 | if (this->CurrentRow >= this->RMax[1]) |
| 599 | { |
| 600 | return nullptr; |
| 601 | } |
| 602 | else |
| 603 | { |
| 604 | this->CurrentSpan = this->SpanSpace->GetCellsInSpan( |
| 605 | this->CurrentRow, this->RMin, this->RMax, this->CurrentNumCells); |
| 606 | this->CurrentIdx = 0; // beginning of row |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | // If here then get the next cell |
| 611 | vtkIdType numScalars; |
| 612 | vtkCell* cell; |
| 613 | cellId = this->CurrentSpan[this->CurrentIdx++]; |
| 614 | cell = this->DataSet->GetCell(cellId); |
| 615 | cellPts = cell->GetPointIds(); |
| 616 | numScalars = cellPts->GetNumberOfIds(); |
| 617 | cellScalars->SetNumberOfTuples(numScalars); |
| 618 | this->Scalars->GetTuples(cellPts, cellScalars); |
| 619 | |
| 620 | return cell; |
| 621 | } |
| 622 | |
| 623 | //------------------------------------------------------------------------------ |
| 624 | // Note the cell ids are copied into memory (CandidateCells) from |