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 
121  void GetCellDataRange(int cellComp, float *min, float *max);
122 
123 protected:
124  vtkMFIXReader();
125  ~vtkMFIXReader();
130 
131  //
132  // ParaView Variables
133  //
134 
135  char *FileName;
145  int TimeStep;
149  int *TimeSteps;
150  int TimeStepRange[2];
152 
153  //
154  // MFIX Variables
155  //
156 
157  vtkFloatArray **CellDataArray; // Arrays for variables that will
158  //attach to mesh
159  vtkPoints *Points; // Points array for building grid
160  vtkUnstructuredGrid *Mesh; // Unstructured Grid
161  vtkHexahedron *AHexahedron; // Hexahedron type cell
162  vtkWedge *AWedge; // Wedge type cell
163  vtkQuad *AQuad; // Quad type cell
164  vtkIntArray *Flag; // Cell Flag array
165  vtkDoubleArray *Dx; // Cell widths in x axis
166  vtkDoubleArray *Dy; // Cell widths in y axis
167  vtkDoubleArray *Dz; // Cell widths in z axis
168  vtkIntArray *NMax; // Array to hold number of species per phase
169  vtkDoubleArray *C; // Array used to parse restart file
170  vtkIntArray *TempI; // Array used to parse restart file
171  vtkDoubleArray *TempD; // Array used to parse restart file
172  vtkIntArray *SpxFileExists; // Array for keeping track of
173  // what spx files exist.
174 
175  char FileExtension[15];
176  char DataBuffer[513];
177  char Version[120];
183  double Ce;
184  double Cf;
185  double Phi;
186  double PhiW;
187  double DeltaTime;
188  double XMinimum;
189  char RunName[256];
195  int IMaximum;
196  int JMaximum;
197  int KMaximum;
206  int MMAX;
208  double XLength;
209  double YLength;
210  double ZLength;
213  bool BkEpsilon;
214  char CoordinateSystem[17];
215  char Units[17];
216 
217  //
218  // SPX Variables
219  //
220 
221  int MaximumTimestep; // maximum timesteps amongst the variables
222  int SPXRecordsPerTimestep; // number of records in a single
223  // timestep for a variable
224  vtkIntArray *SPXToNVarTable; // number of variables in each spx file
225  vtkIntArray *VariableToSkipTable; // skip value for each variable, this
226  // is needed in spx files
227  // with more than one variable.
228  vtkIntArray *VariableTimesteps; // number of timesteps for each variable
229  vtkIntArray *VariableTimestepTable; // Since the number of timesteps
230  // vary between variables
231  // this is a table that looks
232  // up the appropriate timestep
233  // for the particular variable.
234  vtkIntArray *variableIndexToSPX; // This gives the spx file number for the
235  // particular variable.
236  vtkIntArray *VariableIndexToSPX; // This gives the spx file number for the
237  // particular variable.
238  vtkIntArray *SPXTimestepIndexTable; // This a table look up for the index
239  // into a file for a certain variable.
240 
241 private:
242  vtkMFIXReader(const vtkMFIXReader&); // Not implemented.
243  void operator=(const vtkMFIXReader&); // Not implemented.
244 
245  void MakeMesh(vtkUnstructuredGrid *output);
246  void SwapDouble(double &value);
247  void SwapFloat(float &value);
248  void SwapInt(int &value);
249  vtkStdString ConvertIntToString(int in);
250  int ConvertCharToInt(char in);
251  int ConvertStringToInt(const vtkStdString & in);
252  void GetInt(istream& in, int &val);
253  void GetDouble(istream& in, double& val);
254  void GetFloat(istream& in, float& val);
255  void SkipBytes(istream& in, int n);
256  void RestartVersionNumber(const char* buffer);
257  void GetBlockOfDoubles(istream& in, vtkDoubleArray *v, int n);
258  void GetBlockOfFloats(istream& in, vtkFloatArray *v, int n);
259  void GetBlockOfInts(istream& in, vtkIntArray *v, int n);
260  void ReadRestartFile();
261  void GetVariableAtTimestep(int vari , int tstep, vtkFloatArray *v);
262  void CreateVariableNames();
263  void GetTimeSteps();
264  void MakeTimeStepTable(int nvars);
265  void SetProjectName (const char *infile);
266  void MakeSPXTimeStepIndexTable(int nvars);
267  void CalculateMaxTimeStep();
268  void GetNumberOfVariablesInSPXFiles();
269  void FillVectorVariable( int xindex, int yindex, int zindex,
270  vtkFloatArray *v);
271  void ConvertVectorFromCylindricalToCartesian( int xindex, int zindex);
272  void GetAllTimes(vtkInformationVector *outputVector);
273 
274 };
275 
276 #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
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:45
a vtkAbstractArray subclass for strings
vtkQuad * AQuad
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:40
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkFloatArray ** CellDataArray
reads a dataset in MFIX file format
Definition: vtkMFIXReader.h:55
vtkFloatArray * Maximum
vtkPoints * Points
#define VTKIOGEOMETRY_EXPORT
dynamic, self-adjusting array of double
vtkDoubleArray * Dz
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
vtkIntArray * Flag
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
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:48
#define max(a, b)
represent and manipulate 3D points
Definition: vtkPoints.h:38
int RequestInformationFlag