VTK  9.1.0
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 
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 
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 
141 
145  void GetCellDataRange(int cellComp, float* min, float* max);
146 
147 protected:
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 numberOfVariables);
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
Store on/off settings for data arrays for a vtkSource.
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:42
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:40
reads a dataset in MFIX file format
Definition: vtkMFIXReader.h:54
~vtkMFIXReader() override
vtkGetFilePathMacro(FileName)
Specify the file name of the MFIX Restart data file to read.
vtkIntArray * SPXToNVarTable
vtkQuad * AQuad
vtkIntArray * Flag
vtkSetFilePathMacro(FileName)
Specify the file name of the MFIX Restart data file to read.
vtkHexahedron * AHexahedron
int GetNumberOfCellArrays(void)
Get the number of cell arrays available in the input.
void SetCellArrayStatus(const char *name, int status)
Get/Set whether the cell array with the given name is to be read.
int GetCellArrayStatus(const char *name)
Get/Set whether the cell array with the given name is to be read.
vtkUnstructuredGrid * Mesh
int NumberOfReactionRates
vtkIntArray * VariableToSkipTable
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkIntArray * SPXTimestepIndexTable
vtkDoubleArray * TempD
const char * GetCellArrayName(int index)
Get the name of the cell array with the given index in the input.
vtkDoubleArray * Dz
vtkIntArray * VariableTimestepTable
vtkWedge * AWedge
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkDoubleArray * Dx
static vtkMFIXReader * New()
vtkStringArray * VariableNames
vtkIntArray * VariableTimesteps
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataArraySelection * CellDataArraySelection
vtkIntArray * NMax
vtkIntArray * VariableComponents
vtkFloatArray ** CellDataArray
int SPXRecordsPerTimestep
vtkDoubleArray * Dy
vtkIntArray * SpxFileExists
void EnableAllCellArrays()
Turn on/off all cell arrays.
vtkFloatArray * Maximum
vtkIntArray * VectorLength
vtkIntArray * VariableIndexToSPX
int RequestInformationFlag
vtkFloatArray * Minimum
void DisableAllCellArrays()
Turn on/off all cell arrays.
vtkPoints * Points
int NumberOfSPXFilesUsed
vtkDoubleArray * C
vtkIntArray * variableIndexToSPX
vtkIntArray * TempI
void GetCellDataRange(int cellComp, float *min, float *max)
Get the range of cell data.
represent and manipulate 3D points
Definition: vtkPoints.h:34
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:36
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:36
a vtkAbstractArray subclass for strings
Superclass for algorithms that produce only unstructured grid as output.
dataset represents arbitrary combinations of all possible cell types
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:44
Write VTK XML UnstructuredGrid files.
@ value
Definition: vtkX3D.h:226
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
#define max(a, b)