MCPcopy Create free account
hub / github.com/Kitware/VTK / FillCells

Method FillCells

IO/NetCDF/vtkNetCDFUGRIDReader.cxx:616–662  ·  view source on GitHub ↗

--------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

614
615//--------------------------------------------------------------------------------------------------
616bool 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//--------------------------------------------------------------------------------------------------
665bool vtkNetCDFUGRIDReader::FillArrays(vtkUnstructuredGrid* output, std::size_t timeStep)

Callers 1

RequestDataMethod · 0.95

Calls 6

CheckErrorMethod · 0.95
nc_get_varFunction · 0.85
resizeMethod · 0.45
dataMethod · 0.45
AllocateMethod · 0.45
InsertNextCellMethod · 0.45

Tested by

no test coverage detected