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 =========================================================================*/
37 #ifndef __vtkMFIXReader_h
38 #define __vtkMFIXReader_h
39 
40 #include "vtkIOGeometryModule.h" // For export macro
42 
44 class vtkDoubleArray;
45 class vtkStringArray;
46 class vtkIntArray;
47 class vtkFloatArray;
49 class vtkWedge;
50 class vtkQuad;
51 class vtkHexahedron;
52 class vtkPoints;
53 class vtkStdString;
54 
56 {
57 public:
58  static vtkMFIXReader *New();
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
63 
64  vtkSetStringMacro(FileName);
65  vtkGetStringMacro(FileName);
67 
69 
71  vtkGetMacro(NumberOfCells,int);
73 
75 
77  vtkGetMacro(NumberOfPoints,int);
79 
81 
82  vtkGetMacro(NumberOfCellFields,int);
84 
86 
87  vtkSetMacro(TimeStep, int);
88  vtkGetMacro(TimeStep, int);
90 
92 
93  vtkGetMacro(NumberOfTimeSteps, int);
95 
97 
98  vtkGetVector2Macro(TimeStepRange, int);
99  vtkSetVector2Macro(TimeStepRange, int);
101 
103  int GetNumberOfCellArrays(void);
104 
106  const char* GetCellArrayName(int index);
107 
109 
110  int GetCellArrayStatus(const char* name);
111  void SetCellArrayStatus(const char* name, int status);
113 
115 
116  void DisableAllCellArrays();
117  void EnableAllCellArrays();
119 
122  VTK_LEGACY(void GetCellDataRange(int cellComp, int index, float *min, float *max));
123 
125  void GetCellDataRange(int cellComp, float *min, float *max);
126 
127 protected:
128  vtkMFIXReader();
129  ~vtkMFIXReader();
134 
135  //
136  // ParaView Variables
137  //
138 
139  char *FileName;
149  int TimeStep;
153  int *TimeSteps;
154  int TimeStepRange[2];
156 
157  //
158  // MFIX Variables
159  //
160 
161  vtkFloatArray **CellDataArray; // Arrays for variables that will
162  //attach to mesh
163  vtkPoints *Points; // Points array for building grid
164  vtkUnstructuredGrid *Mesh; // Unstructured Grid
165  vtkHexahedron *AHexahedron; // Hexahedron type cell
166  vtkWedge *AWedge; // Wedge type cell
167  vtkQuad *AQuad; // Quad type cell
168  vtkIntArray *Flag; // Cell Flag array
169  vtkDoubleArray *Dx; // Cell widths in x axis
170  vtkDoubleArray *Dy; // Cell widths in y axis
171  vtkDoubleArray *Dz; // Cell widths in z axis
172  vtkIntArray *NMax; // Array to hold number of species per phase
173  vtkDoubleArray *C; // Array used to parse restart file
174  vtkIntArray *TempI; // Array used to parse restart file
175  vtkDoubleArray *TempD; // Array used to parse restart file
176  vtkIntArray *SpxFileExists; // Array for keeping track of
177  // what spx files exist.
178 
179  char FileExtension[15];
180  char DataBuffer[513];
181  char Version[120];
187  double Ce;
188  double Cf;
189  double Phi;
190  double PhiW;
191  double DeltaTime;
192  double XMinimum;
193  char RunName[256];
199  int IMaximum;
200  int JMaximum;
201  int KMaximum;
210  int MMAX;
212  double XLength;
213  double YLength;
214  double ZLength;
217  bool BkEpsilon;
218  char CoordinateSystem[17];
219  char Units[17];
220 
221  //
222  // SPX Variables
223  //
224 
225  int MaximumTimestep; // maximum timesteps amongst the variables
226  int SPXRecordsPerTimestep; // number of records in a single
227  // timestep for a variable
228  vtkIntArray *SPXToNVarTable; // number of variables in each spx file
229  vtkIntArray *VariableToSkipTable; // skip value for each variable, this
230  // is needed in spx files
231  // with more than one variable.
232  vtkIntArray *VariableTimesteps; // number of timesteps for each variable
233  vtkIntArray *VariableTimestepTable; // Since the number of timesteps
234  // vary between variables
235  // this is a table that looks
236  // up the appropriate timestep
237  // for the particular variable.
238  vtkIntArray *variableIndexToSPX; // This gives the spx file number for the
239  // particular variable.
240  vtkIntArray *VariableIndexToSPX; // This gives the spx file number for the
241  // particular variable.
242  vtkIntArray *SPXTimestepIndexTable; // This a table look up for the index
243  // into a file for a certain variable.
244 
245 private:
246  vtkMFIXReader(const vtkMFIXReader&); // Not implemented.
247  void operator=(const vtkMFIXReader&); // Not implemented.
248 
249  void MakeMesh(vtkUnstructuredGrid *output);
250  void SwapDouble(double &value);
251  void SwapFloat(float &value);
252  void SwapInt(int &value);
253  vtkStdString ConvertIntToString(int in);
254  int ConvertCharToInt(char in);
255  int ConvertStringToInt(const vtkStdString & in);
256  void GetInt(istream& in, int &val);
257  void GetDouble(istream& in, double& val);
258  void GetFloat(istream& in, float& val);
259  void SkipBytes(istream& in, int n);
260  void RestartVersionNumber(const char* buffer);
261  void GetBlockOfDoubles(istream& in, vtkDoubleArray *v, int n);
262  void GetBlockOfFloats(istream& in, vtkFloatArray *v, int n);
263  void GetBlockOfInts(istream& in, vtkIntArray *v, int n);
264  void ReadRestartFile();
265  void GetVariableAtTimestep(int vari , int tstep, vtkFloatArray *v);
266  void CreateVariableNames();
267  void GetTimeSteps();
268  void MakeTimeStepTable(int nvars);
269  void SetProjectName (const char *infile);
270  void MakeSPXTimeStepIndexTable(int nvars);
271  void CalculateMaxTimeStep();
272  void GetNumberOfVariablesInSPXFiles();
273  void FillVectorVariable( int xindex, int yindex, int zindex,
274  vtkFloatArray *v);
275  void ConvertVectorFromCylindricalToCartesian( int xindex, int zindex);
276  void GetAllTimes(vtkInformationVector *outputVector);
277 
278 };
279 
280 #endif
int NumberOfReactionRates
vtkIntArray * VariableTimesteps
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
vtkIntArray * SPXToNVarTable
int NumberOfSPXFilesUsed
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int SPXRecordsPerTimestep
vtkIntArray * VectorLength
vtkFloatArray * Minimum
const GLdouble * v
Definition: vtkgl.h:11595
vtkIntArray * SpxFileExists
GLuint index
Definition: vtkgl.h:11983
vtkIntArray * VariableComponents
vtkIntArray * VariableIndexToSPX
GLuint buffer
Definition: vtkgl.h:11839
Store vtkAlgorithm input/output information.
vtkDoubleArray * Dy
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
static vtkUnstructuredGridAlgorithm * New()
vtkDataArraySelection * CellDataArraySelection
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
a vtkAbstractArray subclass for strings
vtkQuad * AQuad
GLuint in
Definition: vtkgl.h:16905
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:40
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
vtkFloatArray ** CellDataArray
reads a dataset in MFIX file format
Definition: vtkMFIXReader.h:55
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:94
vtkFloatArray * Maximum
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
vtkPoints * Points
#define VTKIOGEOMETRY_EXPORT
dynamic, self-adjusting array of double
vtkDoubleArray * Dz
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
vtkIntArray * Flag
GLuint const GLchar * name
Definition: vtkgl.h:11983
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkStringArray * VariableNames
vtkIntArray * SPXTimestepIndexTable
Store on/off settings for data arrays for a vtkSource.
dataset represents arbitrary combinations of all possible cell types
void PrintSelf(ostream &os, vtkIndent indent)
vtkDoubleArray * C
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:46
#define vtkGetStringMacro(name)
Definition: vtkSetGet.h:120
Superclass for algorithms that produce only unstructured grid as output.
vtkHexahedron * AHexahedron
vtkIntArray * VariableToSkipTable
vtkUnstructuredGrid * Mesh
#define VTK_LEGACY(method)
Definition: vtkSetGet.h:787
#define vtkGetVector2Macro(name, type)
Definition: vtkSetGet.h:260
vtkDoubleArray * TempD
vtkIntArray * VariableTimestepTable
vtkDoubleArray * Dx
Write VTK XML UnstructuredGrid files.
GLclampd n
Definition: vtkgl.h:14370
Store zero or more vtkInformation instances.
vtkIntArray * variableIndexToSPX
vtkIntArray * TempI
vtkWedge * AWedge
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:244
vtkIntArray * NMax
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:48
#define max(a, b)
represent and manipulate 3D points
Definition: vtkPoints.h:39
GLuint GLfloat * val
Definition: vtkgl.h:13789
int RequestInformationFlag
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69