VTK  9.6.20260204
vtkFLUENTReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
39
40#ifndef vtkFLUENTReader_h
41#define vtkFLUENTReader_h
42
43#include "vtkIOGeometryModule.h" // For export macro
45#include "vtkNew.h" // For vtkNew
46
47#include <set>
48#include <unordered_map>
49
50VTK_ABI_NAMESPACE_BEGIN
52class vtkPoints;
53class vtkTriangle;
54class vtkTetra;
55class vtkQuad;
56class vtkHexahedron;
57class vtkPyramid;
58class vtkWedge;
61
62class VTKIOGEOMETRY_EXPORT vtkFLUENTReader : public vtkMultiBlockDataSetAlgorithm
63{
64public:
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
70
76
78
82 vtkGetMacro(NumberOfCells, vtkIdType);
84
86
90 vtkGetMacro(CacheData, bool);
91 vtkSetMacro(CacheData, bool);
92 vtkBooleanMacro(CacheData, bool);
94
99
104 const char* GetCellArrayName(int index);
105
107
111 int GetCellArrayStatus(const char* name);
112 void SetCellArrayStatus(const char* name, int status);
114
116
122
124
130
132
151 //
152 // Structures
153 //
154 struct Cell;
155 struct Face;
156 struct Zone;
157 struct ZoneSection;
158 struct ScalarDataChunk;
159 struct VectorDataChunk;
160 struct SubSection;
162
169
170protected:
175
177
181 vtkSetMacro(SwapBytes, vtkTypeBool);
182 vtkTypeBool GetSwapBytes() { return this->SwapBytes; }
183 vtkBooleanMacro(SwapBytes, vtkTypeBool);
185
186 virtual bool OpenCaseFile(const char* filename);
187 virtual bool OpenDataFile(const char* filename);
188 virtual int GetCaseChunk();
189 virtual int GetCaseIndex();
190 virtual void LoadVariableNames();
191 virtual int GetDataIndex();
192 virtual int GetDataChunk();
194
195 virtual int GetDimension();
196 virtual void GetLittleEndianFlag();
197 virtual void GetNodesAscii();
200 virtual void GetCellsAscii();
201 virtual void GetCellsBinary();
202 virtual bool GetFacesAscii();
203 virtual void GetFacesBinary();
206 virtual void GetCellTreeAscii();
207 virtual void GetCellTreeBinary();
208 virtual void GetFaceTreeAscii();
209 virtual void GetFaceTreeBinary();
214 virtual void GetPartitionInfo() {}
215 virtual void CleanCells();
216 virtual void PopulateCellNodes();
217 virtual int GetCaseBufferInt(int ptr);
218 virtual float GetCaseBufferFloat(int ptr);
219 virtual double GetCaseBufferDouble(int ptr);
220 virtual void PopulateTriangleCell(size_t cellIdx);
221 virtual void PopulateTetraCell(size_t cellIdx);
222 virtual void PopulateQuadCell(size_t cellIdx);
223 virtual void PopulateHexahedronCell(size_t cellIdx);
224 virtual void PopulatePyramidCell(size_t cellIdx);
225 virtual void PopulateWedgeCell(size_t cellIdx);
226 virtual void PopulatePolyhedronCell(size_t cellIdx);
227 virtual int GetDataBufferInt(int ptr);
228 virtual float GetDataBufferFloat(int ptr);
229 virtual double GetDataBufferDouble(int ptr);
230 virtual void GetData(int dataType);
231 virtual bool ParallelCheckCell(int vtkNotUsed(i)) { return true; }
232
233private:
237 bool AreCellsEnabled();
241 void DisableCellsAndFaces(std::vector<unsigned int>& disabledZones);
245 void DisableZones(std::vector<unsigned int>& disabledZones, bool& areAllZonesDisabled);
249 bool FillMultiblock(std::vector<unsigned int>& disabledZones,
250 std::vector<size_t>& zoneIDToBlockIdx,
251 std::vector<vtkSmartPointer<vtkUnstructuredGrid>>& blockUGs);
255 void FillMultiblockData(std::vector<unsigned int>& disabledZones,
256 std::vector<size_t>& zoneIDToBlockIdx,
257 std::vector<vtkSmartPointer<vtkUnstructuredGrid>>& blockUGs);
261 void GetArraysFromSubSections();
265 void InitOutputBlocks(vtkMultiBlockDataSet* output, std::vector<size_t>& zoneIDToBlockIdx,
266 std::vector<vtkSmartPointer<vtkUnstructuredGrid>>& blockUGs);
270 void ParseDataZone(int index);
277 void ParseDataZones(bool areCellsEnabled);
281 void ParseZone(int index);
288 void ParseZones(bool areCellsEnabled);
293 bool PreParseDataFile();
299 bool PreParseFluentFile();
304 bool ReadDataZoneSectionId(unsigned int& zoneSectionId);
309 bool ReadZoneSectionId(unsigned int& zoneSectionId);
314 bool ReadZoneSection(int limit);
315
319 void UpdateZoneSectionSelection();
320
332 void FillMultiBlockFromFaces(std::vector<vtkSmartPointer<vtkUnstructuredGrid>>& blockUGs,
333 const std::vector<size_t>& zoneIDToBlockIdx, std::vector<unsigned int> disabledZones);
334
335 vtkFLUENTReader(const vtkFLUENTReader&) = delete;
336 void operator=(const vtkFLUENTReader&) = delete;
337
338 //
339 // Variables
340 //
341 vtkNew<vtkDataArraySelection> ZoneSectionSelection;
342 vtkNew<vtkDataArraySelection> CellDataArraySelection;
343 char* FileName = nullptr;
344 vtkIdType NumberOfCells = 0;
345 bool CacheData = true;
346
347 istream* FluentFile = nullptr;
348 istream* FluentDataFile = nullptr;
349 std::string FluentBuffer;
350 std::string DataBuffer;
351
352 // File data cache
353 vtkNew<vtkPoints> Points;
354 std::vector<Cell> Cells;
355 std::vector<Face> Faces;
356 std::vector<ZoneSection> ZoneSections;
357 std::map<size_t, std::string> VariableNames;
358 std::vector<ScalarDataChunk> ScalarDataChunks;
359 std::vector<VectorDataChunk> VectorDataChunks;
360 std::vector<SubSection> SubSections;
361
362 std::vector<std::string> ScalarVariableNames;
363 std::vector<int> ScalarSubSectionIds;
364 std::vector<std::string> VectorVariableNames;
365 std::vector<int> VectorSubSectionIds;
366
367 vtkTypeBool SwapBytes;
368 int GridDimension = 0;
369 int NumberOfScalars = 0;
370 int NumberOfVectors = 0;
371
372 std::vector<Zone> Zones;
373 std::vector<Zone> DataZones;
374 std::vector<Cell> CurrentCells;
375 std::vector<Face> CurrentFaces;
376 std::vector<ZoneSection> CurrentZoneSections;
377
378 bool IsFilePreParsed = false;
379};
380
381VTK_ABI_NAMESPACE_END
382#endif
a 3D cell defined by a set of convex points
Store on/off settings for data arrays, etc.
reads a dataset in Fluent file format
virtual void PopulateWedgeCell(size_t cellIdx)
virtual void GetPeriodicShadowFacesBinary()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void GetPartitionInfo()
virtual void PopulateQuadCell(size_t cellIdx)
~vtkFLUENTReader() override
virtual void GetData(int dataType)
virtual void GetSpeciesVariableNames()
virtual void GetFaceTreeAscii()
virtual void PopulatePolyhedronCell(size_t cellIdx)
virtual void GetNonconformalGridInterfaceFaceInformationBinary()
virtual void GetInterfaceFaceParentsAscii()
virtual void PopulatePyramidCell(size_t cellIdx)
virtual void GetNodesDoublePrecision()
virtual void CleanCells()
vtkGetFilePathMacro(FileName)
Specify the file name of the Fluent file to read.
virtual float GetDataBufferFloat(int ptr)
virtual bool OpenDataFile(const char *filename)
virtual void GetCellsBinary()
virtual void GetPeriodicShadowFacesAscii()
virtual double GetDataBufferDouble(int ptr)
virtual void PopulateCellNodes()
virtual void GetCellTreeBinary()
const char * GetCellArrayName(int index)
Get the name of the cell array with the given index in the input.
void SetDataByteOrder(int)
These methods should be used instead of the SwapBytes methods.
void SetDataByteOrderToLittleEndian()
These methods should be used instead of the SwapBytes methods.
virtual int GetDataBufferInt(int ptr)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkTypeBool GetSwapBytes()
Set/Get the byte swapping to explicitly swap the bytes of a file.
virtual void PopulateHexahedronCell(size_t cellIdx)
virtual int GetCaseBufferInt(int ptr)
virtual void GetInterfaceFaceParentsBinary()
vtkDataArraySelection * GetZoneSectionSelection()
Zone section selection, to determine which zone sections are loaded.
void SetCellArrayStatus(const char *name, int status)
Get/Set whether the cell array with the given name is to be read.
virtual void GetFaceTreeBinary()
virtual void GetCellsAscii()
int GetCellArrayStatus(const char *name)
Get/Set whether the cell array with the given name is to be read.
virtual void PopulateTetraCell(size_t cellIdx)
void EnableAllCellArrays()
Turn on/off all cell arrays.
virtual double GetCaseBufferDouble(int ptr)
virtual float GetCaseBufferFloat(int ptr)
virtual void GetFacesBinary()
virtual void GetNodesAscii()
virtual int GetCaseIndex()
virtual int GetCaseChunk()
virtual void GetNonconformalGridInterfaceFaceInformationAscii()
int GetDataByteOrder()
These methods should be used instead of the SwapBytes methods.
vtkSetFilePathMacro(FileName)
Specify the file name of the Fluent file to read.
void SetDataByteOrderToBigEndian()
These methods should be used instead of the SwapBytes methods.
virtual bool ParallelCheckCell(int i)
const char * GetDataByteOrderAsString()
These methods should be used instead of the SwapBytes methods.
virtual void PopulateTriangleCell(size_t cellIdx)
virtual void GetLittleEndianFlag()
virtual int GetDataChunk()
virtual void GetNodesSinglePrecision()
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
virtual bool GetFacesAscii()
virtual void GetCellTreeAscii()
virtual bool OpenCaseFile(const char *filename)
virtual int GetDimension()
virtual void LoadVariableNames()
vtkMTimeType GetMTime() override
Get the last modified time of this filter.
int GetNumberOfCellArrays()
Get the number of cell arrays available in the input.
static vtkFLUENTReader * New()
virtual int GetDataIndex()
void DisableAllCellArrays()
Turn on/off all cell arrays.
a cell that represents a linear 3D hexahedron
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Composite dataset that organizes datasets into blocks.
Allocate and hold a VTK object.
Definition vtkNew.h:167
represent and manipulate 3D points
Definition vtkPoints.h:139
a 3D cell that represents a linear pyramid
Definition vtkPyramid.h:95
a cell that represents a 2D quadrilateral
Definition vtkQuad.h:87
Hold a reference to a vtkObjectBase instance.
a 3D cell that represents a tetrahedron
Definition vtkTetra.h:113
a cell that represents a triangle
dataset represents arbitrary combinations of all possible cell types
a 3D cell that represents a linear wedge
Definition vtkWedge.h:85
int vtkTypeBool
Definition vtkABI.h:64
@ Cells
A cell specified by degrees of freedom held in arrays.
int vtkIdType
Definition vtkType.h:354
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:309