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 "vtkIOGeometryModule.h" // For export macro 00038 #include "vtkUnstructuredGridAlgorithm.h" 00039 00040 class vtkDataArraySelection; 00041 class vtkDoubleArray; 00042 class vtkStringArray; 00043 class vtkIntArray; 00044 class vtkFloatArray; 00045 class vtkXMLUnstructuredGridWriter; 00046 class vtkWedge; 00047 class vtkQuad; 00048 class vtkHexahedron; 00049 class vtkPoints; 00050 class vtkStdString; 00051 00052 class VTKIOGEOMETRY_EXPORT vtkMFIXReader : public vtkUnstructuredGridAlgorithm 00053 { 00054 public: 00055 static vtkMFIXReader *New(); 00056 vtkTypeMacro(vtkMFIXReader,vtkUnstructuredGridAlgorithm); 00057 void PrintSelf(ostream& os, vtkIndent indent); 00058 00060 00061 vtkSetStringMacro(FileName); 00062 vtkGetStringMacro(FileName); 00064 00066 00068 vtkGetMacro(NumberOfCells,int); 00070 00072 00074 vtkGetMacro(NumberOfPoints,int); 00076 00078 00079 vtkGetMacro(NumberOfCellFields,int); 00081 00083 00084 vtkSetMacro(TimeStep, int); 00085 vtkGetMacro(TimeStep, int); 00087 00089 00090 vtkGetMacro(NumberOfTimeSteps, int); 00092 00094 00095 vtkGetVector2Macro(TimeStepRange, int); 00096 vtkSetVector2Macro(TimeStepRange, int); 00098 00100 int GetNumberOfCellArrays(void); 00101 00103 const char* GetCellArrayName(int index); 00104 00106 00107 int GetCellArrayStatus(const char* name); 00108 void SetCellArrayStatus(const char* name, int status); 00110 00112 00113 void DisableAllCellArrays(); 00114 void EnableAllCellArrays(); 00116 00119 VTK_LEGACY(void GetCellDataRange(int cellComp, int index, float *min, float *max)); 00120 00122 void GetCellDataRange(int cellComp, float *min, float *max); 00123 00124 protected: 00125 vtkMFIXReader(); 00126 ~vtkMFIXReader(); 00127 int RequestInformation(vtkInformation *, 00128 vtkInformationVector **, vtkInformationVector *); 00129 int RequestData(vtkInformation *, 00130 vtkInformationVector **, vtkInformationVector *); 00131 00132 // 00133 // ParaView Variables 00134 // 00135 00136 char *FileName; 00137 int RequestInformationFlag; 00138 int MakeMeshFlag; 00139 int NumberOfPoints; 00140 int NumberOfCells; 00141 int NumberOfCellFields; 00142 vtkIntArray *VectorLength; 00143 vtkFloatArray *Minimum; 00144 vtkFloatArray *Maximum; 00145 vtkDataArraySelection *CellDataArraySelection; 00146 int TimeStep; 00147 int ActualTimeStep; 00148 int CurrentTimeStep; 00149 int NumberOfTimeSteps; 00150 int *TimeSteps; 00151 int TimeStepRange[2]; 00152 int TimeStepWasReadOnce; 00153 00154 // 00155 // MFIX Variables 00156 // 00157 00158 vtkFloatArray **CellDataArray; // Arrays for variables that will 00159 //attach to mesh 00160 vtkPoints *Points; // Points array for building grid 00161 vtkUnstructuredGrid *Mesh; // Unstructured Grid 00162 vtkHexahedron *AHexahedron; // Hexahedron type cell 00163 vtkWedge *AWedge; // Wedge type cell 00164 vtkQuad *AQuad; // Quad type cell 00165 vtkIntArray *Flag; // Cell Flag array 00166 vtkDoubleArray *Dx; // Cell widths in x axis 00167 vtkDoubleArray *Dy; // Cell widths in y axis 00168 vtkDoubleArray *Dz; // Cell widths in z axis 00169 vtkIntArray *NMax; // Array to hold number of species per phase 00170 vtkDoubleArray *C; // Array used to parse restart file 00171 vtkIntArray *TempI; // Array used to parse restart file 00172 vtkDoubleArray *TempD; // Array used to parse restart file 00173 vtkIntArray *SpxFileExists; // Array for keeping track of 00174 // what spx files exist. 00175 00176 char FileExtension[15]; 00177 char DataBuffer[513]; 00178 char Version[120]; 00179 float VersionNumber; 00180 int DimensionIc; 00181 int DimensionBc; 00182 int DimensionC; 00183 int DimensionIs; 00184 double Ce; 00185 double Cf; 00186 double Phi; 00187 double PhiW; 00188 double DeltaTime; 00189 double XMinimum; 00190 char RunName[256]; 00191 vtkStringArray *VariableNames; 00192 vtkIntArray *VariableComponents; 00193 int IMinimum1; 00194 int JMinimum1; 00195 int KMinimum1; 00196 int IMaximum; 00197 int JMaximum; 00198 int KMaximum; 00199 int IMaximum1; 00200 int JMaximum1; 00201 int KMaximum1; 00202 int IMaximum2; 00203 int JMaximum2; 00204 int KMaximum2; 00205 int IJMaximum2; 00206 int IJKMaximum2; 00207 int MMAX; 00208 int NumberOfSPXFilesUsed; 00209 double XLength; 00210 double YLength; 00211 double ZLength; 00212 int NumberOfScalars; 00213 int NumberOfReactionRates; 00214 bool BkEpsilon; 00215 char CoordinateSystem[17]; 00216 char Units[17]; 00217 00218 // 00219 // SPX Variables 00220 // 00221 00222 int MaximumTimestep; // maximum timesteps amongst the variables 00223 int SPXRecordsPerTimestep; // number of records in a single 00224 // timestep for a variable 00225 vtkIntArray *SPXToNVarTable; // number of variables in each spx file 00226 vtkIntArray *VariableToSkipTable; // skip value for each variable, this 00227 // is needed in spx files 00228 // with more than one variable. 00229 vtkIntArray *VariableTimesteps; // number of timesteps for each variable 00230 vtkIntArray *VariableTimestepTable; // Since the number of timesteps 00231 // vary between variables 00232 // this is a table that looks 00233 // up the appropriate timestep 00234 // for the particular variable. 00235 vtkIntArray *variableIndexToSPX; // This gives the spx file number for the 00236 // particular variable. 00237 vtkIntArray *VariableIndexToSPX; // This gives the spx file number for the 00238 // particular variable. 00239 vtkIntArray *SPXTimestepIndexTable; // This a table look up for the index 00240 // into a file for a certain variable. 00241 00242 private: 00243 vtkMFIXReader(const vtkMFIXReader&); // Not implemented. 00244 void operator=(const vtkMFIXReader&); // Not implemented. 00245 00246 void MakeMesh(vtkUnstructuredGrid *output); 00247 void SwapDouble(double &value); 00248 void SwapFloat(float &value); 00249 void SwapInt(int &value); 00250 vtkStdString ConvertIntToString(int in); 00251 int ConvertCharToInt(char in); 00252 int ConvertStringToInt(const vtkStdString & in); 00253 void GetInt(istream& in, int &val); 00254 void GetDouble(istream& in, double& val); 00255 void GetFloat(istream& in, float& val); 00256 void SkipBytes(istream& in, int n); 00257 void RestartVersionNumber(const char* buffer); 00258 void GetBlockOfDoubles(istream& in, vtkDoubleArray *v, int n); 00259 void GetBlockOfFloats(istream& in, vtkFloatArray *v, int n); 00260 void GetBlockOfInts(istream& in, vtkIntArray *v, int n); 00261 void ReadRestartFile(); 00262 void GetVariableAtTimestep(int vari , int tstep, vtkFloatArray *v); 00263 void CreateVariableNames(); 00264 void GetTimeSteps(); 00265 void MakeTimeStepTable(int nvars); 00266 void SetProjectName (const char *infile); 00267 void MakeSPXTimeStepIndexTable(int nvars); 00268 void CalculateMaxTimeStep(); 00269 void GetNumberOfVariablesInSPXFiles(); 00270 void FillVectorVariable( int xindex, int yindex, int zindex, 00271 vtkFloatArray *v); 00272 void ConvertVectorFromCylindricalToCartesian( int xindex, int zindex); 00273 void GetAllTimes(vtkInformationVector *outputVector); 00274 00275 }; 00276 00277 #endif