| 9857 | // Read area field at a timestep |
| 9858 | #if VTK_FOAMFILE_FINITE_AREA |
| 9859 | void vtkOpenFOAMReaderPrivate::GetAreaFieldAtTimeStep(const std::string& varName) |
| 9860 | { |
| 9861 | // Where to map data |
| 9862 | vtkPolyData* areaMesh = this->AreaMesh; |
| 9863 | |
| 9864 | // Really simple, skip if not selected, or no areaMesh |
| 9865 | const vtkIdType nFaces = (areaMesh ? areaMesh->GetNumberOfCells() : 0); |
| 9866 | |
| 9867 | if (!nFaces) |
| 9868 | { |
| 9869 | return; |
| 9870 | } |
| 9871 | |
| 9872 | vtkFoamIOobject io(this->CasePath, this->Parent); |
| 9873 | vtkFoamDict dict; |
| 9874 | if (!this->ReadFieldFile(io, dict, varName, this->Parent->CellDataArraySelection)) |
| 9875 | { |
| 9876 | return; |
| 9877 | } |
| 9878 | |
| 9879 | if (io.GetClassName().compare(0, 4, "area") != 0) |
| 9880 | { |
| 9881 | vtkErrorMacro(<< io.GetFileName() << " is not a areaField"); |
| 9882 | return; |
| 9883 | } |
| 9884 | |
| 9885 | // Eg, from "areaScalarField" -> SCALAR_TYPE |
| 9886 | const auto fieldDataType(vtkFoamTypes::FieldToEnum(io.GetClassName(), 4)); |
| 9887 | |
| 9888 | // ------------------------- |
| 9889 | // Handle dictionary lookups first |
| 9890 | |
| 9891 | // The "dimensions" entry - stringify |
| 9892 | const std::string dimString(this->ConstructDimensions(dict)); |
| 9893 | |
| 9894 | // The "internalField" entry |
| 9895 | vtkFoamEntry* ifieldEntry = nullptr; |
| 9896 | { |
| 9897 | ifieldEntry = dict.Lookup("internalField"); |
| 9898 | if (ifieldEntry == nullptr) |
| 9899 | { |
| 9900 | vtkErrorMacro(<< "internalField not found in " << io.GetFileName()); |
| 9901 | return; |
| 9902 | } |
| 9903 | else if (ifieldEntry->FirstValue().GetType() == vtkFoamToken::EMPTYLIST) |
| 9904 | { |
| 9905 | if (this->NumFaces) |
| 9906 | { |
| 9907 | vtkErrorMacro(<< "internalField of " << io.GetFileName() << " is empty"); |
| 9908 | } |
| 9909 | return; |
| 9910 | } |
| 9911 | } |
| 9912 | |
| 9913 | // Forget "boundaryField" entry |
| 9914 | // - don't really handle edge constraints, |
| 9915 | |
| 9916 | // ------------------------- |
no test coverage detected