VTK  9.0.1
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;
152 
153  //
154  // ParaView Variables
155  //
156 
157  char* FileName;
167  int TimeStep;
171  int* TimeSteps;
172  int TimeStepRange[2];
174 
175  //
176  // MFIX Variables
177  //
178 
179  vtkFloatArray** CellDataArray; // Arrays for variables that will
180  // attach to mesh
181  vtkPoints* Points; // Points array for building grid
182  vtkUnstructuredGrid* Mesh; // Unstructured Grid
183  vtkHexahedron* AHexahedron; // Hexahedron type cell
184  vtkWedge* AWedge; // Wedge type cell
185  vtkQuad* AQuad; // Quad type cell
186  vtkIntArray* Flag; // Cell Flag array
187  vtkDoubleArray* Dx; // Cell widths in x axis
188  vtkDoubleArray* Dy; // Cell widths in y axis
189  vtkDoubleArray* Dz; // Cell widths in z axis
190  vtkIntArray* NMax; // Array to hold number of species per phase
191  vtkDoubleArray* C; // Array used to parse restart file
192  vtkIntArray* TempI; // Array used to parse restart file
193  vtkDoubleArray* TempD; // Array used to parse restart file
194  vtkIntArray* SpxFileExists; // Array for keeping track of
195  // what spx files exist.
196 
197  char FileExtension[15];
198  char DataBuffer[513];
199  char Version[120];
205  double Ce;
206  double Cf;
207  double Phi;
208  double PhiW;
209  double DeltaTime;
210  double XMinimum;
211  char RunName[256];
217  int IMaximum;
218  int JMaximum;
219  int KMaximum;
228  int MMAX;
230  double XLength;
231  double YLength;
232  double ZLength;
235  bool BkEpsilon;
236  char CoordinateSystem[17];
237  char Units[17];
238 
239  //
240  // SPX Variables
241  //
242 
243  int MaximumTimestep; // maximum timesteps amongst the variables
244  int SPXRecordsPerTimestep; // number of records in a single
245  // timestep for a variable
246  vtkIntArray* SPXToNVarTable; // number of variables in each spx file
247  vtkIntArray* VariableToSkipTable; // skip value for each variable, this
248  // is needed in spx files
249  // with more than one variable.
250  vtkIntArray* VariableTimesteps; // number of timesteps for each variable
251  vtkIntArray* VariableTimestepTable; // Since the number of timesteps
252  // vary between variables
253  // this is a table that looks
254  // up the appropriate timestep
255  // for the particular variable.
256  vtkIntArray* variableIndexToSPX; // This gives the spx file number for the
257  // particular variable.
258  vtkIntArray* VariableIndexToSPX; // This gives the spx file number for the
259  // particular variable.
260  vtkIntArray* SPXTimestepIndexTable; // This a table look up for the index
261  // into a file for a certain variable.
262 
263 private:
264  vtkMFIXReader(const vtkMFIXReader&) = delete;
265  void operator=(const vtkMFIXReader&) = delete;
266 
267  void MakeMesh(vtkUnstructuredGrid* output);
268  void SwapDouble(double& value);
269  void SwapFloat(float& value);
270  void SwapInt(int& value);
271  vtkStdString ConvertIntToString(int in);
272  int ConvertCharToInt(char in);
273  int ConvertStringToInt(const vtkStdString& in);
274  void GetInt(istream& in, int& val);
275  void GetDouble(istream& in, double& val);
276  void GetFloat(istream& in, float& val);
277  void SkipBytes(istream& in, int n);
278  void RestartVersionNumber(const char* buffer);
279  void GetBlockOfDoubles(istream& in, vtkDoubleArray* v, int n);
280  void GetBlockOfFloats(istream& in, vtkFloatArray* v, int n);
281  void GetBlockOfInts(istream& in, vtkIntArray* v, int n);
282  void ReadRestartFile();
283  void GetVariableAtTimestep(int vari, int tstep, vtkFloatArray* v);
284  void CreateVariableNames();
285  void GetTimeSteps();
286  void MakeTimeStepTable(int nvars);
287  void SetProjectName(const char* infile);
288  void MakeSPXTimeStepIndexTable(int nvars);
289  void CalculateMaxTimeStep();
290  void GetNumberOfVariablesInSPXFiles();
291  void FillVectorVariable(int xindex, int yindex, int zindex, vtkFloatArray* v);
292  void ConvertVectorFromCylindricalToCartesian(int xindex, int zindex);
293  void GetAllTimes(vtkInformationVector* outputVector);
294 };
295 
296 #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