------------------------------------------------------------------------------
| 1326 | |
| 1327 | //------------------------------------------------------------------------------ |
| 1328 | void vtkTecplotReader::GetUnstructuredGridCells( |
| 1329 | int numberCells, const char* cellTypeStr, vtkUnstructuredGrid* unstrctGrid) |
| 1330 | { |
| 1331 | if (!cellTypeStr || !unstrctGrid) |
| 1332 | { |
| 1333 | vtkErrorMacro(<< "Cell type (connectivity type) unspecified or nullptr " |
| 1334 | << "vtkUnstructuredGrid object."); |
| 1335 | return; |
| 1336 | } |
| 1337 | |
| 1338 | // determine the number of points per cell and the cell type |
| 1339 | int numCellPnts = -1; |
| 1340 | int theCellType = -1; |
| 1341 | |
| 1342 | if (strcmp(cellTypeStr, "BRICK") == 0) |
| 1343 | { |
| 1344 | numCellPnts = 8; |
| 1345 | theCellType = VTK_HEXAHEDRON; |
| 1346 | this->Internal->TopologyDim = vtkMath::Max(this->Internal->TopologyDim, 3); |
| 1347 | } |
| 1348 | else if (strcmp(cellTypeStr, "TRIANGLE") == 0) |
| 1349 | { |
| 1350 | numCellPnts = 3; |
| 1351 | theCellType = VTK_TRIANGLE; |
| 1352 | this->Internal->TopologyDim = vtkMath::Max(this->Internal->TopologyDim, 2); |
| 1353 | } |
| 1354 | else if (strcmp(cellTypeStr, "QUADRILATERAL") == 0) |
| 1355 | { |
| 1356 | numCellPnts = 4; |
| 1357 | theCellType = VTK_QUAD; |
| 1358 | this->Internal->TopologyDim = vtkMath::Max(this->Internal->TopologyDim, 2); |
| 1359 | } |
| 1360 | else if (strcmp(cellTypeStr, "TETRAHEDRON") == 0) |
| 1361 | { |
| 1362 | numCellPnts = 4; |
| 1363 | theCellType = VTK_TETRA; |
| 1364 | this->Internal->TopologyDim = vtkMath::Max(this->Internal->TopologyDim, 3); |
| 1365 | } |
| 1366 | else if (strcmp(cellTypeStr, "POINT") == 0 || strcmp(cellTypeStr, "") == 0) |
| 1367 | { |
| 1368 | numCellPnts = 1; |
| 1369 | theCellType = VTK_VERTEX; |
| 1370 | this->Internal->TopologyDim = vtkMath::Max(this->Internal->TopologyDim, 0); |
| 1371 | } |
| 1372 | else |
| 1373 | { |
| 1374 | vtkErrorMacro(<< this->FileName << ": Unknown cell type for a zone."); |
| 1375 | return; |
| 1376 | } |
| 1377 | |
| 1378 | // the storage of each cell begins with the number of points per cell, |
| 1379 | // followed by a list of point ids representing the cell |
| 1380 | vtkIdTypeArray* cellInfoList = vtkIdTypeArray::New(); |
| 1381 | cellInfoList->SetNumberOfValues((numCellPnts + 1) * numberCells); |
| 1382 | vtkIdType* cellInforPtr = cellInfoList->GetPointer(0); |
| 1383 | |
| 1384 | // type of each cell |
| 1385 | vtkUnsignedCharArray* cellTypeList = vtkUnsignedCharArray::New(); |
no test coverage detected