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) 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() override;
154 
155  //
156  // ParaView Variables
157  //
158 
159  char *FileName;
169  int TimeStep;
173  int *TimeSteps;
174  int TimeStepRange[2];
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];
207  double Ce;
208  double Cf;
209  double Phi;
210  double PhiW;
211  double DeltaTime;
212  double XMinimum;
213  char RunName[256];
219  int IMaximum;
220  int JMaximum;
221  int KMaximum;
230  int MMAX;
232  double XLength;
233  double YLength;
234  double ZLength;
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&) = delete;
267  void operator=(const vtkMFIXReader&) = delete;
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
int NumberOfReactionRates
vtkIntArray * VariableTimesteps
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkIntArray * SPXToNVarTable
int NumberOfSPXFilesUsed
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
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:35
a vtkAbstractArray subclass for strings
vtkQuad * AQuad
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:35
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkFloatArray ** CellDataArray
reads a dataset in MFIX file format
Definition: vtkMFIXReader.h:53
vtkFloatArray * Maximum
vtkPoints * Points
dynamic, self-adjusting array of double
vtkDoubleArray * Dz
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.
vtkIntArray * Flag
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkStringArray * VariableNames
vtkIntArray * SPXTimestepIndexTable
Store on/off settings for data arrays for a vtkSource.
dataset represents arbitrary combinations of all possible cell types
vtkDoubleArray * C
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:41
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:43
#define max(a, b)
represent and manipulate 3D points
Definition: vtkPoints.h:33
int RequestInformationFlag