VTK  9.3.20240328
vtkMFIXReader.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
26 #ifndef vtkMFIXReader_h
27 #define vtkMFIXReader_h
28 
29 #include "vtkIOGeometryModule.h" // For export macro
31 
32 VTK_ABI_NAMESPACE_BEGIN
34 class vtkDoubleArray;
35 class vtkStringArray;
36 class vtkIntArray;
37 class vtkFloatArray;
39 class vtkWedge;
40 class vtkQuad;
41 class vtkHexahedron;
42 class vtkPoints;
43 
44 class VTKIOGEOMETRY_EXPORT vtkMFIXReader : public vtkUnstructuredGridAlgorithm
45 {
46 public:
47  static vtkMFIXReader* New();
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
58 
60 
64  vtkGetMacro(NumberOfCells, int);
66 
68 
72  vtkGetMacro(NumberOfPoints, int);
74 
76 
79  vtkGetMacro(NumberOfCellFields, int);
81 
83 
86  vtkSetMacro(TimeStep, int);
87  vtkGetMacro(TimeStep, int);
89 
91 
94  vtkGetMacro(NumberOfTimeSteps, int);
96 
98 
101  vtkGetVector2Macro(TimeStepRange, int);
102  vtkSetVector2Macro(TimeStepRange, int);
104 
109 
114  const char* GetCellArrayName(int index);
115 
117 
121  int GetCellArrayStatus(const char* name);
122  void SetCellArrayStatus(const char* name, int status);
124 
126 
132 
136  void GetCellDataRange(int cellComp, float* min, float* max);
137 
138 protected:
140  ~vtkMFIXReader() override;
143 
144  //
145  // ParaView Variables
146  //
147 
148  char* FileName;
158  int TimeStep;
162  int* TimeSteps;
163  int TimeStepRange[2];
165 
166  //
167  // MFIX Variables
168  //
169 
170  vtkFloatArray** CellDataArray; // Arrays for variables that will
171  // attach to mesh
172  vtkPoints* Points; // Points array for building grid
173  vtkUnstructuredGrid* Mesh; // Unstructured Grid
174  vtkHexahedron* AHexahedron; // Hexahedron type cell
175  vtkWedge* AWedge; // Wedge type cell
176  vtkQuad* AQuad; // Quad type cell
177  vtkIntArray* Flag; // Cell Flag array
178  vtkDoubleArray* Dx; // Cell widths in x axis
179  vtkDoubleArray* Dy; // Cell widths in y axis
180  vtkDoubleArray* Dz; // Cell widths in z axis
181  vtkIntArray* NMax; // Array to hold number of species per phase
182  vtkDoubleArray* C; // Array used to parse restart file
183  vtkIntArray* TempI; // Array used to parse restart file
184  vtkDoubleArray* TempD; // Array used to parse restart file
185  vtkIntArray* SpxFileExists; // Array for keeping track of
186  // what spx files exist.
187 
188  char FileExtension[15];
189  char DataBuffer[513];
190  char Version[120];
196  double Ce;
197  double Cf;
198  double Phi;
199  double PhiW;
200  double DeltaTime;
201  double XMinimum;
202  char RunName[256];
208  int IMaximum;
209  int JMaximum;
210  int KMaximum;
219  int MMAX;
221  double XLength;
222  double YLength;
223  double ZLength;
226  bool BkEpsilon;
227  char CoordinateSystem[17];
228  char Units[17];
229 
230  //
231  // SPX Variables
232  //
233 
234  int MaximumTimestep; // maximum timesteps amongst the variables
235  int SPXRecordsPerTimestep; // number of records in a single
236  // timestep for a variable
237  vtkIntArray* SPXToNVarTable; // number of variables in each spx file
238  vtkIntArray* VariableToSkipTable; // skip value for each variable, this
239  // is needed in spx files
240  // with more than one variable.
241  vtkIntArray* VariableTimesteps; // number of timesteps for each variable
242  vtkIntArray* VariableTimestepTable; // Since the number of timesteps
243  // vary between variables
244  // this is a table that looks
245  // up the appropriate timestep
246  // for the particular variable.
247  vtkIntArray* variableIndexToSPX; // This gives the spx file number for the
248  // particular variable.
249  vtkIntArray* VariableIndexToSPX; // This gives the spx file number for the
250  // particular variable.
251  vtkIntArray* SPXTimestepIndexTable; // This a table look up for the index
252  // into a file for a certain variable.
253 
254 private:
255  vtkMFIXReader(const vtkMFIXReader&) = delete;
256  void operator=(const vtkMFIXReader&) = delete;
257 
258  void MakeMesh(vtkUnstructuredGrid* output);
259  void SwapDouble(double& value);
260  void SwapFloat(float& value);
261  void SwapInt(int& value);
262  void GetInt(istream& in, int& val);
263  void GetDouble(istream& in, double& val);
264  void SkipBytes(istream& in, int n);
265  void RestartVersionNumber(const char* buffer);
266  void GetBlockOfDoubles(istream& in, vtkDoubleArray* v, int n);
267  void GetBlockOfFloats(istream& in, vtkFloatArray* v, int n);
268  void GetBlockOfInts(istream& in, vtkIntArray* v, int n);
269  void ReadRestartFile();
270  void GetVariableAtTimestep(int vari, int tstep, vtkFloatArray* v);
271  void CreateVariableNames();
272  void GetTimeSteps();
273  void MakeTimeStepTable(int numberOfVariables);
274  void SetProjectName(const char* infile);
275  void MakeSPXTimeStepIndexTable(int nvars);
276  void CalculateMaxTimeStep();
277  void GetNumberOfVariablesInSPXFiles();
278  void FillVectorVariable(int xindex, int yindex, int zindex, vtkFloatArray* v);
279  void ConvertVectorFromCylindricalToCartesian(int xindex, int zindex);
280  void GetAllTimes(vtkInformationVector* outputVector);
281 };
282 
283 VTK_ABI_NAMESPACE_END
284 #endif
Store on/off settings for data arrays, etc.
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
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.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:144
reads a dataset in MFIX file format
Definition: vtkMFIXReader.h:45
~vtkMFIXReader() override
vtkGetFilePathMacro(FileName)
Specify the file name of the MFIX Restart data file to read.
vtkIntArray * SPXToNVarTable
vtkQuad * AQuad
vtkIntArray * Flag
vtkSetFilePathMacro(FileName)
Specify the file name of the MFIX Restart data file to read.
vtkHexahedron * AHexahedron
void SetCellArrayStatus(const char *name, int status)
Get/Set whether the cell array with the given name is to be read.
int GetCellArrayStatus(const char *name)
Get/Set whether the cell array with the given name is to be read.
vtkUnstructuredGrid * Mesh
int GetNumberOfCellArrays()
Get the number of cell arrays available in the input.
int NumberOfReactionRates
vtkIntArray * VariableToSkipTable
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkIntArray * SPXTimestepIndexTable
vtkDoubleArray * TempD
const char * GetCellArrayName(int index)
Get the name of the cell array with the given index in the input.
vtkDoubleArray * Dz
vtkIntArray * VariableTimestepTable
vtkWedge * AWedge
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkDoubleArray * Dx
static vtkMFIXReader * New()
vtkStringArray * VariableNames
vtkIntArray * VariableTimesteps
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataArraySelection * CellDataArraySelection
vtkIntArray * NMax
vtkIntArray * VariableComponents
vtkFloatArray ** CellDataArray
int SPXRecordsPerTimestep
vtkDoubleArray * Dy
vtkIntArray * SpxFileExists
void EnableAllCellArrays()
Turn on/off all cell arrays.
vtkFloatArray * Maximum
vtkIntArray * VectorLength
vtkIntArray * VariableIndexToSPX
int RequestInformationFlag
vtkFloatArray * Minimum
void DisableAllCellArrays()
Turn on/off all cell arrays.
vtkPoints * Points
int NumberOfSPXFilesUsed
vtkDoubleArray * C
vtkIntArray * variableIndexToSPX
vtkIntArray * TempI
void GetCellDataRange(int cellComp, float *min, float *max)
Get the range of cell data.
represent and manipulate 3D points
Definition: vtkPoints.h:138
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:87
a vtkAbstractArray subclass for strings
Superclass for algorithms that produce only unstructured grid as output.
dataset represents arbitrary combinations of all possible cell types
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:85
Write VTK XML UnstructuredGrid files.
@ value
Definition: vtkX3D.h:220
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
#define max(a, b)