--------------------------------------------------------------------------------------------------
| 614 | |
| 615 | //-------------------------------------------------------------------------------------------------- |
| 616 | bool vtkNetCDFUGRIDReader::FillCells(vtkUnstructuredGrid* output) |
| 617 | { |
| 618 | std::vector<int> faces{}; |
| 619 | faces.resize(this->NodesPerFace * this->FaceCount); |
| 620 | if (!this->CheckError(nc_get_var(this->NcId, this->FaceVarId, faces.data()))) |
| 621 | { |
| 622 | return false; |
| 623 | } |
| 624 | |
| 625 | output->Allocate(this->FaceCount); |
| 626 | |
| 627 | std::vector<vtkIdType> pointIds{}; |
| 628 | pointIds.resize(this->NodesPerFace); |
| 629 | for (std::size_t i = 0; i < this->FaceCount; ++i) |
| 630 | { |
| 631 | VTKCellType cell_type{ VTK_TRIANGLE }; |
| 632 | vtkIdType point_count{ 3 }; |
| 633 | |
| 634 | for (std::size_t j = 0; j < this->NodesPerFace; ++j) |
| 635 | { |
| 636 | const vtkIdType id = faces[j * this->NodesPerFaceStride + i * this->FaceStride]; |
| 637 | |
| 638 | if (this->NodesPerFace > 3 && id == this->FaceFillValue) |
| 639 | { |
| 640 | cell_type = VTK_TRIANGLE; |
| 641 | point_count = 3; |
| 642 | continue; |
| 643 | } |
| 644 | else if (this->NodesPerFace > 3) |
| 645 | { |
| 646 | cell_type = VTK_QUAD; |
| 647 | point_count = 4; |
| 648 | } |
| 649 | else |
| 650 | { |
| 651 | cell_type = VTK_TRIANGLE; |
| 652 | point_count = 3; |
| 653 | } |
| 654 | |
| 655 | pointIds[j] = id - this->FaceStartIndex; |
| 656 | } |
| 657 | |
| 658 | output->InsertNextCell(cell_type, point_count, pointIds.data()); |
| 659 | } |
| 660 | |
| 661 | return true; |
| 662 | } |
| 663 | |
| 664 | //-------------------------------------------------------------------------------------------------- |
| 665 | bool vtkNetCDFUGRIDReader::FillArrays(vtkUnstructuredGrid* output, std::size_t timeStep) |
no test coverage detected