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 
38 
40 class vtkDoubleArray;
41 class vtkStringArray;
42 class vtkIntArray;
43 class vtkFloatArray;
45 class vtkWedge;
46 class vtkQuad;
47 class vtkHexahedron;
48 class vtkPoints;
49 class vtkStdString;
50 
52 {
53 public:
54  static vtkMFIXReader *New();
56  void PrintSelf(ostream& os, vtkIndent indent);
57 
59 
60  vtkSetStringMacro(FileName);
61  vtkGetStringMacro(FileName);
63 
65 
67  vtkGetMacro(NumberOfCells,int);
69 
71 
73  vtkGetMacro(NumberOfPoints,int);
75 
77 
78  vtkGetMacro(NumberOfCellFields,int);
80 
82 
83  vtkSetMacro(TimeStep, int);
84  vtkGetMacro(TimeStep, int);
86 
88 
89  vtkGetMacro(NumberOfTimeSteps, int);
91 
93 
94  vtkGetVector2Macro(TimeStepRange, int);
95  vtkSetVector2Macro(TimeStepRange, int);
97 
99  int GetNumberOfCellArrays(void);
100 
102  const char* GetCellArrayName(int index);
103 
105 
106  int GetCellArrayStatus(const char* name);
107  void SetCellArrayStatus(const char* name, int status);
109 
111 
112  void DisableAllCellArrays();
113  void EnableAllCellArrays();
115 
117  void GetCellDataRange(int cellComp, int index, float *min, float *max);
118 
119 protected:
120  vtkMFIXReader();
121  ~vtkMFIXReader();
126 
127  //
128  // ParaView Variables
129  //
130 
131  char *FileName;
141  int TimeStep;
145  int *TimeSteps;
146  int TimeStepRange[2];
148 
149  //
150  // MFIX Variables
151  //
152 
153  vtkFloatArray **CellDataArray; // Arrays for variables that will
154  //attach to mesh
155  vtkPoints *Points; // Points array for building grid
156  vtkUnstructuredGrid *Mesh; // Unstructured Grid
157  vtkHexahedron *AHexahedron; // Hexahedron type cell
158  vtkWedge *AWedge; // Wedge type cell
159  vtkQuad *AQuad; // Quad type cell
160  vtkIntArray *Flag; // Cell Flag array
161  vtkDoubleArray *Dx; // Cell widths in x axis
162  vtkDoubleArray *Dy; // Cell widths in y axis
163  vtkDoubleArray *Dz; // Cell widths in z axis
164  vtkIntArray *NMax; // Array to hold number of species per phase
165  vtkDoubleArray *C; // Array used to parse restart file
166  vtkIntArray *TempI; // Array used to parse restart file
167  vtkDoubleArray *TempD; // Array used to parse restart file
168  vtkIntArray *SpxFileExists; // Array for keeping track of
169  // what spx files exist.
170 
171  char FileExtension[15];
172  char DataBuffer[513];
173  char Version[120];
179  double Ce;
180  double Cf;
181  double Phi;
182  double PhiW;
183  double DeltaTime;
184  double XMinimum;
185  char RunName[256];
191  int IMaximum;
192  int JMaximum;
193  int KMaximum;
202  int MMAX;
204  double XLength;
205  double YLength;
206  double ZLength;
209  bool BkEpsilon;
210  char CoordinateSystem[17];
211  char Units[17];
212 
213  //
214  // SPX Variables
215  //
216 
217  int MaximumTimestep; // maximum timesteps amongst the variables
218  int SPXRecordsPerTimestep; // number of records in a single
219  // timestep for a variable
220  vtkIntArray *SPXToNVarTable; // number of variables in each spx file
221  vtkIntArray *VariableToSkipTable; // skip value for each variable, this
222  // is needed in spx files
223  // with more than one variable.
224  vtkIntArray *VariableTimesteps; // number of timesteps for each variable
225  vtkIntArray *VariableTimestepTable; // Since the number of timesteps
226  // vary between variables
227  // this is a table that looks
228  // up the appropriate timestep
229  // for the particular variable.
230  vtkIntArray *variableIndexToSPX; // This gives the spx file number for the
231  // particular variable.
232  vtkIntArray *VariableIndexToSPX; // This gives the spx file number for the
233  // particular variable.
234  vtkIntArray *SPXTimestepIndexTable; // This a table look up for the index
235  // into a file for a certain variable.
236 
237 private:
238  vtkMFIXReader(const vtkMFIXReader&); // Not implemented.
239  void operator=(const vtkMFIXReader&); // Not implemented.
240 
241  void MakeMesh(vtkUnstructuredGrid *output);
242  void SwapDouble(double &value);
243  void SwapFloat(float &value);
244  void SwapInt(int &value);
245  vtkStdString ConvertIntToString(int in);
246  int ConvertCharToInt(char in);
247  int ConvertStringToInt(const vtkStdString & in);
248  void GetInt(istream& in, int &val);
249  void GetDouble(istream& in, double& val);
250  void GetFloat(istream& in, float& val);
251  void SkipBytes(istream& in, int n);
252  void RestartVersionNumber(const char* buffer);
253  void GetBlockOfDoubles(istream& in, vtkDoubleArray *v, int n);
254  void GetBlockOfFloats(istream& in, vtkFloatArray *v, int n);
255  void GetBlockOfInts(istream& in, vtkIntArray *v, int n);
256  void ReadRestartFile();
257  void GetVariableAtTimestep(int vari , int tstep, vtkFloatArray *v);
258  void CreateVariableNames();
259  void GetTimeSteps();
260  void MakeTimeStepTable(int nvars);
261  void SetProjectName (const char *infile);
262  void MakeSPXTimeStepIndexTable(int nvars);
263  void CalculateMaxTimeStep();
264  void GetNumberOfVariablesInSPXFiles();
265  void FillVectorVariable( int xindex, int yindex, int zindex,
266  vtkFloatArray *v);
267  void ConvertVectorFromCylindricalToCartesian( int xindex, int zindex);
268  void GetAllTimes(vtkInformationVector *outputVector);
269 
270 };
271 
272 #endif
int NumberOfReactionRates
vtkIntArray * VariableTimesteps
Wrapper around vtkstd::string to keep symbols short.
Definition: vtkStdString.h:45
vtkIntArray * SPXToNVarTable
int NumberOfSPXFilesUsed
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
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:42
a vtkAbstractArray subclass for strings
vtkQuad * AQuad
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:39
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkFloatArray ** CellDataArray
reads a dataset in MFIX file format
Definition: vtkMFIXReader.h:51
vtkFloatArray * Maximum
vtkPoints * Points
dynamic, self-adjusting array of double
vtkDoubleArray * Dz
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:42
vtkIntArray * Flag
a simple class to control print indentation
Definition: vtkIndent.h:37
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:45
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.
#define VTK_IO_EXPORT
vtkIntArray * variableIndexToSPX
vtkIntArray * TempI
vtkWedge * AWedge
vtkIntArray * NMax
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:47
#define max(a, b)
represent and manipulate 3D points
Definition: vtkPoints.h:38
int RequestInformationFlag