VTK  9.2.6
vtkMFIXReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMFIXReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
38 #ifndef vtkMFIXReader_h
39 #define vtkMFIXReader_h
40 
41 #include "vtkIOGeometryModule.h" // For export macro
43 
45 class vtkDoubleArray;
46 class vtkStringArray;
47 class vtkIntArray;
48 class vtkFloatArray;
50 class vtkWedge;
51 class vtkQuad;
52 class vtkHexahedron;
53 class vtkPoints;
54 class vtkStdString;
55 
56 class VTKIOGEOMETRY_EXPORT vtkMFIXReader : public vtkUnstructuredGridAlgorithm
57 {
58 public:
59  static vtkMFIXReader* New();
61  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
64 
67  vtkSetFilePathMacro(FileName);
68  vtkGetFilePathMacro(FileName);
70 
72 
76  vtkGetMacro(NumberOfCells, int);
78 
80 
84  vtkGetMacro(NumberOfPoints, int);
86 
88 
91  vtkGetMacro(NumberOfCellFields, int);
93 
95 
98  vtkSetMacro(TimeStep, int);
99  vtkGetMacro(TimeStep, int);
101 
103 
106  vtkGetMacro(NumberOfTimeSteps, int);
108 
110 
113  vtkGetVector2Macro(TimeStepRange, int);
114  vtkSetVector2Macro(TimeStepRange, int);
116 
120  int GetNumberOfCellArrays(void);
121 
126  const char* GetCellArrayName(int index);
127 
129 
133  int GetCellArrayStatus(const char* name);
134  void SetCellArrayStatus(const char* name, int status);
136 
138 
141  void DisableAllCellArrays();
142  void EnableAllCellArrays();
144 
148  void GetCellDataRange(int cellComp, float* min, float* max);
149 
150 protected:
151  vtkMFIXReader();
152  ~vtkMFIXReader() override;
155 
156  //
157  // ParaView Variables
158  //
159 
160  char* FileName;
170  int TimeStep;
174  int* TimeSteps;
175  int TimeStepRange[2];
177 
178  //
179  // MFIX Variables
180  //
181 
182  vtkFloatArray** CellDataArray; // Arrays for variables that will
183  // attach to mesh
184  vtkPoints* Points; // Points array for building grid
185  vtkUnstructuredGrid* Mesh; // Unstructured Grid
186  vtkHexahedron* AHexahedron; // Hexahedron type cell
187  vtkWedge* AWedge; // Wedge type cell
188  vtkQuad* AQuad; // Quad type cell
189  vtkIntArray* Flag; // Cell Flag array
190  vtkDoubleArray* Dx; // Cell widths in x axis
191  vtkDoubleArray* Dy; // Cell widths in y axis
192  vtkDoubleArray* Dz; // Cell widths in z axis
193  vtkIntArray* NMax; // Array to hold number of species per phase
194  vtkDoubleArray* C; // Array used to parse restart file
195  vtkIntArray* TempI; // Array used to parse restart file
196  vtkDoubleArray* TempD; // Array used to parse restart file
197  vtkIntArray* SpxFileExists; // Array for keeping track of
198  // what spx files exist.
199 
200  char FileExtension[15];
201  char DataBuffer[513];
202  char Version[120];
208  double Ce;
209  double Cf;
210  double Phi;
211  double PhiW;
212  double DeltaTime;
213  double XMinimum;
214  char RunName[256];
220  int IMaximum;
221  int JMaximum;
222  int KMaximum;
231  int MMAX;
233  double XLength;
234  double YLength;
235  double ZLength;
238  bool BkEpsilon;
239  char CoordinateSystem[17];
240  char Units[17];
241 
242  //
243  // SPX Variables
244  //
245 
246  int MaximumTimestep; // maximum timesteps amongst the variables
247  int SPXRecordsPerTimestep; // number of records in a single
248  // timestep for a variable
249  vtkIntArray* SPXToNVarTable; // number of variables in each spx file
250  vtkIntArray* VariableToSkipTable; // skip value for each variable, this
251  // is needed in spx files
252  // with more than one variable.
253  vtkIntArray* VariableTimesteps; // number of timesteps for each variable
254  vtkIntArray* VariableTimestepTable; // Since the number of timesteps
255  // vary between variables
256  // this is a table that looks
257  // up the appropriate timestep
258  // for the particular variable.
259  vtkIntArray* variableIndexToSPX; // This gives the spx file number for the
260  // particular variable.
261  vtkIntArray* VariableIndexToSPX; // This gives the spx file number for the
262  // particular variable.
263  vtkIntArray* SPXTimestepIndexTable; // This a table look up for the index
264  // into a file for a certain variable.
265 
266 private:
267  vtkMFIXReader(const vtkMFIXReader&) = delete;
268  void operator=(const vtkMFIXReader&) = delete;
269 
270  void MakeMesh(vtkUnstructuredGrid* output);
271  void SwapDouble(double& value);
272  void SwapFloat(float& value);
273  void SwapInt(int& value);
274  vtkStdString ConvertIntToString(int in);
275  int ConvertCharToInt(char in);
276  int ConvertStringToInt(const vtkStdString& in);
277  void GetInt(istream& in, int& val);
278  void GetDouble(istream& in, double& val);
279  void GetFloat(istream& in, float& val);
280  void SkipBytes(istream& in, int n);
281  void RestartVersionNumber(const char* buffer);
282  void GetBlockOfDoubles(istream& in, vtkDoubleArray* v, int n);
283  void GetBlockOfFloats(istream& in, vtkFloatArray* v, int n);
284  void GetBlockOfInts(istream& in, vtkIntArray* v, int n);
285  void ReadRestartFile();
286  void GetVariableAtTimestep(int vari, int tstep, vtkFloatArray* v);
287  void CreateVariableNames();
288  void GetTimeSteps();
289  void MakeTimeStepTable(int numberOfVariables);
290  void SetProjectName(const char* infile);
291  void MakeSPXTimeStepIndexTable(int nvars);
292  void CalculateMaxTimeStep();
293  void GetNumberOfVariablesInSPXFiles();
294  void FillVectorVariable(int xindex, int yindex, int zindex, vtkFloatArray* v);
295  void ConvertVectorFromCylindricalToCartesian(int xindex, int zindex);
296  void GetAllTimes(vtkInformationVector* outputVector);
297 };
298 
299 #endif
int NumberOfReactionRates
vtkIntArray * VariableTimesteps
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
vtkIntArray * SPXToNVarTable
int NumberOfSPXFilesUsed
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
int SPXRecordsPerTimestep
vtkIntArray * VectorLength
vtkFloatArray * Minimum
vtkIntArray * SpxFileExists
vtkIntArray * VariableComponents
vtkIntArray * VariableIndexToSPX
Store vtkAlgorithm input/output information.
vtkDoubleArray * Dy
static vtkUnstructuredGridAlgorithm * New()
vtkDataArraySelection * CellDataArraySelection
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
a vtkAbstractArray subclass for strings
vtkQuad * AQuad
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:38
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkFloatArray ** CellDataArray
reads a dataset in MFIX file format
Definition: vtkMFIXReader.h:56
vtkFloatArray * Maximum
vtkPoints * Points
dynamic, self-adjusting array of double
vtkDoubleArray * Dz
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIntArray * Flag
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkStringArray * VariableNames
vtkIntArray * SPXTimestepIndexTable
Store on/off settings for data arrays, etc.
dataset represents arbitrary combinations of all possible cell types
vtkDoubleArray * C
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:44
Superclass for algorithms that produce only unstructured grid as output.
vtkHexahedron * AHexahedron
vtkIntArray * VariableToSkipTable
vtkUnstructuredGrid * Mesh
vtkDoubleArray * TempD
vtkIntArray * VariableTimestepTable
vtkDoubleArray * Dx
Write VTK XML UnstructuredGrid files.
Store zero or more vtkInformation instances.
vtkIntArray * variableIndexToSPX
vtkIntArray * TempI
vtkWedge * AWedge
vtkIntArray * NMax
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:46
#define max(a, b)
represent and manipulate 3D points
Definition: vtkPoints.h:39
int RequestInformationFlag