VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMultiBlockPLOT3DReader.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 =========================================================================*/ 00091 #ifndef __vtkMultiBlockPLOT3DReader_h 00092 #define __vtkMultiBlockPLOT3DReader_h 00093 00094 #include "vtkIOGeometryModule.h" // For export macro 00095 #include "vtkMultiBlockDataSetAlgorithm.h" 00096 00097 class vtkDataArray; 00098 class vtkUnsignedCharArray; 00099 class vtkIntArray; 00100 class vtkStructuredGrid; 00101 //BTX 00102 struct vtkMultiBlockPLOT3DReaderInternals; 00103 //ETX 00104 class VTKIOGEOMETRY_EXPORT vtkMultiBlockPLOT3DReader : public vtkMultiBlockDataSetAlgorithm 00105 { 00106 public: 00107 static vtkMultiBlockPLOT3DReader *New(); 00108 vtkTypeMacro(vtkMultiBlockPLOT3DReader,vtkMultiBlockDataSetAlgorithm); 00109 void PrintSelf(ostream& os, vtkIndent indent); 00110 00112 00113 void SetFileName(const char* name) { this->SetXYZFileName(name); } 00114 const char* GetFileName() { return this->GetXYZFileName(); } 00115 virtual void SetXYZFileName( const char* ); 00116 vtkGetStringMacro(XYZFileName); 00118 00120 00121 vtkSetStringMacro(QFileName); 00122 vtkGetStringMacro(QFileName); 00124 00126 00127 vtkSetStringMacro(FunctionFileName); 00128 vtkGetStringMacro(FunctionFileName); 00130 00132 00140 vtkSetMacro(AutoDetectFormat, int); 00141 vtkGetMacro(AutoDetectFormat, int); 00142 vtkBooleanMacro(AutoDetectFormat, int); 00144 00146 00148 vtkSetMacro(BinaryFile, int); 00149 vtkGetMacro(BinaryFile, int); 00150 vtkBooleanMacro(BinaryFile, int); 00152 00154 00157 vtkSetMacro(MultiGrid, int); 00158 vtkGetMacro(MultiGrid, int); 00159 vtkBooleanMacro(MultiGrid, int); 00161 00163 00166 vtkSetMacro(HasByteCount, int); 00167 vtkGetMacro(HasByteCount, int); 00168 vtkBooleanMacro(HasByteCount, int); 00170 00172 00175 vtkSetMacro(IBlanking, int); 00176 vtkGetMacro(IBlanking, int); 00177 vtkBooleanMacro(IBlanking, int); 00179 00181 00182 vtkSetMacro(TwoDimensionalGeometry, int); 00183 vtkGetMacro(TwoDimensionalGeometry, int); 00184 vtkBooleanMacro(TwoDimensionalGeometry, int); 00186 00188 00190 vtkSetMacro(DoublePrecision, int); 00191 vtkGetMacro(DoublePrecision, int); 00192 vtkBooleanMacro(DoublePrecision, int); 00194 00196 00200 vtkSetMacro(ForceRead, int); 00201 vtkGetMacro(ForceRead, int); 00202 vtkBooleanMacro(ForceRead, int); 00204 00206 00209 void SetByteOrderToBigEndian(); 00210 void SetByteOrderToLittleEndian(); 00211 vtkSetMacro(ByteOrder, int); 00212 vtkGetMacro(ByteOrder, int); 00213 const char *GetByteOrderAsString(); 00215 00217 00218 vtkSetMacro(R,double); 00219 vtkGetMacro(R,double); 00221 00223 00224 vtkSetMacro(Gamma,double); 00225 vtkGetMacro(Gamma,double); 00227 00229 00231 void SetScalarFunctionNumber(int num); 00232 vtkGetMacro(ScalarFunctionNumber,int); 00234 00236 00238 void SetVectorFunctionNumber(int num); 00239 vtkGetMacro(VectorFunctionNumber,int); 00241 00243 00246 void AddFunction(int functionNumber); 00247 void RemoveFunction(int); 00248 void RemoveAllFunctions(); 00250 00253 virtual int CanReadBinaryFile(const char* fname); 00254 00257 virtual void Modified(); 00258 00259 //BTX 00260 enum 00261 { 00262 FILE_BIG_ENDIAN=0, 00263 FILE_LITTLE_ENDIAN=1 00264 }; 00265 //ETX 00266 00267 protected: 00268 vtkMultiBlockPLOT3DReader(); 00269 ~vtkMultiBlockPLOT3DReader(); 00270 00271 vtkDataArray* CreateFloatArray(); 00272 00273 int CheckFile(FILE*& fp, const char* fname); 00274 int CheckGeometryFile(FILE*& xyzFp); 00275 int CheckSolutionFile(FILE*& qFp); 00276 int CheckFunctionFile(FILE*& fFp); 00277 00278 int SkipByteCount (FILE* fp); 00279 int ReadIntBlock (FILE* fp, int n, int* block); 00280 00281 int ReadScalar(FILE* fp, int n, vtkDataArray* scalar); 00282 int ReadVector(FILE* fp, int n, int numDims, vtkDataArray* vector); 00283 00284 int GetNumberOfBlocksInternal(FILE* xyzFp, int allocate); 00285 00286 int ReadGeometryHeader(FILE* fp); 00287 int ReadQHeader(FILE* fp, bool checkGrid, int& nq, int& nqc, int& overflow); 00288 int ReadFunctionHeader(FILE* fp, int* nFunctions); 00289 00290 void CalculateFileSize(FILE* fp); 00291 long EstimateSize(int ni, int nj, int nk); 00292 00293 int AutoDetectionCheck(FILE* fp); 00294 00295 00296 void AssignAttribute(int fNumber, vtkStructuredGrid* output, 00297 int attributeType); 00298 void MapFunction(int fNumber, vtkStructuredGrid* output); 00299 void ComputeTemperature(vtkStructuredGrid* output); 00300 void ComputePressure(vtkStructuredGrid* output); 00301 void ComputeEnthalpy(vtkStructuredGrid* output); 00302 void ComputeKineticEnergy(vtkStructuredGrid* output); 00303 void ComputeVelocityMagnitude(vtkStructuredGrid* output); 00304 void ComputeEntropy(vtkStructuredGrid* output); 00305 void ComputeSwirl(vtkStructuredGrid* output); 00306 void ComputeVelocity(vtkStructuredGrid* output); 00307 void ComputeVorticity(vtkStructuredGrid* output); 00308 void ComputePressureGradient(vtkStructuredGrid* output); 00309 void ComputePressureCoefficient(vtkStructuredGrid* output); 00310 void ComputeMachNumber(vtkStructuredGrid* output); 00311 void ComputeSoundSpeed(vtkStructuredGrid* output); 00312 void ComputeVorticityMagnitude(vtkStructuredGrid* output); 00313 void ComputeStrainRate(vtkStructuredGrid* output); 00314 00315 // Returns a vtkFloatArray or a vtkDoubleArray depending 00316 // on DoublePrecision setting 00317 vtkDataArray* NewFloatArray(); 00318 00319 // Delete references to any existing vtkPoints and 00320 // I-blank arrays. The next Update() will (re)read 00321 // the XYZ file. 00322 void ClearGeometryCache(); 00323 00324 //plot3d FileNames 00325 char *XYZFileName; 00326 char *QFileName; 00327 char *FunctionFileName; 00328 00329 int BinaryFile; 00330 int HasByteCount; 00331 int TwoDimensionalGeometry; 00332 int MultiGrid; 00333 int ForceRead; 00334 int ByteOrder; 00335 int IBlanking; 00336 int DoublePrecision; 00337 int AutoDetectFormat; 00338 00339 long FileSize; 00340 00341 //parameters used in computing derived functions 00342 double R; 00343 double Gamma; 00344 double Uvinf; 00345 double Vvinf; 00346 double Wvinf; 00347 00348 //functions to read that are not scalars or vectors 00349 vtkIntArray *FunctionList; 00350 00351 int ScalarFunctionNumber; 00352 int VectorFunctionNumber; 00353 00354 virtual int FillOutputPortInformation(int port, vtkInformation* info); 00355 00356 virtual int RequestData(vtkInformation*, 00357 vtkInformationVector**, 00358 vtkInformationVector*); 00359 virtual int RequestInformation(vtkInformation*, 00360 vtkInformationVector**, 00361 vtkInformationVector*); 00362 00363 vtkMultiBlockPLOT3DReaderInternals* Internal; 00364 00365 private: 00366 vtkMultiBlockPLOT3DReader(const vtkMultiBlockPLOT3DReader&); // Not implemented. 00367 void operator=(const vtkMultiBlockPLOT3DReader&); // Not implemented. 00368 }; 00369 00370 #endif 00371 00372