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 =========================================================================*/
35 #ifndef vtkMFIXReader_h
36 #define vtkMFIXReader_h
37 
38 #include "vtkIOGeometryModule.h" // For export macro
40 
42 class vtkDoubleArray;
43 class vtkStringArray;
44 class vtkIntArray;
45 class vtkFloatArray;
47 class vtkWedge;
48 class vtkQuad;
49 class vtkHexahedron;
50 class vtkPoints;
51 class vtkStdString;
52 
53 class VTKIOGEOMETRY_EXPORT vtkMFIXReader : public vtkUnstructuredGridAlgorithm
54 {
55 public:
56  static vtkMFIXReader *New();
58  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
59 
61 
64  vtkSetStringMacro(FileName);
65  vtkGetStringMacro(FileName);
67 
69 
73  vtkGetMacro(NumberOfCells,int);
75 
77 
81  vtkGetMacro(NumberOfPoints,int);
83 
85 
88  vtkGetMacro(NumberOfCellFields,int);
90 
92 
95  vtkSetMacro(TimeStep, int);
96  vtkGetMacro(TimeStep, int);
98 
100 
103  vtkGetMacro(NumberOfTimeSteps, int);
105 
107 
110  vtkGetVector2Macro(TimeStepRange, int);
111  vtkSetVector2Macro(TimeStepRange, int);
113 
117  int GetNumberOfCellArrays(void);
118 
123  const char* GetCellArrayName(int index);
124 
126 
130  int GetCellArrayStatus(const char* name);
131  void SetCellArrayStatus(const char* name, int status);
133 
135 
138  void DisableAllCellArrays();
139  void EnableAllCellArrays();
141 
145  void GetCellDataRange(int cellComp, float *min, float *max);
146 
147 protected:
148  vtkMFIXReader();
149  ~vtkMFIXReader() VTK_OVERRIDE;
150  int RequestInformation(vtkInformation *,
151  vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
152  int RequestData(vtkInformation *,
153  vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
154 
155  //
156  // ParaView Variables
157  //
158 
159  char *FileName;
160  int RequestInformationFlag;
161  int MakeMeshFlag;
162  int NumberOfPoints;
163  int NumberOfCells;
164  int NumberOfCellFields;
165  vtkIntArray *VectorLength;
166  vtkFloatArray *Minimum;
167  vtkFloatArray *Maximum;
168  vtkDataArraySelection *CellDataArraySelection;
169  int TimeStep;
170  int ActualTimeStep;
171  int CurrentTimeStep;
172  int NumberOfTimeSteps;
173  int *TimeSteps;
174  int TimeStepRange[2];
175  int TimeStepWasReadOnce;
176 
177  //
178  // MFIX Variables
179  //
180 
181  vtkFloatArray **CellDataArray; // Arrays for variables that will
182  //attach to mesh
183  vtkPoints *Points; // Points array for building grid
184  vtkUnstructuredGrid *Mesh; // Unstructured Grid
185  vtkHexahedron *AHexahedron; // Hexahedron type cell
186  vtkWedge *AWedge; // Wedge type cell
187  vtkQuad *AQuad; // Quad type cell
188  vtkIntArray *Flag; // Cell Flag array
189  vtkDoubleArray *Dx; // Cell widths in x axis
190  vtkDoubleArray *Dy; // Cell widths in y axis
191  vtkDoubleArray *Dz; // Cell widths in z axis
192  vtkIntArray *NMax; // Array to hold number of species per phase
193  vtkDoubleArray *C; // Array used to parse restart file
194  vtkIntArray *TempI; // Array used to parse restart file
195  vtkDoubleArray *TempD; // Array used to parse restart file
196  vtkIntArray *SpxFileExists; // Array for keeping track of
197  // what spx files exist.
198 
199  char FileExtension[15];
200  char DataBuffer[513];
201  char Version[120];
202  float VersionNumber;
203  int DimensionIc;
204  int DimensionBc;
205  int DimensionC;
206  int DimensionIs;
207  double Ce;
208  double Cf;
209  double Phi;
210  double PhiW;
211  double DeltaTime;
212  double XMinimum;
213  char RunName[256];
214  vtkStringArray *VariableNames;
215  vtkIntArray *VariableComponents;
216  int IMinimum1;
217  int JMinimum1;
218  int KMinimum1;
219  int IMaximum;
220  int JMaximum;
221  int KMaximum;
222  int IMaximum1;
223  int JMaximum1;
224  int KMaximum1;
225  int IMaximum2;
226  int JMaximum2;
227  int KMaximum2;
228  int IJMaximum2;
229  int IJKMaximum2;
230  int MMAX;
231  int NumberOfSPXFilesUsed;
232  double XLength;
233  double YLength;
234  double ZLength;
235  int NumberOfScalars;
236  int NumberOfReactionRates;
237  bool BkEpsilon;
238  char CoordinateSystem[17];
239  char Units[17];
240 
241  //
242  // SPX Variables
243  //
244 
245  int MaximumTimestep; // maximum timesteps amongst the variables
246  int SPXRecordsPerTimestep; // number of records in a single
247  // timestep for a variable
248  vtkIntArray *SPXToNVarTable; // number of variables in each spx file
249  vtkIntArray *VariableToSkipTable; // skip value for each variable, this
250  // is needed in spx files
251  // with more than one variable.
252  vtkIntArray *VariableTimesteps; // number of timesteps for each variable
253  vtkIntArray *VariableTimestepTable; // Since the number of timesteps
254  // vary between variables
255  // this is a table that looks
256  // up the appropriate timestep
257  // for the particular variable.
258  vtkIntArray *variableIndexToSPX; // This gives the spx file number for the
259  // particular variable.
260  vtkIntArray *VariableIndexToSPX; // This gives the spx file number for the
261  // particular variable.
262  vtkIntArray *SPXTimestepIndexTable; // This a table look up for the index
263  // into a file for a certain variable.
264 
265 private:
266  vtkMFIXReader(const vtkMFIXReader&) VTK_DELETE_FUNCTION;
267  void operator=(const vtkMFIXReader&) VTK_DELETE_FUNCTION;
268 
269  void MakeMesh(vtkUnstructuredGrid *output);
270  void SwapDouble(double &value);
271  void SwapFloat(float &value);
272  void SwapInt(int &value);
273  vtkStdString ConvertIntToString(int in);
274  int ConvertCharToInt(char in);
275  int ConvertStringToInt(const vtkStdString & in);
276  void GetInt(istream& in, int &val);
277  void GetDouble(istream& in, double& val);
278  void GetFloat(istream& in, float& val);
279  void SkipBytes(istream& in, int n);
280  void RestartVersionNumber(const char* buffer);
281  void GetBlockOfDoubles(istream& in, vtkDoubleArray *v, int n);
282  void GetBlockOfFloats(istream& in, vtkFloatArray *v, int n);
283  void GetBlockOfInts(istream& in, vtkIntArray *v, int n);
284  void ReadRestartFile();
285  void GetVariableAtTimestep(int vari , int tstep, vtkFloatArray *v);
286  void CreateVariableNames();
287  void GetTimeSteps();
288  void MakeTimeStepTable(int nvars);
289  void SetProjectName (const char *infile);
290  void MakeSPXTimeStepIndexTable(int nvars);
291  void CalculateMaxTimeStep();
292  void GetNumberOfVariablesInSPXFiles();
293  void FillVectorVariable( int xindex, int yindex, int zindex,
294  vtkFloatArray *v);
295  void ConvertVectorFromCylindricalToCartesian( int xindex, int zindex);
296  void GetAllTimes(vtkInformationVector *outputVector);
297 
298 };
299 
300 #endif
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
Store vtkAlgorithm input/output information.
static vtkUnstructuredGridAlgorithm * New()
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
a vtkAbstractArray subclass for strings
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:35
reads a dataset in MFIX file format
Definition: vtkMFIXReader.h:53
dynamic, self-adjusting array of double
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:33
Store on/off settings for data arrays for a vtkSource.
dataset represents arbitrary combinations of all possible cell types
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:41
Superclass for algorithms that produce only unstructured grid as output.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Write VTK XML UnstructuredGrid files.
Store zero or more vtkInformation instances.
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:43
#define max(a, b)
represent and manipulate 3D points
Definition: vtkPoints.h:33