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