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

Method GetPolyhedralGridCells

IO/Geometry/vtkTecplotReader.cxx:1104–1206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1102}
1103
1104void vtkTecplotReader::GetPolyhedralGridCells(
1105 int numCells, int numFaces, vtkUnstructuredGrid* unstruct) const
1106{
1107 auto tok = this->Internal->GetNextToken();
1108 while (tok.empty())
1109 {
1110 tok = this->Internal->GetNextToken();
1111 }
1112
1113 std::vector<size_t> nodeCountPerFace;
1114 size_t count;
1115 VTK_FROM_CHARS_IF_ERROR_RETURN(tok, count, );
1116 nodeCountPerFace.push_back(count);
1117
1118 for (vtkIdType i = 1; i < numFaces; ++i)
1119 {
1120 tok = this->Internal->GetNextToken();
1121 while (tok.empty())
1122 {
1123 tok = this->Internal->GetNextToken();
1124 }
1125 VTK_FROM_CHARS_IF_ERROR_RETURN(tok, count, );
1126 nodeCountPerFace.push_back(count);
1127 }
1128
1129 std::vector<std::vector<vtkIdType>> faces;
1130 for (vtkIdType i = 0; i < numFaces; ++i)
1131 {
1132 const size_t nodeCount = nodeCountPerFace[i];
1133 std::vector<vtkIdType> face;
1134 face.reserve(nodeCount);
1135
1136 for (size_t j = 0; j < nodeCount; ++j)
1137 {
1138 tok = this->Internal->GetNextToken();
1139 while (tok.empty())
1140 {
1141 tok = this->Internal->GetNextToken();
1142 }
1143 vtkIdType aVertexIndex;
1144 VTK_FROM_CHARS_IF_ERROR_RETURN(tok, aVertexIndex, );
1145 face.push_back(aVertexIndex - 1); // convert from FORTRAN to C-indexing
1146 }
1147
1148 faces.push_back(face);
1149 }
1150
1151 std::map<vtkIdType, std::vector<vtkIdType>> polyhedra;
1152
1153 for (vtkIdType i = 0; i < numFaces; ++i)
1154 {
1155 tok = this->Internal->GetNextToken();
1156 while (tok.empty())
1157 {
1158 tok = this->Internal->GetNextToken();
1159 }
1160 vtkIdType rightCell;
1161 VTK_FROM_CHARS_IF_ERROR_RETURN(tok, rightCell, );

Calls 8

GetNextTokenMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
InsertNextCellMethod · 0.45
dataMethod · 0.45
GetNumberOfCellsMethod · 0.45

Tested by

no test coverage detected