Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkMultiBlockPLOT3DReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMultiBlockPLOT3DReader.h,v $
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 =========================================================================*/
00077 #ifndef __vtkMultiBlockPLOT3DReader_h
00078 #define __vtkMultiBlockPLOT3DReader_h
00079 
00080 #include "vtkHierarchicalDataSetAlgorithm.h"
00081 
00082 class vtkUnsignedCharArray;
00083 class vtkIntArray;
00084 class vtkFloatArray;
00085 class vtkStructuredGrid;
00086 //BTX
00087 struct vtkMultiBlockPLOT3DReaderInternals;
00088 //ETX
00089 class VTK_IO_EXPORT vtkMultiBlockPLOT3DReader : public vtkHierarchicalDataSetAlgorithm 
00090 {
00091 public:
00092   static vtkMultiBlockPLOT3DReader *New();
00093   vtkTypeRevisionMacro(vtkMultiBlockPLOT3DReader,vtkHierarchicalDataSetAlgorithm);
00094   void PrintSelf(ostream& os, vtkIndent indent);
00095 
00097 
00098   void SetFileName(const char* name) { this->SetXYZFileName(name); }
00099   const char* GetFileName() { return this->GetXYZFileName(); }
00100   virtual void SetXYZFileName( const char* );
00101   vtkGetStringMacro(XYZFileName);
00103 
00105 
00106   vtkSetStringMacro(QFileName);
00107   vtkGetStringMacro(QFileName);
00109 
00111 
00117   int GetNumberOfBlocks();
00118   int GetNumberOfGrids() { return this->GetNumberOfBlocks(); }
00120 
00122 
00124   vtkSetMacro(BinaryFile, int);
00125   vtkGetMacro(BinaryFile, int);
00126   vtkBooleanMacro(BinaryFile, int);
00128 
00130 
00133   vtkSetMacro(MultiGrid, int);
00134   vtkGetMacro(MultiGrid, int);
00135   vtkBooleanMacro(MultiGrid, int);
00137 
00139 
00142   vtkSetMacro(HasByteCount, int);
00143   vtkGetMacro(HasByteCount, int);
00144   vtkBooleanMacro(HasByteCount, int);
00146 
00148 
00151   vtkSetMacro(IBlanking, int);
00152   vtkGetMacro(IBlanking, int);
00153   vtkBooleanMacro(IBlanking, int);
00155 
00157 
00158   vtkSetMacro(TwoDimensionalGeometry, int);
00159   vtkGetMacro(TwoDimensionalGeometry, int);
00160   vtkBooleanMacro(TwoDimensionalGeometry, int);
00162 
00164 
00168   vtkSetMacro(ForceRead, int);
00169   vtkGetMacro(ForceRead, int);
00170   vtkBooleanMacro(ForceRead, int);
00172 
00174 
00177   void SetByteOrderToBigEndian();
00178   void SetByteOrderToLittleEndian();
00179   vtkSetMacro(ByteOrder, int);
00180   vtkGetMacro(ByteOrder, int);
00181   const char *GetByteOrderAsString();
00183 
00185 
00186   vtkSetMacro(R,double);
00187   vtkGetMacro(R,double);
00189 
00191 
00192   vtkSetMacro(Gamma,double);
00193   vtkGetMacro(Gamma,double);
00195 
00197 
00198   vtkSetMacro(Uvinf,double);
00199   vtkGetMacro(Uvinf,double);
00201 
00203 
00204   vtkSetMacro(Vvinf,double);
00205   vtkGetMacro(Vvinf,double);
00207 
00209 
00210   vtkSetMacro(Wvinf,double);
00211   vtkGetMacro(Wvinf,double);
00213 
00215 
00217   void SetScalarFunctionNumber(int num);
00218   vtkGetMacro(ScalarFunctionNumber,int);
00220 
00222 
00224   void SetVectorFunctionNumber(int num);
00225   vtkGetMacro(VectorFunctionNumber,int);
00227 
00229 
00232   void AddFunction(int functionNumber);
00233   void RemoveFunction(int);
00234   void RemoveAllFunctions();
00236 
00239   virtual int CanReadBinaryFile(const char* fname);
00240 
00241   int GenerateDefaultConfiguration();
00242 
00243 //BTX
00244   enum 
00245   {
00246     FILE_BIG_ENDIAN=0,
00247     FILE_LITTLE_ENDIAN=1
00248   };
00249 //ETX
00250 
00251 protected:
00252   vtkMultiBlockPLOT3DReader();
00253   ~vtkMultiBlockPLOT3DReader();
00254 
00255   int CheckFile(FILE*& fp, const char* fname);
00256   int CheckGeometryFile(FILE*& xyzFp);
00257   int CheckSolutionFile(FILE*& qFp);
00258 
00259   void SkipByteCount (FILE* fp);
00260   int ReadIntBlock  (FILE* fp, int n, int*   block);
00261   int ReadFloatBlock(FILE* fp, int n, float* block);
00262 
00263   int GetNumberOfBlocksInternal(FILE* xyzFp, int verify=1);
00264 
00265   int ReadGeometryHeader(FILE* fp);
00266   int ReadQHeader(FILE* fp);
00267 
00268   void CalculateFileSize(FILE* fp);
00269   long EstimateSize(int ni, int nj, int nk);
00270 
00271   void AssignAttribute(int fNumber, vtkStructuredGrid* output,
00272                        int attributeType);
00273   void MapFunction(int fNumber, vtkStructuredGrid* output);
00274   void ComputeTemperature(vtkStructuredGrid* output);
00275   void ComputePressure(vtkStructuredGrid* output);
00276   void ComputeEnthalpy(vtkStructuredGrid* output);
00277   void ComputeKineticEnergy(vtkStructuredGrid* output);
00278   void ComputeVelocityMagnitude(vtkStructuredGrid* output);
00279   void ComputeEntropy(vtkStructuredGrid* output);
00280   void ComputeSwirl(vtkStructuredGrid* output);
00281   void ComputeVelocity(vtkStructuredGrid* output);
00282   void ComputeVorticity(vtkStructuredGrid* output);
00283   void ComputePressureGradient(vtkStructuredGrid* output);
00284 
00285   // Delete references to any existing vtkPoints and
00286   // I-blank arrays. The next Update() will (re)read
00287   // the XYZ file.
00288   void ClearGeometryCache();
00289 
00290   //plot3d FileNames
00291   char *XYZFileName;
00292   char *QFileName;
00293 
00294   int BinaryFile;
00295   int HasByteCount;
00296   int TwoDimensionalGeometry;
00297   int MultiGrid;
00298   int ForceRead;
00299   int ByteOrder;
00300   int IBlanking;
00301 
00302   long FileSize;
00303 
00304   //parameters used in computing derived functions
00305   double R; 
00306   double Gamma;
00307   double Uvinf;
00308   double Vvinf;
00309   double Wvinf;
00310 
00311   //functions to read that are not scalars or vectors
00312   vtkIntArray *FunctionList;
00313 
00314   int ScalarFunctionNumber;
00315   int VectorFunctionNumber;
00316 
00317   // Cache of geometry
00318   vtkFloatArray** PointCache;
00319   vtkUnsignedCharArray** IBlankCache;
00320 
00321   int VerifySettings(char* buf, int bufSize);
00322   void ReadIntBlockV(char** buf, int n, int* block);
00323   void SkipByteCountV(char** buf);
00324 
00325   virtual int FillOutputPortInformation(int port, vtkInformation* info);
00326 
00327   virtual int RequestData(vtkInformation*, 
00328                           vtkInformationVector**, 
00329                           vtkInformationVector*);
00330   virtual int RequestInformation(vtkInformation*, 
00331                                  vtkInformationVector**, 
00332                                  vtkInformationVector*);
00333   
00334 private:
00335 
00336   vtkMultiBlockPLOT3DReaderInternals* Internal;
00337 
00338   vtkMultiBlockPLOT3DReader(const vtkMultiBlockPLOT3DReader&);  // Not implemented.
00339   void operator=(const vtkMultiBlockPLOT3DReader&);  // Not implemented.
00340 };
00341 
00342 #endif
00343 
00344 

Generated on Mon Jan 21 23:07:31 2008 for VTK by  doxygen 1.4.3-20050530