| 34 | vtkStandardNewMacro(vtkUnstructuredGridToCellGrid::TranscribeQuery); |
| 35 | |
| 36 | bool vtkUnstructuredGridToCellGrid::TranscribeQuery::Initialize() |
| 37 | { |
| 38 | bool ok = this->Superclass::Initialize(); |
| 39 | if (!this->Input) |
| 40 | { |
| 41 | return false; |
| 42 | } |
| 43 | switch (this->Phase) |
| 44 | { |
| 45 | case VTK_TRANSCRIBE_CELLGRID_PHASE_CLAIM: |
| 46 | { |
| 47 | // Reset all claims (erasing the number of cells, but preserving any |
| 48 | // preferred cell-type and priority value. |
| 49 | for (auto& entry : this->CellTypeMap) |
| 50 | { |
| 51 | entry.second.NumberOfCells = |
| 52 | -1; // TODO: If the input dataset has not been modified, do nothing? |
| 53 | } |
| 54 | // Populate the CellTypeMap with numbers of cells of each cell type present. |
| 55 | auto it = vtk::TakeSmartPointer(this->Input->NewCellIterator()); |
| 56 | for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell()) |
| 57 | { |
| 58 | int cellType = it->GetCellType(); |
| 59 | ++(this->CellTypeMap[cellType].NumberOfCells); |
| 60 | } |
| 61 | } |
| 62 | break; |
| 63 | case VTK_TRANSCRIBE_CELLGRID_PHASE_CONVERT: |
| 64 | break; |
| 65 | } |
| 66 | return ok; |
| 67 | } |
| 68 | |
| 69 | bool vtkUnstructuredGridToCellGrid::TranscribeQuery::Finalize() |
| 70 | { |
no test coverage detected