VTK
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  vtkSetStringMacro(FileName);
68  vtkGetStringMacro(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;
157 
158  //
159  // ParaView Variables
160  //
161 
162  char *FileName;
172  int TimeStep;
176  int *TimeSteps;
177  int TimeStepRange[2];
179 
180  //
181  // MFIX Variables
182  //
183 
184  vtkFloatArray **CellDataArray; // Arrays for variables that will
185  //attach to mesh
186  vtkPoints *Points; // Points array for building grid
187  vtkUnstructuredGrid *Mesh; // Unstructured Grid
188  vtkHexahedron *AHexahedron; // Hexahedron type cell
189  vtkWedge *AWedge; // Wedge type cell
190  vtkQuad *AQuad; // Quad type cell
191  vtkIntArray *Flag; // Cell Flag array
192  vtkDoubleArray *Dx; // Cell widths in x axis
193  vtkDoubleArray *Dy; // Cell widths in y axis
194  vtkDoubleArray *Dz; // Cell widths in z axis
195  vtkIntArray *NMax; // Array to hold number of species per phase
196  vtkDoubleArray *C; // Array used to parse restart file
197  vtkIntArray *TempI; // Array used to parse restart file
198  vtkDoubleArray *TempD; // Array used to parse restart file
199  vtkIntArray *SpxFileExists; // Array for keeping track of
200  // what spx files exist.
201 
202  char FileExtension[15];
203  char DataBuffer[513];
204  char Version[120];
210  double Ce;
211  double Cf;
212  double Phi;
213  double PhiW;
214  double DeltaTime;
215  double XMinimum;
216  char RunName[256];
222  int IMaximum;
223  int JMaximum;
224  int KMaximum;
233  int MMAX;
235  double XLength;
236  double YLength;
237  double ZLength;
240  bool BkEpsilon;
241  char CoordinateSystem[17];
242  char Units[17];
243 
244  //
245  // SPX Variables
246  //
247 
248  int MaximumTimestep; // maximum timesteps amongst the variables
249  int SPXRecordsPerTimestep; // number of records in a single
250  // timestep for a variable
251  vtkIntArray *SPXToNVarTable; // number of variables in each spx file
252  vtkIntArray *VariableToSkipTable; // skip value for each variable, this
253  // is needed in spx files
254  // with more than one variable.
255  vtkIntArray *VariableTimesteps; // number of timesteps for each variable
256  vtkIntArray *VariableTimestepTable; // Since the number of timesteps
257  // vary between variables
258  // this is a table that looks
259  // up the appropriate timestep
260  // for the particular variable.
261  vtkIntArray *variableIndexToSPX; // This gives the spx file number for the
262  // particular variable.
263  vtkIntArray *VariableIndexToSPX; // This gives the spx file number for the
264  // particular variable.
265  vtkIntArray *SPXTimestepIndexTable; // This a table look up for the index
266  // into a file for a certain variable.
267 
268 private:
269  vtkMFIXReader(const vtkMFIXReader&) = delete;
270  void operator=(const vtkMFIXReader&) = delete;
271 
272  void MakeMesh(vtkUnstructuredGrid *output);
273  void SwapDouble(double &value);
274  void SwapFloat(float &value);
275  void SwapInt(int &value);
276  vtkStdString ConvertIntToString(int in);
277  int ConvertCharToInt(char in);
278  int ConvertStringToInt(const vtkStdString & in);
279  void GetInt(istream& in, int &val);
280  void GetDouble(istream& in, double& val);
281  void GetFloat(istream& in, float& val);
282  void SkipBytes(istream& in, int n);
283  void RestartVersionNumber(const char* buffer);
284  void GetBlockOfDoubles(istream& in, vtkDoubleArray *v, int n);
285  void GetBlockOfFloats(istream& in, vtkFloatArray *v, int n);
286  void GetBlockOfInts(istream& in, vtkIntArray *v, int n);
287  void ReadRestartFile();
288  void GetVariableAtTimestep(int vari , int tstep, vtkFloatArray *v);
289  void CreateVariableNames();
290  void GetTimeSteps();
291  void MakeTimeStepTable(int nvars);
292  void SetProjectName (const char *infile);
293  void MakeSPXTimeStepIndexTable(int nvars);
294  void CalculateMaxTimeStep();
295  void GetNumberOfVariablesInSPXFiles();
296  void FillVectorVariable( int xindex, int yindex, int zindex,
297  vtkFloatArray *v);
298  void ConvertVectorFromCylindricalToCartesian( int xindex, int zindex);
299  void GetAllTimes(vtkInformationVector *outputVector);
300 
301 };
302 
303 #endif
int NumberOfReactionRates
vtkIntArray * VariableTimesteps
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
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:41
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 for a vtkSource.
dataset represents arbitrary combinations of all possible cell types
vtkDoubleArray * C
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:47
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:49
#define max(a, b)
represent and manipulate 3D points
Definition: vtkPoints.h:39
int RequestInformationFlag