VTK  9.7.20260711
vtkFLUENTCFFReader.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
37
38#ifndef vtkFLUENTCFFReader_h
39#define vtkFLUENTCFFReader_h
40
41#include <map> // std::map
42#include <memory> // std::unique_ptr
43
44#include "vtkIOFLUENTCFFModule.h" // For export macro
45
47#include "vtkNew.h" // For vtkNew
48
49VTK_ABI_NAMESPACE_BEGIN
52class vtkPoints;
53class vtkTriangle;
54class vtkTetra;
55class vtkQuad;
56class vtkHexahedron;
57class vtkPyramid;
59class vtkWedge;
60
61class VTKIOFLUENTCFF_EXPORT vtkFLUENTCFFReader : public vtkMultiBlockDataSetAlgorithm
62{
63public:
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
69
72 vtkSetMacro(FileName, std::string);
73 vtkGetMacro(FileName, std::string);
75
77
82 vtkSetMacro(RenameArrays, bool);
83 vtkGetMacro(RenameArrays, bool);
85
87
91 vtkGetMacro(NumberOfCells, vtkIdType);
93
98
103 const char* GetCellArrayName(int index);
104
106
110 int GetCellArrayStatus(const char* name);
111 void SetCellArrayStatus(const char* name, int status);
113
115
121
126
131 const char* GetFaceArrayName(int index);
132
134
138 int GetFaceArrayStatus(const char* name);
139 void SetFaceArrayStatus(const char* name, int status);
141
143
149
151
155 vtkSetMacro(ReadFaces, bool);
156 vtkGetMacro(ReadFaces, bool);
157 vtkBooleanMacro(ReadFaces, bool);
159
164
166 //
167 // Structures
168 //
169 struct Cell
170 {
171 int type;
172 int zone;
173 std::vector<int> faces;
175 int child;
176 std::vector<int> nodes;
177 std::vector<int> nodesOffset;
178 std::vector<int> childId;
179 };
180 struct Face
181 {
182 int type;
183 unsigned int zone;
184 std::vector<int> nodes;
185 int c0;
186 int c1;
189 int child;
194 };
195
196
201 vtkGetMacro(FaceSelection, vtkDataArraySelection*);
202
203protected:
208
213 {
218 };
219
221
224 virtual bool OpenCaseFile(const std::string& filename);
225 virtual DataState OpenDataFile(const std::string& filename);
227
231 virtual void GetNumberOfCellZones();
232
236 virtual int ParseCaseFile();
237
241 virtual int GetDimension();
242
244
247 virtual void GetNodesGlobal();
248 virtual void GetCellsGlobal();
249 virtual void GetFacesGlobal();
251
255 virtual void GetNodes();
256
260 virtual void GetCells();
261
265 virtual void GetFaces();
266
272
277 virtual void GetCellOverset();
278
282 virtual void GetCellTree();
283
287 virtual void GetFaceTree();
288
293
299
303 virtual void CleanCells();
304
306
310 virtual void PopulateCellNodes();
311 virtual void PopulateCellTree();
313
315
318 virtual void PopulateTriangleCell(int i);
319 virtual void PopulateTetraCell(int i);
320 virtual void PopulateQuadCell(int i);
321 virtual void PopulateHexahedronCell(int i);
322 virtual void PopulatePyramidCell(int i);
323 virtual void PopulateWedgeCell(int i);
324 virtual void PopulatePolyhedronCell(int i);
326
330 virtual int GetData();
331
335 virtual int GetMetaData();
336
337 //
338 // Variables
339 //
341 std::string FileName;
342 bool RenameArrays = false;
345
346 struct vtkInternals;
347 std::unique_ptr<vtkInternals> HDFImpl;
348
356
357 std::vector<Cell> Cells;
358 std::vector<Face> Faces;
359 std::vector<int> CellZones;
360
364
365private:
366 vtkFLUENTCFFReader(const vtkFLUENTCFFReader&) = delete;
367 void operator=(const vtkFLUENTCFFReader&) = delete;
368
369 struct FaceZone
370 {
371 std::string name;
372 int minId;
373 int maxId;
374 int zoneType;
375 };
376
377 struct DataChunk
378 {
379 std::string variableName;
380 vtkIdType zoneId;
381 size_t dim;
382 std::vector<double> dataVector;
383 };
384
385 typedef long long hid_t;
386 void ReadFieldMetaData(hid_t parentGroup, int iphase, std::vector<std::string>& container);
387
391 void ParseUDMData(
392 std::vector<vtkSmartPointer<vtkUnstructuredGrid>>& grid, const DataChunk& vectorDataChunk);
393
397 void CreateFaces(vtkMultiBlockDataSet* output);
398
403 void GetFaceZonesInformation();
404
410 void FillDataArrayForFaceZone(const FaceZone& zone, vtkUnstructuredGrid* faceGrid,
411 const std::map<unsigned int, vtkIdType>& faceIdToLocalIndex);
412
413 std::vector<DataChunk> DataChunks;
414 std::vector<std::string> PreReadData;
415 std::vector<std::string> PreReadFaceData;
416 int NumberOfArrays = 0;
417
418 std::map<int, FaceZone> FaceZonesById;
419
420 vtkNew<vtkDataArraySelection> FaceDataArraySelection;
421 bool ReadFaces = false;
422 vtkNew<vtkDataArraySelection> FaceSelection;
423};
424VTK_ABI_NAMESPACE_END
425#endif
Store on/off settings for data arrays, etc.
vtkNew< vtkTetra > Tetra
virtual void GetCellTree()
Get the tree (AMR) cell topology.
virtual void GetPeriodicShadowFaces()
Get the periodic shadown faces information !
virtual DataState OpenDataFile(const std::string &filename)
int GetFaceArrayStatus(const char *name)
Get/Set whether the face array with the given name is to be read.
void DisableAllCellArrays()
Turn on/off all cell arrays.
virtual void PopulatePolyhedronCell(int i)
const char * GetFaceArrayName(int index)
Get the name of the face array with the given index in the input.
int GetNumberOfFaceArrays()
Get the number of face arrays available in the input.
std::unique_ptr< vtkInternals > HDFImpl
std::vector< Face > Faces
void DisableAllFaceArrays()
Turn on/off all face arrays.
const char * GetCellArrayName(int index)
Get the name of the cell array with the given index in the input.
virtual void CleanCells()
Removes unnecessary faces from the cells.
virtual void PopulatePyramidCell(int i)
vtkNew< vtkQuad > Quad
vtkNew< vtkWedge > Wedge
virtual void PopulateHexahedronCell(int i)
virtual void PopulateCellTree()
virtual int GetData()
Read and reconstruct data from .dat.h5 file.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void GetNodes()
Get the size and index of node per zone.
int GetCellArrayStatus(const char *name)
Get/Set whether the cell array with the given name is to be read.
vtkMTimeType GetMTime() override
Overridden to take into account mtimes for vtkDataArraySelection instances.
virtual void GetFacesGlobal()
void SetFaceArrayStatus(const char *name, int status)
~vtkFLUENTCFFReader() override
virtual int GetMetaData()
Pre-read variable name data available for selection.
virtual void GetNumberOfCellZones()
Retrieve the number of cell zones.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
virtual void PopulateTetraCell(int i)
vtkNew< vtkTriangle > Triangle
virtual void PopulateCellNodes()
Reconstruct and convert the Fluent data format to the VTK format.
virtual void GetCells()
Get the topology of cell per zone.
virtual void GetNodesGlobal()
Get the total number of nodes/cells/faces.
virtual void PopulateQuadCell(int i)
virtual void GetFaces()
Get the topology of face per zone.
virtual void GetFaceTree()
Get the tree (AMR) face topology.
virtual void GetNonconformalGridInterfaceFaceInformation()
Get the non conformal grid interface information !
vtkNew< vtkPyramid > Pyramid
vtkNew< vtkPoints > Points
vtkNew< vtkHexahedron > Hexahedron
int GetNumberOfCellArrays()
Get the number of cell arrays available in the input.
vtkNew< vtkDataArraySelection > CellDataArraySelection
virtual void GetCellsGlobal()
void SetCellArrayStatus(const char *name, int status)
void EnableAllCellArrays()
virtual int ParseCaseFile()
Reads necessary information from the .cas file.
virtual int GetDimension()
Get the dimension of the file (2D/3D)
virtual void PopulateWedgeCell(int i)
virtual void PopulateTriangleCell(int i)
Reconstruct VTK cell topology from Fluent format.
std::vector< Cell > Cells
static vtkFLUENTCFFReader * New()
virtual void GetInterfaceFaceParents()
Get the interface id of parent faces.
void EnableAllFaceArrays()
virtual bool OpenCaseFile(const std::string &filename)
Open the HDF5 file structure.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
virtual void GetCellOverset()
Get the overset cells information !
std::vector< int > CellZones
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:168
represent and manipulate 3D points
Definition vtkPoints.h:140
a 3D cell that represents a linear pyramid
Definition vtkPyramid.h:95
a cell that represents a 2D quadrilateral
Definition vtkQuad.h:87
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
std::vector< int > nodesOffset
int vtkTypeBool
Definition vtkABI.h:64
int64_t hid_t
int vtkIdType
Definition vtkType.h:363
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318