VTK
vtkMultiBlockPLOT3DReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMultiBlockPLOT3DReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
80 #ifndef __vtkMultiBlockPLOT3DReader_h
81 #define __vtkMultiBlockPLOT3DReader_h
82 
83 #include "vtkIOGeometryModule.h" // For export macro
85 
87 class vtkIntArray;
88 class vtkFloatArray;
89 class vtkStructuredGrid;
90 //BTX
91 struct vtkMultiBlockPLOT3DReaderInternals;
92 //ETX
93 class VTKIOGEOMETRY_EXPORT vtkMultiBlockPLOT3DReader : public vtkMultiBlockDataSetAlgorithm
94 {
95 public:
98  void PrintSelf(ostream& os, vtkIndent indent);
99 
101 
102  void SetFileName(const char* name) { this->SetXYZFileName(name); }
103  const char* GetFileName() { return this->GetXYZFileName(); }
104  virtual void SetXYZFileName( const char* );
105  vtkGetStringMacro(XYZFileName);
107 
109 
110  vtkSetStringMacro(QFileName);
111  vtkGetStringMacro(QFileName);
113 
115 
121  int GetNumberOfBlocks();
122  int GetNumberOfGrids() { return this->GetNumberOfBlocks(); }
124 
126 
128  vtkSetMacro(BinaryFile, int);
129  vtkGetMacro(BinaryFile, int);
130  vtkBooleanMacro(BinaryFile, int);
132 
134 
137  vtkSetMacro(MultiGrid, int);
138  vtkGetMacro(MultiGrid, int);
139  vtkBooleanMacro(MultiGrid, int);
141 
143 
146  vtkSetMacro(HasByteCount, int);
147  vtkGetMacro(HasByteCount, int);
148  vtkBooleanMacro(HasByteCount, int);
150 
152 
155  vtkSetMacro(IBlanking, int);
156  vtkGetMacro(IBlanking, int);
157  vtkBooleanMacro(IBlanking, int);
159 
161 
162  vtkSetMacro(TwoDimensionalGeometry, int);
163  vtkGetMacro(TwoDimensionalGeometry, int);
164  vtkBooleanMacro(TwoDimensionalGeometry, int);
166 
168 
172  vtkSetMacro(ForceRead, int);
173  vtkGetMacro(ForceRead, int);
174  vtkBooleanMacro(ForceRead, int);
176 
178 
181  void SetByteOrderToBigEndian();
182  void SetByteOrderToLittleEndian();
183  vtkSetMacro(ByteOrder, int);
184  vtkGetMacro(ByteOrder, int);
185  const char *GetByteOrderAsString();
187 
189 
190  vtkSetMacro(R,double);
191  vtkGetMacro(R,double);
193 
195 
196  vtkSetMacro(Gamma,double);
197  vtkGetMacro(Gamma,double);
199 
201 
202  vtkSetMacro(Uvinf,double);
203  vtkGetMacro(Uvinf,double);
205 
207 
208  vtkSetMacro(Vvinf,double);
209  vtkGetMacro(Vvinf,double);
211 
213 
214  vtkSetMacro(Wvinf,double);
215  vtkGetMacro(Wvinf,double);
217 
219 
221  void SetScalarFunctionNumber(int num);
222  vtkGetMacro(ScalarFunctionNumber,int);
224 
226 
228  void SetVectorFunctionNumber(int num);
229  vtkGetMacro(VectorFunctionNumber,int);
231 
233 
236  void AddFunction(int functionNumber);
237  void RemoveFunction(int);
238  void RemoveAllFunctions();
240 
243  virtual int CanReadBinaryFile(const char* fname);
244 
245 //BTX
246  enum
247  {
248  FILE_BIG_ENDIAN=0,
249  FILE_LITTLE_ENDIAN=1
250  };
251 //ETX
252 
253 protected:
256 
257  int CheckFile(FILE*& fp, const char* fname);
258  int CheckGeometryFile(FILE*& xyzFp);
259  int CheckSolutionFile(FILE*& qFp);
260 
261  void SkipByteCount (FILE* fp);
262  int ReadIntBlock (FILE* fp, int n, int* block);
263  int ReadFloatBlock(FILE* fp, int n, float* block);
264 
265  int GetNumberOfBlocksInternal(FILE* xyzFp, int verify=1);
266 
267  int ReadGeometryHeader(FILE* fp);
268  int ReadQHeader(FILE* fp);
269 
270  void CalculateFileSize(FILE* fp);
271  long EstimateSize(int ni, int nj, int nk);
272 
273  void AssignAttribute(int fNumber, vtkStructuredGrid* output,
274  int attributeType);
275  void MapFunction(int fNumber, vtkStructuredGrid* output);
276  void ComputeTemperature(vtkStructuredGrid* output);
277  void ComputePressure(vtkStructuredGrid* output);
278  void ComputeEnthalpy(vtkStructuredGrid* output);
279  void ComputeKineticEnergy(vtkStructuredGrid* output);
280  void ComputeVelocityMagnitude(vtkStructuredGrid* output);
281  void ComputeEntropy(vtkStructuredGrid* output);
282  void ComputeSwirl(vtkStructuredGrid* output);
283  void ComputeVelocity(vtkStructuredGrid* output);
284  void ComputeVorticity(vtkStructuredGrid* output);
285  void ComputePressureGradient(vtkStructuredGrid* output);
286 
287  // Delete references to any existing vtkPoints and
288  // I-blank arrays. The next Update() will (re)read
289  // the XYZ file.
290  void ClearGeometryCache();
291 
292  //plot3d FileNames
293  char *XYZFileName;
294  char *QFileName;
295 
303 
304  long FileSize;
305 
306  //parameters used in computing derived functions
307  double R;
308  double Gamma;
309  double Uvinf;
310  double Vvinf;
311  double Wvinf;
312 
313  //functions to read that are not scalars or vectors
315 
318 
319  // Cache of geometry
322 
323  // First pass at automatically detecting configuration
324  int GenerateDefaultConfiguration();
325  int VerifySettings(char* buf, int bufSize);
326 
327  void ReadIntBlockV(char** buf, int n, int* block);
328  void SkipByteCountV(char** buf);
329 
331 
332  virtual int RequestData(vtkInformation*,
335  virtual int RequestInformation(vtkInformation*,
338 
339 private:
340 
341  vtkMultiBlockPLOT3DReaderInternals* Internal;
342 
343  vtkMultiBlockPLOT3DReader(const vtkMultiBlockPLOT3DReader&); // Not implemented.
344  void operator=(const vtkMultiBlockPLOT3DReader&); // Not implemented.
345 };
346 
347 #endif
348 
349