00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00080 #ifndef __vtkPLOT3DReader_h
00081 #define __vtkPLOT3DReader_h
00082
00083 #include "vtkStructuredGridSource.h"
00084
00085 class vtkUnsignedCharArray;
00086 class vtkIntArray;
00087 class vtkFloatArray;
00088 class vtkStructuredGrid;
00089
00090 class VTK_IO_EXPORT vtkPLOT3DReader : public vtkStructuredGridSource
00091 {
00092 public:
00093 static vtkPLOT3DReader *New();
00094 vtkTypeRevisionMacro(vtkPLOT3DReader,vtkStructuredGridSource);
00095 void PrintSelf(ostream& os, vtkIndent indent);
00096
00098
00099 void SetFileName(const char* name) { this->SetXYZFileName(name); }
00100 const char* GetFileName() { return this->GetXYZFileName(); }
00101 virtual void SetXYZFileName( const char* );
00102 vtkGetStringMacro(XYZFileName);
00104
00106
00107 vtkSetStringMacro(QFileName);
00108 vtkGetStringMacro(QFileName);
00110
00112
00118 int GetNumberOfOutputs();
00119 int GetNumberOfGrids() { return this->GetNumberOfOutputs(); }
00121
00123 void SetOutput(int idx, vtkStructuredGrid *output);
00124
00126
00128 vtkSetMacro(BinaryFile, int);
00129 vtkGetMacro(BinaryFile, int);
00130 vtkBooleanMacro(BinaryFile, int);
00132
00134
00137 vtkSetMacro(MultiGrid, int);
00138 vtkGetMacro(MultiGrid, int);
00139 vtkBooleanMacro(MultiGrid, int);
00141
00143
00146 vtkSetMacro(HasByteCount, int);
00147 vtkGetMacro(HasByteCount, int);
00148 vtkBooleanMacro(HasByteCount, int);
00150
00152
00155 vtkSetMacro(IBlanking, int);
00156 vtkGetMacro(IBlanking, int);
00157 vtkBooleanMacro(IBlanking, int);
00159
00161
00162 vtkSetMacro(TwoDimensionalGeometry, int);
00163 vtkGetMacro(TwoDimensionalGeometry, int);
00164 vtkBooleanMacro(TwoDimensionalGeometry, int);
00166
00168
00172 vtkSetMacro(ForceRead, int);
00173 vtkGetMacro(ForceRead, int);
00174 vtkBooleanMacro(ForceRead, int);
00176
00178
00183 vtkSetMacro(DoNotReduceNumberOfOutputs, int);
00184 vtkGetMacro(DoNotReduceNumberOfOutputs, int);
00185 vtkBooleanMacro(DoNotReduceNumberOfOutputs, int);
00187
00189
00192 void SetByteOrderToBigEndian();
00193 void SetByteOrderToLittleEndian();
00194 vtkSetMacro(ByteOrder, int);
00195 vtkGetMacro(ByteOrder, int);
00196 const char *GetByteOrderAsString();
00198
00200
00201 vtkSetMacro(R,double);
00202 vtkGetMacro(R,double);
00204
00206
00207 vtkSetMacro(Gamma,double);
00208 vtkGetMacro(Gamma,double);
00210
00212
00213 vtkSetMacro(Uvinf,double);
00214 vtkGetMacro(Uvinf,double);
00216
00218
00219 vtkSetMacro(Vvinf,double);
00220 vtkGetMacro(Vvinf,double);
00222
00224
00225 vtkSetMacro(Wvinf,double);
00226 vtkGetMacro(Wvinf,double);
00228
00230
00232 void SetScalarFunctionNumber(int num);
00233 vtkGetMacro(ScalarFunctionNumber,int);
00235
00237
00239 void SetVectorFunctionNumber(int num);
00240 vtkGetMacro(VectorFunctionNumber,int);
00242
00244
00247 void AddFunction(int functionNumber);
00248 void RemoveFunction(int);
00249 void RemoveAllFunctions();
00251
00254 virtual int CanReadBinaryFile(const char* fname);
00255
00256 int GenerateDefaultConfiguration();
00257
00258
00259 enum
00260 {
00261 FILE_BIG_ENDIAN=0,
00262 FILE_LITTLE_ENDIAN=1
00263 };
00264
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
00305
00306 void ClearGeometryCache();
00307
00308
00309 char *XYZFileName;
00310 char *QFileName;
00311
00312 int BinaryFile;
00313 int HasByteCount;
00314 int TwoDimensionalGeometry;
00315 int MultiGrid;
00316 int ForceRead;
00317 int ByteOrder;
00318 int IBlanking;
00319 int DoNotReduceNumberOfOutputs;
00320
00321 long FileSize;
00322
00323
00324 double R;
00325 double Gamma;
00326 double Uvinf;
00327 double Vvinf;
00328 double Wvinf;
00329
00330
00331 vtkIntArray *FunctionList;
00332
00333 int ScalarFunctionNumber;
00334 int VectorFunctionNumber;
00335
00336
00337 vtkFloatArray** PointCache;
00338 vtkUnsignedCharArray** IBlankCache;
00339
00340 int VerifySettings(char* buf, int bufSize);
00341 void ReadIntBlockV(char** buf, int n, int* block);
00342 void SkipByteCountV(char** buf);
00343
00344
00345 private:
00346 vtkPLOT3DReader(const vtkPLOT3DReader&);
00347 void operator=(const vtkPLOT3DReader&);
00348 };
00349
00350 #endif
00351
00352