| 6688 | // - sets NumPoints |
| 6689 | |
| 6690 | vtkSmartPointer<vtkFloatArray> vtkOpenFOAMReaderPrivate::ReadPointsFile( |
| 6691 | const std::string& timeRegionDir) |
| 6692 | { |
| 6693 | // Assume failure |
| 6694 | this->NumPoints = 0; |
| 6695 | |
| 6696 | vtkFoamIOobject io(this->CasePath, this->Parent); |
| 6697 | |
| 6698 | // Read polyMesh/points |
| 6699 | if (!io.OpenOrGzip(timeRegionDir + "/polyMesh/points")) |
| 6700 | { |
| 6701 | vtkErrorMacro(<< "Error opening " << io.GetFileName() << ": " << io.GetError()); |
| 6702 | #if VTK_OPENFOAM_TIME_PROFILING |
| 6703 | this->RequestDataTimeInMicroseconds += io.TimeInMicroseconds; |
| 6704 | this->RequestDataBytes += io.Bytes; |
| 6705 | #endif |
| 6706 | return nullptr; |
| 6707 | } |
| 6708 | |
| 6709 | vtkSmartPointer<vtkFloatArray> pointArray; |
| 6710 | |
| 6711 | try |
| 6712 | { |
| 6713 | vtkFoamEntryValue dict(nullptr); |
| 6714 | |
| 6715 | if (io.IsFloat64()) |
| 6716 | { |
| 6717 | dict.ReadNonUniformList<vtkFoamToken::VECTORLIST, // |
| 6718 | vtkFoamRead::vectorListTraits<vtkFloatArray, double, 3>>(io); |
| 6719 | } |
| 6720 | else |
| 6721 | { |
| 6722 | dict.ReadNonUniformList<vtkFoamToken::VECTORLIST, // |
| 6723 | vtkFoamRead::vectorListTraits<vtkFloatArray, float, 3>>(io); |
| 6724 | } |
| 6725 | |
| 6726 | // Capture content as smart pointer |
| 6727 | pointArray.TakeReference(dict.ReleasePtr<vtkFloatArray>()); |
| 6728 | #if VTK_OPENFOAM_TIME_PROFILING |
| 6729 | this->RequestDataTimeInMicroseconds += io.TimeInMicroseconds; |
| 6730 | this->RequestDataBytes += io.Bytes; |
| 6731 | #endif |
| 6732 | } |
| 6733 | catch (const vtkFoamError& err) |
| 6734 | { |
| 6735 | vtkErrorMacro("Mesh points data are neither 32 nor 64 bit, or some other " |
| 6736 | "parse error occurred while reading points. Failed at line " |
| 6737 | << io.GetLineNumber() << " of " << io.GetFileName() << ": " << err); |
| 6738 | #if VTK_OPENFOAM_TIME_PROFILING |
| 6739 | this->RequestDataTimeInMicroseconds += io.TimeInMicroseconds; |
| 6740 | this->RequestDataBytes += io.Bytes; |
| 6741 | #endif |
| 6742 | return nullptr; |
| 6743 | } |
| 6744 | |
| 6745 | assert(pointArray.Get() != nullptr); |
| 6746 | |
| 6747 | // The number of points |
no test coverage detected