VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMFIXReader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00034 #ifndef __vtkMFIXReader_h 00035 #define __vtkMFIXReader_h 00036 00037 #include "vtkUnstructuredGridAlgorithm.h" 00038 00039 class vtkDataArraySelection; 00040 class vtkDoubleArray; 00041 class vtkStringArray; 00042 class vtkIntArray; 00043 class vtkFloatArray; 00044 class vtkXMLUnstructuredGridWriter; 00045 class vtkWedge; 00046 class vtkQuad; 00047 class vtkHexahedron; 00048 class vtkPoints; 00049 class vtkStdString; 00050 00051 class VTK_IO_EXPORT vtkMFIXReader : public vtkUnstructuredGridAlgorithm 00052 { 00053 public: 00054 static vtkMFIXReader *New(); 00055 vtkTypeMacro(vtkMFIXReader,vtkUnstructuredGridAlgorithm); 00056 void PrintSelf(ostream& os, vtkIndent indent); 00057 00059 00060 vtkSetStringMacro(FileName); 00061 vtkGetStringMacro(FileName); 00063 00065 00067 vtkGetMacro(NumberOfCells,int); 00069 00071 00073 vtkGetMacro(NumberOfPoints,int); 00075 00077 00078 vtkGetMacro(NumberOfCellFields,int); 00080 00082 00083 vtkSetMacro(TimeStep, int); 00084 vtkGetMacro(TimeStep, int); 00086 00088 00089 vtkGetMacro(NumberOfTimeSteps, int); 00091 00093 00094 vtkGetVector2Macro(TimeStepRange, int); 00095 vtkSetVector2Macro(TimeStepRange, int); 00097 00099 int GetNumberOfCellArrays(void); 00100 00102 const char* GetCellArrayName(int index); 00103 00105 00106 int GetCellArrayStatus(const char* name); 00107 void SetCellArrayStatus(const char* name, int status); 00109 00111 00112 void DisableAllCellArrays(); 00113 void EnableAllCellArrays(); 00115 00117 void GetCellDataRange(int cellComp, int index, float *min, float *max); 00118 00119 protected: 00120 vtkMFIXReader(); 00121 ~vtkMFIXReader(); 00122 int RequestInformation(vtkInformation *, 00123 vtkInformationVector **, vtkInformationVector *); 00124 int RequestData(vtkInformation *, 00125 vtkInformationVector **, vtkInformationVector *); 00126 00127 // 00128 // ParaView Variables 00129 // 00130 00131 char *FileName; 00132 int RequestInformationFlag; 00133 int MakeMeshFlag; 00134 int NumberOfPoints; 00135 int NumberOfCells; 00136 int NumberOfCellFields; 00137 vtkIntArray *VectorLength; 00138 vtkFloatArray *Minimum; 00139 vtkFloatArray *Maximum; 00140 vtkDataArraySelection *CellDataArraySelection; 00141 int TimeStep; 00142 int ActualTimeStep; 00143 int CurrentTimeStep; 00144 int NumberOfTimeSteps; 00145 int *TimeSteps; 00146 int TimeStepRange[2]; 00147 int TimeStepWasReadOnce; 00148 00149 // 00150 // MFIX Variables 00151 // 00152 00153 vtkFloatArray **CellDataArray; // Arrays for variables that will 00154 //attach to mesh 00155 vtkPoints *Points; // Points array for building grid 00156 vtkUnstructuredGrid *Mesh; // Unstructured Grid 00157 vtkHexahedron *AHexahedron; // Hexahedron type cell 00158 vtkWedge *AWedge; // Wedge type cell 00159 vtkQuad *AQuad; // Quad type cell 00160 vtkIntArray *Flag; // Cell Flag array 00161 vtkDoubleArray *Dx; // Cell widths in x axis 00162 vtkDoubleArray *Dy; // Cell widths in y axis 00163 vtkDoubleArray *Dz; // Cell widths in z axis 00164 vtkIntArray *NMax; // Array to hold number of species per phase 00165 vtkDoubleArray *C; // Array used to parse restart file 00166 vtkIntArray *TempI; // Array used to parse restart file 00167 vtkDoubleArray *TempD; // Array used to parse restart file 00168 vtkIntArray *SpxFileExists; // Array for keeping track of 00169 // what spx files exist. 00170 00171 char FileExtension[15]; 00172 char DataBuffer[513]; 00173 char Version[120]; 00174 float VersionNumber; 00175 int DimensionIc; 00176 int DimensionBc; 00177 int DimensionC; 00178 int DimensionIs; 00179 double Ce; 00180 double Cf; 00181 double Phi; 00182 double PhiW; 00183 double DeltaTime; 00184 double XMinimum; 00185 char RunName[256]; 00186 vtkStringArray *VariableNames; 00187 vtkIntArray *VariableComponents; 00188 int IMinimum1; 00189 int JMinimum1; 00190 int KMinimum1; 00191 int IMaximum; 00192 int JMaximum; 00193 int KMaximum; 00194 int IMaximum1; 00195 int JMaximum1; 00196 int KMaximum1; 00197 int IMaximum2; 00198 int JMaximum2; 00199 int KMaximum2; 00200 int IJMaximum2; 00201 int IJKMaximum2; 00202 int MMAX; 00203 int NumberOfSPXFilesUsed; 00204 double XLength; 00205 double YLength; 00206 double ZLength; 00207 int NumberOfScalars; 00208 int NumberOfReactionRates; 00209 bool BkEpsilon; 00210 char CoordinateSystem[17]; 00211 char Units[17]; 00212 00213 // 00214 // SPX Variables 00215 // 00216 00217 int MaximumTimestep; // maximum timesteps amongst the variables 00218 int SPXRecordsPerTimestep; // number of records in a single 00219 // timestep for a variable 00220 vtkIntArray *SPXToNVarTable; // number of variables in each spx file 00221 vtkIntArray *VariableToSkipTable; // skip value for each variable, this 00222 // is needed in spx files 00223 // with more than one variable. 00224 vtkIntArray *VariableTimesteps; // number of timesteps for each variable 00225 vtkIntArray *VariableTimestepTable; // Since the number of timesteps 00226 // vary between variables 00227 // this is a table that looks 00228 // up the appropriate timestep 00229 // for the particular variable. 00230 vtkIntArray *variableIndexToSPX; // This gives the spx file number for the 00231 // particular variable. 00232 vtkIntArray *VariableIndexToSPX; // This gives the spx file number for the 00233 // particular variable. 00234 vtkIntArray *SPXTimestepIndexTable; // This a table look up for the index 00235 // into a file for a certain variable. 00236 00237 private: 00238 vtkMFIXReader(const vtkMFIXReader&); // Not implemented. 00239 void operator=(const vtkMFIXReader&); // Not implemented. 00240 00241 void MakeMesh(vtkUnstructuredGrid *output); 00242 void SwapDouble(double &value); 00243 void SwapFloat(float &value); 00244 void SwapInt(int &value); 00245 vtkStdString ConvertIntToString(int in); 00246 int ConvertCharToInt(char in); 00247 int ConvertStringToInt(const vtkStdString & in); 00248 void GetInt(istream& in, int &val); 00249 void GetDouble(istream& in, double& val); 00250 void GetFloat(istream& in, float& val); 00251 void SkipBytes(istream& in, int n); 00252 void RestartVersionNumber(const char* buffer); 00253 void GetBlockOfDoubles(istream& in, vtkDoubleArray *v, int n); 00254 void GetBlockOfFloats(istream& in, vtkFloatArray *v, int n); 00255 void GetBlockOfInts(istream& in, vtkIntArray *v, int n); 00256 void ReadRestartFile(); 00257 void GetVariableAtTimestep(int vari , int tstep, vtkFloatArray *v); 00258 void CreateVariableNames(); 00259 void GetTimeSteps(); 00260 void MakeTimeStepTable(int nvars); 00261 void SetProjectName (const char *infile); 00262 void MakeSPXTimeStepIndexTable(int nvars); 00263 void CalculateMaxTimeStep(); 00264 void GetNumberOfVariablesInSPXFiles(); 00265 void FillVectorVariable( int xindex, int yindex, int zindex, 00266 vtkFloatArray *v); 00267 void ConvertVectorFromCylindricalToCartesian( int xindex, int zindex); 00268 void GetAllTimes(vtkInformationVector *outputVector); 00269 00270 }; 00271 00272 #endif