00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00092 #ifndef __vtkPLOT3DReader_h
00093 #define __vtkPLOT3DReader_h
00094
00095 #include "vtkStructuredGridSource.h"
00096
00097 class vtkUnsignedCharArray;
00098 class vtkIntArray;
00099 class vtkFloatArray;
00100 class vtkStructuredGrid;
00101
00102 class VTK_IO_EXPORT vtkPLOT3DReader : public vtkStructuredGridSource
00103 {
00104 public:
00105 static vtkPLOT3DReader *New();
00106 vtkTypeRevisionMacro(vtkPLOT3DReader,vtkStructuredGridSource);
00107 void PrintSelf(ostream& os, vtkIndent indent);
00108
00110
00111 void SetFileName(const char* name) { this->SetXYZFileName(name); }
00112 const char* GetFileName() { return this->GetXYZFileName(); }
00113 virtual void SetXYZFileName( const char* );
00114 vtkGetStringMacro(XYZFileName);
00116
00118
00119 vtkSetStringMacro(QFileName);
00120 vtkGetStringMacro(QFileName);
00122
00124
00130 int GetNumberOfOutputs();
00131 int GetNumberOfGrids() { return this->GetNumberOfOutputs(); }
00133
00135 void SetOutput(int idx, vtkStructuredGrid *output);
00136
00138
00140 vtkSetMacro(BinaryFile, int);
00141 vtkGetMacro(BinaryFile, int);
00142 vtkBooleanMacro(BinaryFile, int);
00144
00146
00149 vtkSetMacro(MultiGrid, int);
00150 vtkGetMacro(MultiGrid, int);
00151 vtkBooleanMacro(MultiGrid, int);
00153
00155
00158 vtkSetMacro(HasByteCount, int);
00159 vtkGetMacro(HasByteCount, int);
00160 vtkBooleanMacro(HasByteCount, int);
00162
00164
00167 vtkSetMacro(IBlanking, int);
00168 vtkGetMacro(IBlanking, int);
00169 vtkBooleanMacro(IBlanking, int);
00171
00173
00174 vtkSetMacro(TwoDimensionalGeometry, int);
00175 vtkGetMacro(TwoDimensionalGeometry, int);
00176 vtkBooleanMacro(TwoDimensionalGeometry, int);
00178
00180
00184 vtkSetMacro(ForceRead, int);
00185 vtkGetMacro(ForceRead, int);
00186 vtkBooleanMacro(ForceRead, int);
00188
00190
00195 vtkSetMacro(DoNotReduceNumberOfOutputs, int);
00196 vtkGetMacro(DoNotReduceNumberOfOutputs, int);
00197 vtkBooleanMacro(DoNotReduceNumberOfOutputs, int);
00199
00201
00204 void SetByteOrderToBigEndian();
00205 void SetByteOrderToLittleEndian();
00206 vtkSetMacro(ByteOrder, int);
00207 vtkGetMacro(ByteOrder, int);
00208 const char *GetByteOrderAsString();
00210
00212
00213 vtkSetMacro(R,double);
00214 vtkGetMacro(R,double);
00216
00218
00219 vtkSetMacro(Gamma,double);
00220 vtkGetMacro(Gamma,double);
00222
00224
00225 vtkSetMacro(Uvinf,double);
00226 vtkGetMacro(Uvinf,double);
00228
00230
00231 vtkSetMacro(Vvinf,double);
00232 vtkGetMacro(Vvinf,double);
00234
00236
00237 vtkSetMacro(Wvinf,double);
00238 vtkGetMacro(Wvinf,double);
00240
00242
00244 void SetScalarFunctionNumber(int num);
00245 vtkGetMacro(ScalarFunctionNumber,int);
00247
00249
00251 void SetVectorFunctionNumber(int num);
00252 vtkGetMacro(VectorFunctionNumber,int);
00254
00256
00259 void AddFunction(int functionNumber);
00260 void RemoveFunction(int);
00261 void RemoveAllFunctions();
00263
00266 virtual int CanReadBinaryFile(const char* fname);
00267
00268 int GenerateDefaultConfiguration();
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
00318 void ClearGeometryCache();
00319
00320
00321 char *XYZFileName;
00322 char *QFileName;
00323
00324 int BinaryFile;
00325 int HasByteCount;
00326 int TwoDimensionalGeometry;
00327 int MultiGrid;
00328 int ForceRead;
00329 int ByteOrder;
00330 int IBlanking;
00331 int DoNotReduceNumberOfOutputs;
00332
00333 long FileSize;
00334
00335
00336 double R;
00337 double Gamma;
00338 double Uvinf;
00339 double Vvinf;
00340 double Wvinf;
00341
00342
00343 vtkIntArray *FunctionList;
00344
00345 int ScalarFunctionNumber;
00346 int VectorFunctionNumber;
00347
00348
00349 vtkFloatArray** PointCache;
00350 vtkUnsignedCharArray** IBlankCache;
00351
00352 int VerifySettings(char* buf, int bufSize);
00353 void ReadIntBlockV(char** buf, int n, int* block);
00354 void SkipByteCountV(char** buf);
00355
00356
00357 private:
00358 vtkPLOT3DReader(const vtkPLOT3DReader&);
00359 void operator=(const vtkPLOT3DReader&);
00360 };
00361
00362 #endif
00363
00364