00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00096 #ifndef __vtkPLOT3DReader_h
00097 #define __vtkPLOT3DReader_h
00098
00099 #include "vtkStructuredGridSource.h"
00100
00101 class vtkIntArray;
00102 class vtkStructuredGrid;
00103
00104 class VTK_IO_EXPORT vtkPLOT3DReader : public vtkStructuredGridSource
00105 {
00106 public:
00107 static vtkPLOT3DReader *New();
00108 vtkTypeRevisionMacro(vtkPLOT3DReader,vtkStructuredGridSource);
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 vtkSetStringMacro(XYZFileName);
00116 vtkGetStringMacro(XYZFileName);
00118
00120
00121 vtkSetStringMacro(QFileName);
00122 vtkGetStringMacro(QFileName);
00124
00126
00132 int GetNumberOfOutputs();
00133 int GetNumberOfGrids() { return this->GetNumberOfOutputs(); }
00135
00137 void SetOutput(int idx, vtkStructuredGrid *output);
00138
00140
00142 vtkSetMacro(BinaryFile, int);
00143 vtkGetMacro(BinaryFile, int);
00144 vtkBooleanMacro(BinaryFile, int);
00146
00148
00151 vtkSetMacro(MultiGrid, int);
00152 vtkGetMacro(MultiGrid, int);
00153 vtkBooleanMacro(MultiGrid, int);
00155
00157
00160 vtkSetMacro(HasByteCount, int);
00161 vtkGetMacro(HasByteCount, int);
00162 vtkBooleanMacro(HasByteCount, int);
00164
00166
00169 vtkSetMacro(IBlanking, int);
00170 vtkGetMacro(IBlanking, int);
00171 vtkBooleanMacro(IBlanking, int);
00173
00175
00176 vtkSetMacro(TwoDimensionalGeometry, int);
00177 vtkGetMacro(TwoDimensionalGeometry, int);
00178 vtkBooleanMacro(TwoDimensionalGeometry, int);
00180
00182
00186 vtkSetMacro(ForceRead, int);
00187 vtkGetMacro(ForceRead, int);
00188 vtkBooleanMacro(ForceRead, int);
00190
00192
00197 vtkSetMacro(DoNotReduceNumberOfOutputs, int);
00198 vtkGetMacro(DoNotReduceNumberOfOutputs, int);
00199 vtkBooleanMacro(DoNotReduceNumberOfOutputs, int);
00201
00203
00206 void SetByteOrderToBigEndian();
00207 void SetByteOrderToLittleEndian();
00208 vtkSetMacro(ByteOrder, int);
00209 vtkGetMacro(ByteOrder, int);
00210 const char *GetByteOrderAsString();
00212
00214
00215 vtkSetMacro(R,float);
00216 vtkGetMacro(R,float);
00218
00220
00221 vtkSetMacro(Gamma,float);
00222 vtkGetMacro(Gamma,float);
00224
00226
00227 vtkSetMacro(Uvinf,float);
00228 vtkGetMacro(Uvinf,float);
00230
00232
00233 vtkSetMacro(Vvinf,float);
00234 vtkGetMacro(Vvinf,float);
00236
00238
00239 vtkSetMacro(Wvinf,float);
00240 vtkGetMacro(Wvinf,float);
00242
00244
00246 void SetScalarFunctionNumber(int num);
00247 vtkGetMacro(ScalarFunctionNumber,int);
00249
00251
00253 void SetVectorFunctionNumber(int num);
00254 vtkGetMacro(VectorFunctionNumber,int);
00256
00258
00261 void AddFunction(int functionNumber);
00262 void RemoveFunction(int);
00263 void RemoveAllFunctions();
00265
00268 virtual int CanReadFile(const char* fname);
00269
00270
00271 enum
00272 {
00273 FILE_BIG_ENDIAN=0,
00274 FILE_LITTLE_ENDIAN=1
00275 };
00276
00277
00278 protected:
00279 vtkPLOT3DReader();
00280 ~vtkPLOT3DReader();
00281
00282 void ExecuteInformation();
00283 void Execute();
00284
00285 int CheckFile(FILE*& fp, const char* fname);
00286 int CheckGeometryFile(FILE*& xyzFp);
00287 int CheckSolutionFile(FILE*& qFp);
00288
00289 void SkipByteCount (FILE* fp);
00290 int ReadIntBlock (FILE* fp, int n, int* block);
00291 int ReadFloatBlock(FILE* fp, int n, float* block);
00292
00293 int GetNumberOfOutputsInternal(FILE* xyzFp, int verify=1);
00294
00295 int ReadGeometryHeader(FILE* fp);
00296 int ReadQHeader(FILE* fp);
00297
00298 void CalculateFileSize(FILE* fp);
00299 long EstimateSize(int ni, int nj, int nk);
00300
00301 void AssignAttribute(int fNumber, vtkStructuredGrid* output,
00302 int attributeType);
00303 void MapFunction(int fNumber, vtkStructuredGrid* output);
00304 void ComputeTemperature(vtkStructuredGrid* output);
00305 void ComputePressure(vtkStructuredGrid* output);
00306 void ComputeEnthalpy(vtkStructuredGrid* output);
00307 void ComputeKineticEnergy(vtkStructuredGrid* output);
00308 void ComputeVelocityMagnitude(vtkStructuredGrid* output);
00309 void ComputeEntropy(vtkStructuredGrid* output);
00310 void ComputeSwirl(vtkStructuredGrid* output);
00311 void ComputeVelocity(vtkStructuredGrid* output);
00312 void ComputeVorticity(vtkStructuredGrid* output);
00313 void ComputePressureGradient(vtkStructuredGrid* output);
00314
00315
00316
00317 char *XYZFileName;
00318 char *QFileName;
00319
00320 int BinaryFile;
00321 int HasByteCount;
00322 int TwoDimensionalGeometry;
00323 int MultiGrid;
00324 int ForceRead;
00325 int ByteOrder;
00326 int IBlanking;
00327 int DoNotReduceNumberOfOutputs;
00328
00329 long FileSize;
00330
00331
00332 float R;
00333 float Gamma;
00334 float Uvinf;
00335 float Vvinf;
00336 float Wvinf;
00337
00338
00339 vtkIntArray *FunctionList;
00340
00341 int ScalarFunctionNumber;
00342 int VectorFunctionNumber;
00343
00344 private:
00345 vtkPLOT3DReader(const vtkPLOT3DReader&);
00346 void operator=(const vtkPLOT3DReader&);
00347 };
00348
00349 #endif
00350
00351