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 =========================================================================*/
77 #ifndef __vtkMultiBlockPLOT3DReader_h
78 #define __vtkMultiBlockPLOT3DReader_h
79 
81 
83 class vtkIntArray;
84 class vtkFloatArray;
85 class vtkStructuredGrid;
86 //BTX
87 struct vtkMultiBlockPLOT3DReaderInternals;
88 //ETX
90 {
91 public:
94  void PrintSelf(ostream& os, vtkIndent indent);
95 
97 
98  void SetFileName(const char* name) { this->SetXYZFileName(name); }
99  const char* GetFileName() { return this->GetXYZFileName(); }
100  virtual void SetXYZFileName( const char* );
101  vtkGetStringMacro(XYZFileName);
103 
105 
106  vtkSetStringMacro(QFileName);
107  vtkGetStringMacro(QFileName);
109 
111 
117  int GetNumberOfBlocks();
118  int GetNumberOfGrids() { return this->GetNumberOfBlocks(); }
120 
122 
124  vtkSetMacro(BinaryFile, int);
125  vtkGetMacro(BinaryFile, int);
126  vtkBooleanMacro(BinaryFile, int);
128 
130 
133  vtkSetMacro(MultiGrid, int);
134  vtkGetMacro(MultiGrid, int);
135  vtkBooleanMacro(MultiGrid, int);
137 
139 
142  vtkSetMacro(HasByteCount, int);
143  vtkGetMacro(HasByteCount, int);
144  vtkBooleanMacro(HasByteCount, int);
146 
148 
151  vtkSetMacro(IBlanking, int);
152  vtkGetMacro(IBlanking, int);
153  vtkBooleanMacro(IBlanking, int);
155 
157 
158  vtkSetMacro(TwoDimensionalGeometry, int);
159  vtkGetMacro(TwoDimensionalGeometry, int);
160  vtkBooleanMacro(TwoDimensionalGeometry, int);
162 
164 
168  vtkSetMacro(ForceRead, int);
169  vtkGetMacro(ForceRead, int);
170  vtkBooleanMacro(ForceRead, int);
172 
174 
177  void SetByteOrderToBigEndian();
178  void SetByteOrderToLittleEndian();
179  vtkSetMacro(ByteOrder, int);
180  vtkGetMacro(ByteOrder, int);
181  const char *GetByteOrderAsString();
183 
185 
186  vtkSetMacro(R,double);
187  vtkGetMacro(R,double);
189 
191 
192  vtkSetMacro(Gamma,double);
193  vtkGetMacro(Gamma,double);
195 
197 
198  vtkSetMacro(Uvinf,double);
199  vtkGetMacro(Uvinf,double);
201 
203 
204  vtkSetMacro(Vvinf,double);
205  vtkGetMacro(Vvinf,double);
207 
209 
210  vtkSetMacro(Wvinf,double);
211  vtkGetMacro(Wvinf,double);
213 
215 
217  void SetScalarFunctionNumber(int num);
218  vtkGetMacro(ScalarFunctionNumber,int);
220 
222 
224  void SetVectorFunctionNumber(int num);
225  vtkGetMacro(VectorFunctionNumber,int);
227 
229 
232  void AddFunction(int functionNumber);
233  void RemoveFunction(int);
234  void RemoveAllFunctions();
236 
239  virtual int CanReadBinaryFile(const char* fname);
240 
241 //BTX
242  enum
243  {
244  FILE_BIG_ENDIAN=0,
245  FILE_LITTLE_ENDIAN=1
246  };
247 //ETX
248 
249 protected:
252 
253  int CheckFile(FILE*& fp, const char* fname);
254  int CheckGeometryFile(FILE*& xyzFp);
255  int CheckSolutionFile(FILE*& qFp);
256 
257  void SkipByteCount (FILE* fp);
258  int ReadIntBlock (FILE* fp, int n, int* block);
259  int ReadFloatBlock(FILE* fp, int n, float* block);
260 
261  int GetNumberOfBlocksInternal(FILE* xyzFp, int verify=1);
262 
263  int ReadGeometryHeader(FILE* fp);
264  int ReadQHeader(FILE* fp);
265 
266  void CalculateFileSize(FILE* fp);
267  long EstimateSize(int ni, int nj, int nk);
268 
269  void AssignAttribute(int fNumber, vtkStructuredGrid* output,
270  int attributeType);
271  void MapFunction(int fNumber, vtkStructuredGrid* output);
272  void ComputeTemperature(vtkStructuredGrid* output);
273  void ComputePressure(vtkStructuredGrid* output);
274  void ComputeEnthalpy(vtkStructuredGrid* output);
275  void ComputeKineticEnergy(vtkStructuredGrid* output);
276  void ComputeVelocityMagnitude(vtkStructuredGrid* output);
277  void ComputeEntropy(vtkStructuredGrid* output);
278  void ComputeSwirl(vtkStructuredGrid* output);
279  void ComputeVelocity(vtkStructuredGrid* output);
280  void ComputeVorticity(vtkStructuredGrid* output);
281  void ComputePressureGradient(vtkStructuredGrid* output);
282 
283  // Delete references to any existing vtkPoints and
284  // I-blank arrays. The next Update() will (re)read
285  // the XYZ file.
286  void ClearGeometryCache();
287 
288  //plot3d FileNames
289  char *XYZFileName;
290  char *QFileName;
291 
299 
300  long FileSize;
301 
302  //parameters used in computing derived functions
303  double R;
304  double Gamma;
305  double Uvinf;
306  double Vvinf;
307  double Wvinf;
308 
309  //functions to read that are not scalars or vectors
311 
314 
315  // Cache of geometry
318 
319  // First pass at automatically detecting configuration
320  int GenerateDefaultConfiguration();
321  int VerifySettings(char* buf, int bufSize);
322 
323  void ReadIntBlockV(char** buf, int n, int* block);
324  void SkipByteCountV(char** buf);
325 
327 
328  virtual int RequestData(vtkInformation*,
331  virtual int RequestInformation(vtkInformation*,
334 
335 private:
336 
337  vtkMultiBlockPLOT3DReaderInternals* Internal;
338 
339  vtkMultiBlockPLOT3DReader(const vtkMultiBlockPLOT3DReader&); // Not implemented.
340  void operator=(const vtkMultiBlockPLOT3DReader&); // Not implemented.
341 };
342 
343 #endif
344 
345