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

Method PassThroughUnstructuredGrid

IO/EnSight/core/EnSightDataSet.cxx:2487–2565  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2485
2486//------------------------------------------------------------------------------
2487void EnSightDataSet::PassThroughUnstructuredGrid(const GridOptions& vtkNotUsed(opts), int partId)
2488{
2489 auto it = this->PartInfoMap.find(partId);
2490 if (it == this->PartInfoMap.end())
2491 {
2492 // shouldn't happen but just in case
2493 vtkGenericWarningMacro("Part Id " << partId << " could not be found in PartInfoMap");
2494 return;
2495 }
2496 auto& numPts = it->second.NumNodes;
2497 auto& numCellsPerType = it->second.NumElementsPerType;
2498 this->GeometryFile.ReadNumber(&numPts);
2499
2500 if (this->NodeIdsListed)
2501 {
2502 this->GeometryFile.SkipNNumbers<int>(numPts);
2503 }
2504
2505 // because of the way fortran binary files are, we have
2506 // call SkipNNumbers for each set of coordinates
2507 this->GeometryFile.SkipNNumbers<float>(numPts);
2508 this->GeometryFile.SkipNNumbers<float>(numPts);
2509 this->GeometryFile.SkipNNumbers<float>(numPts);
2510
2511 // skip cell info
2512 auto result = this->GeometryFile.ReadNextLine();
2513 if (result.second.find("part") != std::string::npos)
2514 {
2515 // reset this so part reading is correct when we leave this method
2516 this->GeometryFile.GoBackOneLine();
2517 return;
2518 }
2519 auto elementType = getElementTypeFromString(result.second);
2520 while (result.first && elementType != ElementType::Unknown)
2521 {
2522 if (elementType == ElementType::NSided)
2523 {
2524 this->SkipNSidedSection(numCellsPerType[static_cast<int>(elementType)]);
2525 }
2526 else if (elementType == ElementType::NFaced)
2527 {
2528 this->SkipNFacedSection(numCellsPerType[static_cast<int>(elementType)]);
2529 }
2530 else
2531 {
2532 this->GeometryFile.ReadNumber(&numCellsPerType[static_cast<int>(elementType)]);
2533
2534 if (this->ElementIdsListed)
2535 {
2536 this->GeometryFile.SkipNNumbers<int>(numCellsPerType[static_cast<int>(elementType)]);
2537 }
2538 auto cellInfo = getVTKCellType(elementType);
2539 if (this->GeometryFile.Format == FileType::ASCII)
2540 {
2541 this->GeometryFile.SkipNNumbers<float>(
2542 numCellsPerType[static_cast<int>(elementType)], cellInfo.second);
2543 }
2544 else

Callers 2

ReadGeometryMethod · 0.95
GetPartInfoMethod · 0.95

Calls 10

SkipNSidedSectionMethod · 0.95
SkipNFacedSectionMethod · 0.95
getElementTypeFromStringFunction · 0.85
getVTKCellTypeFunction · 0.85
ReadNumberMethod · 0.80
ReadNextLineMethod · 0.80
GoBackOneLineMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected