| 10592 | |
| 10593 | #if VTK_FOAMFILE_FINITE_AREA |
| 10594 | bool vtkOpenFOAMReaderPrivate::GetAreaMesh( |
| 10595 | vtkPolyData* areaMesh, const vtkSmartPointer<vtkCellArray>& meshFaces, vtkPoints* points) |
| 10596 | { |
| 10597 | // Tie to faces instance (like zones etc) |
| 10598 | const std::string timeRegionDir(this->CurrentTimeRegionPath(this->PolyMeshTimeIndexFaces)); |
| 10599 | |
| 10600 | auto& zoneMap = this->areaMeshMap; |
| 10601 | zoneMap.clearAll(); // Remove all old ids and errors |
| 10602 | |
| 10603 | vtkFoamIOobject io(this->CasePath, this->Parent); |
| 10604 | |
| 10605 | // Read faMesh/faceLabels |
| 10606 | if (!io.OpenOrGzip(timeRegionDir + "/faMesh/faceLabels")) |
| 10607 | { |
| 10608 | // Not an error if missing |
| 10609 | return true; |
| 10610 | } |
| 10611 | const bool use64BitLabels = io.IsLabel64(); |
| 10612 | |
| 10613 | vtkSmartPointer<vtkDataArray> labelArray; |
| 10614 | |
| 10615 | { |
| 10616 | vtkFoamEntryValue dict(nullptr); |
| 10617 | dict.SetStreamOption(io); |
| 10618 | try |
| 10619 | { |
| 10620 | if (use64BitLabels) |
| 10621 | { |
| 10622 | dict.ReadNonUniformList<vtkFoamToken::LABELLIST, // |
| 10623 | vtkFoamRead::listTraits<vtkTypeInt64Array, vtkTypeInt64>>(io); |
| 10624 | } |
| 10625 | else |
| 10626 | { |
| 10627 | dict.ReadNonUniformList<vtkFoamToken::LABELLIST, // |
| 10628 | vtkFoamRead::listTraits<vtkTypeInt32Array, vtkTypeInt32>>(io); |
| 10629 | } |
| 10630 | |
| 10631 | // Capture content as smart pointer |
| 10632 | labelArray.TakeReference(dict.ReleasePtr<vtkDataArray>()); |
| 10633 | } |
| 10634 | catch (const vtkFoamError& err) |
| 10635 | { |
| 10636 | vtkErrorMacro(<< "Error reading line " << io.GetLineNumber() << " of " << io.GetFileName() |
| 10637 | << ": " << err); |
| 10638 | return false; |
| 10639 | } |
| 10640 | io.Close(); |
| 10641 | } |
| 10642 | |
| 10643 | if (labelArray) |
| 10644 | { |
| 10645 | vtkDataArray& labels = *labelArray; |
| 10646 | const vtkIdType nLabels = labels.GetNumberOfTuples(); |
| 10647 | |
| 10648 | // Transcribe into vtkIdList. Don't check for questionable entries just yet |
| 10649 | auto elemIds = vtkSmartPointer<vtkIdList>::New(); |
| 10650 | elemIds->SetNumberOfIds(nLabels); |
| 10651 |
no test coverage detected