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

dox/IO/vtkPLOT3DReader.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkPLOT3DReader.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00084 #ifndef __vtkPLOT3DReader_h 00085 #define __vtkPLOT3DReader_h 00086 00087 #include "vtkStructuredGridSource.h" 00088 00089 class vtkIntArray; 00090 class vtkStructuredGrid; 00091 00092 class VTK_IO_EXPORT vtkPLOT3DReader : public vtkStructuredGridSource 00093 { 00094 public: 00095 static vtkPLOT3DReader *New(); 00096 vtkTypeRevisionMacro(vtkPLOT3DReader,vtkStructuredGridSource); 00097 void PrintSelf(ostream& os, vtkIndent indent); 00098 00100 00101 void SetFileName(const char* name) { this->SetXYZFileName(name); } 00102 const char* GetFileName() { return this->GetXYZFileName(); } 00103 vtkSetStringMacro(XYZFileName); 00104 vtkGetStringMacro(XYZFileName); 00106 00108 00109 vtkSetStringMacro(QFileName); 00110 vtkGetStringMacro(QFileName); 00112 00114 00120 int GetNumberOfOutputs(); 00121 int GetNumberOfGrids() { return this->GetNumberOfOutputs(); } 00123 00125 void SetOutput(int idx, vtkStructuredGrid *output); 00126 00128 00130 vtkSetMacro(BinaryFile, int); 00131 vtkGetMacro(BinaryFile, int); 00132 vtkBooleanMacro(BinaryFile, int); 00134 00136 00139 vtkSetMacro(MultiGrid, int); 00140 vtkGetMacro(MultiGrid, int); 00141 vtkBooleanMacro(MultiGrid, int); 00143 00145 00148 vtkSetMacro(HasByteCount, int); 00149 vtkGetMacro(HasByteCount, int); 00150 vtkBooleanMacro(HasByteCount, int); 00152 00154 00157 vtkSetMacro(IBlanking, int); 00158 vtkGetMacro(IBlanking, int); 00159 vtkBooleanMacro(IBlanking, int); 00161 00163 00164 vtkSetMacro(TwoDimensionalGeometry, int); 00165 vtkGetMacro(TwoDimensionalGeometry, int); 00166 vtkBooleanMacro(TwoDimensionalGeometry, int); 00168 00170 00174 vtkSetMacro(ForceRead, int); 00175 vtkGetMacro(ForceRead, int); 00176 vtkBooleanMacro(ForceRead, int); 00178 00180 00185 vtkSetMacro(DoNotReduceNumberOfOutputs, int); 00186 vtkGetMacro(DoNotReduceNumberOfOutputs, int); 00187 vtkBooleanMacro(DoNotReduceNumberOfOutputs, int); 00189 00191 00194 void SetByteOrderToBigEndian(); 00195 void SetByteOrderToLittleEndian(); 00196 vtkSetMacro(ByteOrder, int); 00197 vtkGetMacro(ByteOrder, int); 00198 const char *GetByteOrderAsString(); 00200 00202 00203 vtkSetMacro(R,float); 00204 vtkGetMacro(R,float); 00206 00208 00209 vtkSetMacro(Gamma,float); 00210 vtkGetMacro(Gamma,float); 00212 00214 00215 vtkSetMacro(Uvinf,float); 00216 vtkGetMacro(Uvinf,float); 00218 00220 00221 vtkSetMacro(Vvinf,float); 00222 vtkGetMacro(Vvinf,float); 00224 00226 00227 vtkSetMacro(Wvinf,float); 00228 vtkGetMacro(Wvinf,float); 00230 00232 00234 void SetScalarFunctionNumber(int num); 00235 vtkGetMacro(ScalarFunctionNumber,int); 00237 00239 00241 void SetVectorFunctionNumber(int num); 00242 vtkGetMacro(VectorFunctionNumber,int); 00244 00246 00249 void AddFunction(int functionNumber); 00250 void RemoveFunction(int); 00251 void RemoveAllFunctions(); 00253 00256 virtual int CanReadFile(const char* fname); 00257 00258 //BTX 00259 enum 00260 { 00261 FILE_BIG_ENDIAN=0, 00262 FILE_LITTLE_ENDIAN=1 00263 }; 00264 //ETX 00265 00266 protected: 00267 vtkPLOT3DReader(); 00268 ~vtkPLOT3DReader(); 00269 00270 void ExecuteInformation(); 00271 void Execute(); 00272 00273 int CheckFile(FILE*& fp, const char* fname); 00274 int CheckGeometryFile(FILE*& xyzFp); 00275 int CheckSolutionFile(FILE*& qFp); 00276 00277 void SkipByteCount (FILE* fp); 00278 int ReadIntBlock (FILE* fp, int n, int* block); 00279 int ReadFloatBlock(FILE* fp, int n, float* block); 00280 00281 int GetNumberOfOutputsInternal(FILE* xyzFp, int verify=1); 00282 00283 int ReadGeometryHeader(FILE* fp); 00284 int ReadQHeader(FILE* fp); 00285 00286 void CalculateFileSize(FILE* fp); 00287 long EstimateSize(int ni, int nj, int nk); 00288 00289 void AssignAttribute(int fNumber, vtkStructuredGrid* output, 00290 int attributeType); 00291 void MapFunction(int fNumber, vtkStructuredGrid* output); 00292 void ComputeTemperature(vtkStructuredGrid* output); 00293 void ComputePressure(vtkStructuredGrid* output); 00294 void ComputeEnthalpy(vtkStructuredGrid* output); 00295 void ComputeKineticEnergy(vtkStructuredGrid* output); 00296 void ComputeVelocityMagnitude(vtkStructuredGrid* output); 00297 void ComputeEntropy(vtkStructuredGrid* output); 00298 void ComputeSwirl(vtkStructuredGrid* output); 00299 void ComputeVelocity(vtkStructuredGrid* output); 00300 void ComputeVorticity(vtkStructuredGrid* output); 00301 void ComputePressureGradient(vtkStructuredGrid* output); 00302 00303 00304 //plot3d FileNames 00305 char *XYZFileName; 00306 char *QFileName; 00307 00308 int BinaryFile; 00309 int HasByteCount; 00310 int TwoDimensionalGeometry; 00311 int MultiGrid; 00312 int ForceRead; 00313 int ByteOrder; 00314 int IBlanking; 00315 int DoNotReduceNumberOfOutputs; 00316 00317 long FileSize; 00318 00319 //parameters used in computing derived functions 00320 float R; 00321 float Gamma; 00322 float Uvinf; 00323 float Vvinf; 00324 float Wvinf; 00325 00326 //functions to read that are not scalars or vectors 00327 vtkIntArray *FunctionList; 00328 00329 int ScalarFunctionNumber; 00330 int VectorFunctionNumber; 00331 00332 private: 00333 vtkPLOT3DReader(const vtkPLOT3DReader&); // Not implemented. 00334 void operator=(const vtkPLOT3DReader&); // Not implemented. 00335 }; 00336 00337 #endif 00338 00339