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 =========================================================================*/
92 #ifndef vtkMultiBlockPLOT3DReader_h
93 #define vtkMultiBlockPLOT3DReader_h
94 
95 #include "vtkIOParallelModule.h" // For export macro
97 
98 class vtkDataArray;
100 class vtkIntArray;
101 class vtkStructuredGrid;
105 
106 class VTKIOPARALLEL_EXPORT vtkMultiBlockPLOT3DReader : public vtkMultiBlockDataSetAlgorithm
107 {
108 public:
109  static vtkMultiBlockPLOT3DReader *New();
111  void PrintSelf(ostream& os, vtkIndent indent);
112 
114 
117  void SetFileName(const char* name) { this->SetXYZFileName(name); }
118  const char* GetFileName() { return this->GetXYZFileName(); }
119  virtual void SetXYZFileName( const char* );
120  vtkGetStringMacro(XYZFileName);
122 
124 
127  vtkSetStringMacro(QFileName);
128  vtkGetStringMacro(QFileName);
130 
132 
135  vtkSetStringMacro(FunctionFileName);
136  vtkGetStringMacro(FunctionFileName);
138 
140 
150  vtkSetMacro(AutoDetectFormat, int);
151  vtkGetMacro(AutoDetectFormat, int);
152  vtkBooleanMacro(AutoDetectFormat, int);
154 
156 
160  vtkSetMacro(BinaryFile, int);
161  vtkGetMacro(BinaryFile, int);
162  vtkBooleanMacro(BinaryFile, int);
164 
166 
172  vtkSetMacro(MultiGrid, int);
173  vtkGetMacro(MultiGrid, int);
174  vtkBooleanMacro(MultiGrid, int);
176 
178 
183  vtkSetMacro(HasByteCount, int);
184  vtkGetMacro(HasByteCount, int);
185  vtkBooleanMacro(HasByteCount, int);
187 
189 
194  vtkSetMacro(IBlanking, int);
195  vtkGetMacro(IBlanking, int);
196  vtkBooleanMacro(IBlanking, int);
198 
200 
204  vtkSetMacro(TwoDimensionalGeometry, int);
205  vtkGetMacro(TwoDimensionalGeometry, int);
206  vtkBooleanMacro(TwoDimensionalGeometry, int);
208 
210 
215  vtkSetMacro(DoublePrecision, int);
216  vtkGetMacro(DoublePrecision, int);
217  vtkBooleanMacro(DoublePrecision, int);
219 
221 
227  vtkSetMacro(ForceRead, int);
228  vtkGetMacro(ForceRead, int);
229  vtkBooleanMacro(ForceRead, int);
231 
233 
239  void SetByteOrderToBigEndian();
240  void SetByteOrderToLittleEndian();
241  vtkSetMacro(ByteOrder, int);
242  vtkGetMacro(ByteOrder, int);
243  const char *GetByteOrderAsString();
245 
247 
250  vtkSetMacro(R,double);
251  vtkGetMacro(R,double);
253 
255 
258  vtkSetMacro(Gamma,double);
259  vtkGetMacro(Gamma,double);
261 
263 
267  void SetScalarFunctionNumber(int num);
268  vtkGetMacro(ScalarFunctionNumber,int);
270 
272 
276  void SetVectorFunctionNumber(int num);
277  vtkGetMacro(VectorFunctionNumber,int);
279 
281 
286  void AddFunction(int functionNumber);
287  void RemoveFunction(int);
288  void RemoveAllFunctions();
290 
295  virtual int CanReadBinaryFile(const char* fname);
296 
298 
302  void SetController(vtkMultiProcessController *c);
303  vtkGetObjectMacro(Controller, vtkMultiProcessController);
305 
306  enum
307  {
308  FILE_BIG_ENDIAN=0,
309  FILE_LITTLE_ENDIAN=1
310  };
311 
312 protected:
315 
316  vtkDataArray* CreateFloatArray();
317 
318  int CheckFile(FILE*& fp, const char* fname);
319  int CheckGeometryFile(FILE*& xyzFp);
320  int CheckSolutionFile(FILE*& qFp);
321  int CheckFunctionFile(FILE*& fFp);
322 
323  int GetByteCountSize();
324  int SkipByteCount (FILE* fp);
325  int ReadIntBlock (FILE* fp, int n, int* block);
326 
327  vtkIdType ReadValues(
328  FILE* fp,
329  int n,
330  vtkDataArray* scalar);
331  virtual int ReadIntScalar(
332  void* vfp,
333  int extent[6], int wextent[6],
334  vtkDataArray* scalar, vtkTypeUInt64 offset,
335  const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
336  virtual int ReadScalar(
337  void* vfp,
338  int extent[6], int wextent[6],
339  vtkDataArray* scalar, vtkTypeUInt64 offset,
340  const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
341  virtual int ReadVector(
342  void* vfp,
343  int extent[6], int wextent[6],
344  int numDims, vtkDataArray* vector, vtkTypeUInt64 offset,
345  const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
346  virtual int OpenFileForDataRead(void*& fp, const char* fname);
347  virtual void CloseFile(void* fp);
348 
349  int GetNumberOfBlocksInternal(FILE* xyzFp, int allocate);
350 
351  int ReadGeometryHeader(FILE* fp);
352  int ReadQHeader(FILE* fp, bool checkGrid, int& nq, int& nqc, int& overflow);
353  int ReadFunctionHeader(FILE* fp, int* nFunctions);
354 
355  void CalculateFileSize(FILE* fp);
356 
357  int AutoDetectionCheck(FILE* fp);
358 
359  void AssignAttribute(int fNumber, vtkStructuredGrid* output,
360  int attributeType);
361  void MapFunction(int fNumber, vtkStructuredGrid* output);
362  void ComputeTemperature(vtkStructuredGrid* output);
363  void ComputePressure(vtkStructuredGrid* output);
364  void ComputeEnthalpy(vtkStructuredGrid* output);
365  void ComputeKineticEnergy(vtkStructuredGrid* output);
366  void ComputeVelocityMagnitude(vtkStructuredGrid* output);
367  void ComputeEntropy(vtkStructuredGrid* output);
368  void ComputeSwirl(vtkStructuredGrid* output);
369  void ComputeVelocity(vtkStructuredGrid* output);
370  void ComputeVorticity(vtkStructuredGrid* output);
371  void ComputePressureGradient(vtkStructuredGrid* output);
372  void ComputePressureCoefficient(vtkStructuredGrid* output);
373  void ComputeMachNumber(vtkStructuredGrid* output);
374  void ComputeSoundSpeed(vtkStructuredGrid* output);
375  void ComputeVorticityMagnitude(vtkStructuredGrid* output);
376  void ComputeStrainRate(vtkStructuredGrid* output);
377 
378  // Returns a vtkFloatArray or a vtkDoubleArray depending
379  // on DoublePrecision setting
380  vtkDataArray* NewFloatArray();
381 
382  // Delete references to any existing vtkPoints and
383  // I-blank arrays. The next Update() will (re)read
384  // the XYZ file.
385  void ClearGeometryCache();
386 
387  //plot3d FileNames
388  char *XYZFileName;
389  char *QFileName;
391 
401 
403 
404  size_t FileSize;
405 
406  //parameters used in computing derived functions
407  double R;
408  double Gamma;
409  double Uvinf;
410  double Vvinf;
411  double Wvinf;
412 
413  //functions to read that are not scalars or vectors
415 
418 
420 
421  virtual int RequestData(vtkInformation*,
424  virtual int RequestInformation(vtkInformation*,
427 
429 
431 
432 private:
433  vtkMultiBlockPLOT3DReader(const vtkMultiBlockPLOT3DReader&) VTK_DELETE_FUNCTION;
434  void operator=(const vtkMultiBlockPLOT3DReader&) VTK_DELETE_FUNCTION;
435 };
436 
437 #endif
void SetFileName(const char *name)
Set/Get the PLOT3D geometry filename.
Store vtkAlgorithm input/output information.
vtkMultiProcessController * Controller
int vtkIdType
Definition: vtkType.h:287
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
static vtkMultiBlockDataSetAlgorithm * New()
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkMultiBlockPLOT3DReaderInternals * Internal
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
dynamic, self-adjusting array of unsigned char
topologically regular array of data
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
const char * GetFileName()
Set/Get the PLOT3D geometry filename.
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Multiprocessing communication superclass.