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 =========================================================================*/
34 #ifndef __vtkMFIXReader_h
35 #define __vtkMFIXReader_h
36 
37 #include "vtkIOGeometryModule.h" // For export macro
39 
41 class vtkDoubleArray;
42 class vtkStringArray;
43 class vtkIntArray;
44 class vtkFloatArray;
46 class vtkWedge;
47 class vtkQuad;
48 class vtkHexahedron;
49 class vtkPoints;
50 class vtkStdString;
51 
52 class VTKIOGEOMETRY_EXPORT vtkMFIXReader : public vtkUnstructuredGridAlgorithm
53 {
54 public:
55  static vtkMFIXReader *New();
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
60 
61  vtkSetStringMacro(FileName);
62  vtkGetStringMacro(FileName);
64 
66 
68  vtkGetMacro(NumberOfCells,int);
70 
72 
74  vtkGetMacro(NumberOfPoints,int);
76 
78 
79  vtkGetMacro(NumberOfCellFields,int);
81 
83 
84  vtkSetMacro(TimeStep, int);
85  vtkGetMacro(TimeStep, int);
87 
89 
90  vtkGetMacro(NumberOfTimeSteps, int);
92 
94 
95  vtkGetVector2Macro(TimeStepRange, int);
96  vtkSetVector2Macro(TimeStepRange, int);
98 
100  int GetNumberOfCellArrays(void);
101 
103  const char* GetCellArrayName(int index);
104 
106 
107  int GetCellArrayStatus(const char* name);
108  void SetCellArrayStatus(const char* name, int status);
110 
112 
113  void DisableAllCellArrays();
114  void EnableAllCellArrays();
116 
118  void GetCellDataRange(int cellComp, int index, float *min, float *max);
119 
120 protected:
121  vtkMFIXReader();
122  ~vtkMFIXReader();
127 
128  //
129  // ParaView Variables
130  //
131 
132  char *FileName;
142  int TimeStep;
146  int *TimeSteps;
147  int TimeStepRange[2];
149 
150  //
151  // MFIX Variables
152  //
153 
154  vtkFloatArray **CellDataArray; // Arrays for variables that will
155  //attach to mesh
156  vtkPoints *Points; // Points array for building grid
157  vtkUnstructuredGrid *Mesh; // Unstructured Grid
158  vtkHexahedron *AHexahedron; // Hexahedron type cell
159  vtkWedge *AWedge; // Wedge type cell
160  vtkQuad *AQuad; // Quad type cell
161  vtkIntArray *Flag; // Cell Flag array
162  vtkDoubleArray *Dx; // Cell widths in x axis
163  vtkDoubleArray *Dy; // Cell widths in y axis
164  vtkDoubleArray *Dz; // Cell widths in z axis
165  vtkIntArray *NMax; // Array to hold number of species per phase
166  vtkDoubleArray *C; // Array used to parse restart file
167  vtkIntArray *TempI; // Array used to parse restart file
168  vtkDoubleArray *TempD; // Array used to parse restart file
169  vtkIntArray *SpxFileExists; // Array for keeping track of
170  // what spx files exist.
171 
172  char FileExtension[15];
173  char DataBuffer[513];
174  char Version[120];
180  double Ce;
181  double Cf;
182  double Phi;
183  double PhiW;
184  double DeltaTime;
185  double XMinimum;
186  char RunName[256];
192  int IMaximum;
193  int JMaximum;
194  int KMaximum;
203  int MMAX;
205  double XLength;
206  double YLength;
207  double ZLength;
210  bool BkEpsilon;
211  char CoordinateSystem[17];
212  char Units[17];
213 
214  //
215  // SPX Variables
216  //
217 
218  int MaximumTimestep; // maximum timesteps amongst the variables
219  int SPXRecordsPerTimestep; // number of records in a single
220  // timestep for a variable
221  vtkIntArray *SPXToNVarTable; // number of variables in each spx file
222  vtkIntArray *VariableToSkipTable; // skip value for each variable, this
223  // is needed in spx files
224  // with more than one variable.
225  vtkIntArray *VariableTimesteps; // number of timesteps for each variable
226  vtkIntArray *VariableTimestepTable; // Since the number of timesteps
227  // vary between variables
228  // this is a table that looks
229  // up the appropriate timestep
230  // for the particular variable.
231  vtkIntArray *variableIndexToSPX; // This gives the spx file number for the
232  // particular variable.
233  vtkIntArray *VariableIndexToSPX; // This gives the spx file number for the
234  // particular variable.
235  vtkIntArray *SPXTimestepIndexTable; // This a table look up for the index
236  // into a file for a certain variable.
237 
238 private:
239  vtkMFIXReader(const vtkMFIXReader&); // Not implemented.
240  void operator=(const vtkMFIXReader&); // Not implemented.
241 
242  void MakeMesh(vtkUnstructuredGrid *output);
243  void SwapDouble(double &value);
244  void SwapFloat(float &value);
245  void SwapInt(int &value);
246  vtkStdString ConvertIntToString(int in);
247  int ConvertCharToInt(char in);
248  int ConvertStringToInt(const vtkStdString & in);
249  void GetInt(istream& in, int &val);
250  void GetDouble(istream& in, double& val);
251  void GetFloat(istream& in, float& val);
252  void SkipBytes(istream& in, int n);
253  void RestartVersionNumber(const char* buffer);
254  void GetBlockOfDoubles(istream& in, vtkDoubleArray *v, int n);
255  void GetBlockOfFloats(istream& in, vtkFloatArray *v, int n);
256  void GetBlockOfInts(istream& in, vtkIntArray *v, int n);
257  void ReadRestartFile();
258  void GetVariableAtTimestep(int vari , int tstep, vtkFloatArray *v);
259  void CreateVariableNames();
260  void GetTimeSteps();
261  void MakeTimeStepTable(int nvars);
262  void SetProjectName (const char *infile);
263  void MakeSPXTimeStepIndexTable(int nvars);
264  void CalculateMaxTimeStep();
265  void GetNumberOfVariablesInSPXFiles();
266  void FillVectorVariable( int xindex, int yindex, int zindex,
267  vtkFloatArray *v);
268  void ConvertVectorFromCylindricalToCartesian( int xindex, int zindex);
269  void GetAllTimes(vtkInformationVector *outputVector);
270 
271 };
272 
273 #endif