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

Method GetPolygonalGridCells

IO/Geometry/vtkTecplotReader.cxx:1256–1325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1254}
1255
1256void vtkTecplotReader::GetPolygonalGridCells(
1257 int numFaces, int numEdges, vtkUnstructuredGrid* unstruct) const
1258{
1259 std::vector<std::pair<vtkIdType, vtkIdType>> edges;
1260
1261 for (int i = 0; i < numEdges; ++i)
1262 {
1263 auto tok1 = this->Internal->GetNextToken();
1264 while (tok1.empty())
1265 {
1266 tok1 = this->Internal->GetNextToken();
1267 }
1268 auto tok2 = this->Internal->GetNextToken();
1269 while (tok2.empty())
1270 {
1271 tok2 = this->Internal->GetNextToken();
1272 }
1273
1274 vtkIdType e1, e2;
1275 VTK_FROM_CHARS_IF_ERROR_RETURN(tok1, e1, );
1276 VTK_FROM_CHARS_IF_ERROR_RETURN(tok2, e2, );
1277 edges.emplace_back(e1 - 1, e2 - 1); // convert from FORTRAN to C-indexing
1278 }
1279
1280 std::map<vtkIdType, std::vector<vtkIdType>> faceEdges;
1281
1282 for (int i = 0; i < numEdges; ++i)
1283 {
1284 auto tok = this->Internal->GetNextToken();
1285 while (tok.empty())
1286 {
1287 tok = this->Internal->GetNextToken();
1288 }
1289
1290 vtkIdType leftElement;
1291 VTK_FROM_CHARS_IF_ERROR_RETURN(tok, leftElement, );
1292 if (leftElement > 0)
1293 {
1294 faceEdges[leftElement - 1].push_back(i);
1295 }
1296 }
1297
1298 for (int i = 0; i < numEdges; ++i)
1299 {
1300 auto tok = this->Internal->GetNextToken();
1301 while (tok.empty())
1302 {
1303 tok = this->Internal->GetNextToken();
1304 }
1305
1306 vtkIdType rightElement;
1307 VTK_FROM_CHARS_IF_ERROR_RETURN(tok, rightElement, );
1308 if (rightElement > 0)
1309 {
1310 faceEdges[rightElement - 1].push_back(i);
1311 }
1312 }
1313

Calls 9

OrderEdgesFunction · 0.85
GetNextTokenMethod · 0.80
emptyMethod · 0.45
emplace_backMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
InsertNextCellMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetPointerMethod · 0.45

Tested by

no test coverage detected