------------------------------------------------------------------------------ Read volume or internal field at a timestep
| 9064 | //------------------------------------------------------------------------------ |
| 9065 | // Read volume or internal field at a timestep |
| 9066 | void vtkOpenFOAMReaderPrivate::GetVolFieldAtTimeStep( |
| 9067 | const std::string& varName, bool isInternalField) |
| 9068 | { |
| 9069 | // Where to map data |
| 9070 | vtkUnstructuredGrid* internalMesh = this->InternalMesh; |
| 9071 | vtkMultiBlockDataSet* boundaryMesh = this->BoundaryMesh; |
| 9072 | |
| 9073 | // Boundary information |
| 9074 | const auto& patches = this->BoundaryDict; |
| 9075 | const bool faceOwner64Bit = ::Is64BitArray(this->FaceOwner); |
| 9076 | |
| 9077 | vtkFoamIOobject io(this->CasePath, this->Parent); |
| 9078 | vtkFoamDict dict; |
| 9079 | if (!this->ReadFieldFile(io, dict, varName, this->Parent->CellDataArraySelection)) |
| 9080 | { |
| 9081 | #if VTK_OPENFOAM_TIME_PROFILING |
| 9082 | this->RequestDataTimeInMicroseconds += io.TimeInMicroseconds; |
| 9083 | this->RequestDataBytes += io.Bytes; |
| 9084 | #endif |
| 9085 | return; |
| 9086 | } |
| 9087 | |
| 9088 | // For internal field (eg, volScalarField::Internal) |
| 9089 | const bool hasColons = (io.GetClassName().find("::Internal") != std::string::npos); |
| 9090 | |
| 9091 | if ((io.GetClassName().compare(0, 3, "vol") != 0) || |
| 9092 | (hasColons ? !isInternalField : isInternalField)) |
| 9093 | { |
| 9094 | vtkErrorMacro(<< io.GetFileName() << " is not a volume/internal field"); |
| 9095 | #if VTK_OPENFOAM_TIME_PROFILING |
| 9096 | this->RequestDataTimeInMicroseconds += io.TimeInMicroseconds; |
| 9097 | this->RequestDataBytes += io.Bytes; |
| 9098 | #endif |
| 9099 | return; |
| 9100 | } |
| 9101 | |
| 9102 | // Eg, from "volScalarField" or "volScalarField::Internal" -> SCALAR_TYPE |
| 9103 | const auto fieldDataType(vtkFoamTypes::FieldToEnum(io.GetClassName(), 3)); |
| 9104 | |
| 9105 | // ------------------------- |
| 9106 | // Handle dictionary lookups first |
| 9107 | |
| 9108 | // The "dimensions" entry - stringify |
| 9109 | const std::string dimString(this->ConstructDimensions(dict)); |
| 9110 | |
| 9111 | // The "internalField" entry, or "value" for Dimensioned field |
| 9112 | vtkFoamEntry* ifieldEntry = nullptr; |
| 9113 | { |
| 9114 | const std::string entryName = (isInternalField ? "value" : "internalField"); |
| 9115 | |
| 9116 | ifieldEntry = dict.Lookup(entryName); |
| 9117 | if (ifieldEntry == nullptr) |
| 9118 | { |
| 9119 | vtkErrorMacro(<< entryName << " not found in " << io.GetFileName()); |
| 9120 | #if VTK_OPENFOAM_TIME_PROFILING |
| 9121 | this->RequestDataTimeInMicroseconds += io.TimeInMicroseconds; |
| 9122 | this->RequestDataBytes += io.Bytes; |
| 9123 | #endif |
no test coverage detected