VTK  9.2.6
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 =========================================================================*/
99 #ifndef vtkMultiBlockPLOT3DReader_h
100 #define vtkMultiBlockPLOT3DReader_h
101 
102 #include "vtkIOParallelModule.h" // For export macro
103 #include "vtkParallelReader.h"
104 #include <vector> // For holding function-names
105 
106 class vtkDataArray;
108 class vtkIntArray;
111 class vtkStructuredGrid;
115 
116 namespace Functors
117 {
118 class ComputeFunctor;
119 class ComputeTemperatureFunctor;
120 class ComputePressureFunctor;
121 class ComputePressureCoefficientFunctor;
122 class ComputeMachNumberFunctor;
123 class ComputeSoundSpeedFunctor;
124 class ComputeEnthalpyFunctor;
125 class ComputeKinecticEnergyFunctor;
126 class ComputeVelocityMagnitudeFunctor;
127 class ComputeEntropyFunctor;
128 class ComputeSwirlFunctor;
129 class ComputeVelocityFunctor;
130 class ComputeVorticityMagnitudeFunctor;
131 class ComputePressureGradientFunctor;
132 class ComputeVorticityFunctor;
133 class ComputeStrainRateFunctor;
134 }
135 
136 class VTKIOPARALLEL_EXPORT vtkMultiBlockPLOT3DReader : public vtkParallelReader
137 {
138  friend class Functors::ComputeFunctor;
139  friend class Functors::ComputeTemperatureFunctor;
140  friend class Functors::ComputePressureFunctor;
141  friend class Functors::ComputePressureCoefficientFunctor;
142  friend class Functors::ComputeMachNumberFunctor;
143  friend class Functors::ComputeSoundSpeedFunctor;
144  friend class Functors::ComputeEnthalpyFunctor;
145  friend class Functors::ComputeKinecticEnergyFunctor;
146  friend class Functors::ComputeVelocityMagnitudeFunctor;
147  friend class Functors::ComputeEntropyFunctor;
148  friend class Functors::ComputeSwirlFunctor;
149  friend class Functors::ComputeVelocityFunctor;
150  friend class Functors::ComputeVorticityMagnitudeFunctor;
151  friend class Functors::ComputePressureGradientFunctor;
152  friend class Functors::ComputeVorticityFunctor;
153  friend class Functors::ComputeStrainRateFunctor;
154 
155 public:
158  void PrintSelf(ostream& os, vtkIndent indent) override;
159 
161 
167 
169 
172  void SetFileName(VTK_FILEPATH const char* name) { this->SetXYZFileName(name); }
173  VTK_FILEPATH const char* GetFileName() { return this->GetXYZFileName(); }
174  VTK_FILEPATH const char* GetFileName(int i) { return this->vtkParallelReader::GetFileName(i); }
175  virtual void SetXYZFileName(VTK_FILEPATH const char*);
176  vtkGetFilePathMacro(XYZFileName);
178 
180 
190  void SetQFileName(VTK_FILEPATH const char* name);
191  VTK_FILEPATH const char* GetQFileName();
193 
195 
198  vtkSetFilePathMacro(FunctionFileName);
199  vtkGetFilePathMacro(FunctionFileName);
201 
203 
213  vtkSetMacro(AutoDetectFormat, vtkTypeBool);
214  vtkGetMacro(AutoDetectFormat, vtkTypeBool);
215  vtkBooleanMacro(AutoDetectFormat, vtkTypeBool);
217 
219 
223  vtkSetMacro(BinaryFile, vtkTypeBool);
224  vtkGetMacro(BinaryFile, vtkTypeBool);
225  vtkBooleanMacro(BinaryFile, vtkTypeBool);
227 
229 
235  vtkSetMacro(MultiGrid, vtkTypeBool);
236  vtkGetMacro(MultiGrid, vtkTypeBool);
237  vtkBooleanMacro(MultiGrid, vtkTypeBool);
239 
241 
246  vtkSetMacro(HasByteCount, vtkTypeBool);
247  vtkGetMacro(HasByteCount, vtkTypeBool);
248  vtkBooleanMacro(HasByteCount, vtkTypeBool);
250 
252 
257  vtkSetMacro(IBlanking, vtkTypeBool);
258  vtkGetMacro(IBlanking, vtkTypeBool);
259  vtkBooleanMacro(IBlanking, vtkTypeBool);
261 
263 
267  vtkSetMacro(TwoDimensionalGeometry, vtkTypeBool);
268  vtkGetMacro(TwoDimensionalGeometry, vtkTypeBool);
269  vtkBooleanMacro(TwoDimensionalGeometry, vtkTypeBool);
271 
273 
278  vtkSetMacro(DoublePrecision, vtkTypeBool);
279  vtkGetMacro(DoublePrecision, vtkTypeBool);
280  vtkBooleanMacro(DoublePrecision, vtkTypeBool);
282 
284 
290  vtkSetMacro(ForceRead, vtkTypeBool);
291  vtkGetMacro(ForceRead, vtkTypeBool);
292  vtkBooleanMacro(ForceRead, vtkTypeBool);
294 
296 
304  vtkSetMacro(ByteOrder, int);
305  vtkGetMacro(ByteOrder, int);
306  const char* GetByteOrderAsString();
308 
310 
313  vtkSetMacro(R, double);
314  vtkGetMacro(R, double);
316 
318 
321  vtkSetMacro(Gamma, double);
322  vtkGetMacro(Gamma, double);
324 
326 
334  vtkSetMacro(PreserveIntermediateFunctions, bool);
335  vtkGetMacro(PreserveIntermediateFunctions, bool);
336  vtkBooleanMacro(PreserveIntermediateFunctions, bool);
337 
339 
343  void SetScalarFunctionNumber(int num);
344  vtkGetMacro(ScalarFunctionNumber, int);
346 
348 
352  void SetVectorFunctionNumber(int num);
353  vtkGetMacro(VectorFunctionNumber, int);
355 
357 
362  void AddFunction(int functionNumber);
363  void RemoveFunction(int);
366 
371  virtual int CanReadBinaryFile(VTK_FILEPATH const char* fname);
372 
374 
379  vtkGetObjectMacro(Controller, vtkMultiProcessController);
381 
382  void AddFunctionName(const std::string& name) { FunctionNames.push_back(name); }
383 
384  enum
385  {
386  FILE_BIG_ENDIAN = 0,
387  FILE_LITTLE_ENDIAN = 1
388  };
389 
391 
397  int ReadMetaData(vtkInformation* metadata) override;
398  int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
399  int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
400  int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
402 
403 protected:
406 
408 
411  double GetTimeValue(const std::string& fname) override;
412  int ReadMesh(
413  const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
415  const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
417  const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
419 
421 
422  int CheckFile(FILE*& fp, const char* fname);
423  int CheckGeometryFile(FILE*& xyzFp);
424  int CheckFunctionFile(FILE*& fFp);
425 
427  int SkipByteCount(FILE* fp);
428  int ReadIntBlock(FILE* fp, int n, int* block);
429 
430  vtkIdType ReadValues(FILE* fp, int n, vtkDataArray* scalar);
431  virtual int ReadIntScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
432  vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
433  virtual int ReadScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
434  vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
435  virtual int ReadVector(void* vfp, int extent[6], int wextent[6], int numDims,
436  vtkDataArray* vector, vtkTypeUInt64 offset,
437  const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
438  virtual int OpenFileForDataRead(void*& fp, const char* fname);
439  virtual void CloseFile(void* fp);
440 
441  int GetNumberOfBlocksInternal(FILE* xyzFp, int allocate);
442 
443  int ReadGeometryHeader(FILE* fp);
444  int ReadQHeader(FILE* fp, bool checkGrid, int& nq, int& nqc, int& overflow);
445  int ReadFunctionHeader(FILE* fp, int* nFunctions);
446 
447  void CalculateFileSize(FILE* fp);
448 
449  int AutoDetectionCheck(FILE* fp);
450 
451  void AssignAttribute(int fNumber, vtkStructuredGrid* output, int attributeType);
452  void MapFunction(int fNumber, vtkStructuredGrid* output);
453 
455 
475 
476  // Returns a vtkFloatArray or a vtkDoubleArray depending
477  // on DoublePrecision setting
479 
480  // Delete references to any existing vtkPoints and
481  // I-blank arrays. The next Update() will (re)read
482  // the XYZ file.
484 
485  double GetGamma(vtkIdType idx, vtkDataArray* gamma);
486 
488 
489  // plot3d FileNames
490  char* XYZFileName;
491  char* QFileName;
502 
504 
505  size_t FileSize;
506 
507  // parameters used in computing derived functions
508  double R;
509  double Gamma;
510  double GammaInf;
511 
513 
514  // named functions from meta data
515  std::vector<std::string> FunctionNames;
516 
517  // functions to read that are not scalars or vectors
519 
522 
524 
526 
527 private:
529  void operator=(const vtkMultiBlockPLOT3DReader&) = delete;
530 
531  // Key used to flag intermediate results.
532  static vtkInformationIntegerKey* INTERMEDIATE_RESULT();
533 
537  void RemoveIntermediateFunctions(vtkDataSetAttributes* dsa);
538 };
539 
540 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:65
general representation of visualization data
Definition: vtkDataObject.h:75
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition: vtkIndent.h:49
Key for integer values in vtkInformation.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:55
Composite dataset that organizes datasets into blocks.
virtual int OpenFileForDataRead(void *&fp, const char *fname)
vtkDataArray * ComputeSoundSpeed(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * NewFloatArray()
int ReadFunctionHeader(FILE *fp, int *nFunctions)
const char * GetByteOrderAsString()
Set the byte order of the file (remember, more Unix workstations write big endian whereas PCs write l...
void SetByteOrderToLittleEndian()
Set the byte order of the file (remember, more Unix workstations write big endian whereas PCs write l...
VTK_FILEPATH const char * GetQFileName()
Set/Get the PLOT3D solution filename.
vtkGetFilePathMacro(FunctionFileName)
Set/Get the PLOT3D function filename.
int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject *output) override
These methods have to be overwritten from superclass because Plot3D actually uses the XYZ file to rea...
vtkIdType ReadValues(FILE *fp, int n, vtkDataArray *scalar)
virtual int CanReadBinaryFile(VTK_FILEPATH const char *fname)
Return 1 if the reader can read the given file name.
vtkMultiBlockDataSet * GetOutput()
Get the output data object for a port on this algorithm.
vtkDataArray * ComputeStrainRate(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject *output) override
These methods have to be overwritten from superclass because Plot3D actually uses the XYZ file to rea...
void SetVectorFunctionNumber(int num)
Specify the vector function to extract.
vtkDataArray * ComputeEnthalpy(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
int ReadArrays(const std::string &fname, int piece, int npieces, int nghosts, vtkDataObject *output) override
Overridden from superclass to do actual reading.
virtual void SetXYZFileName(VTK_FILEPATH const char *)
Set/Get the PLOT3D geometry filename.
vtkDataArray * ComputeVelocity(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * ComputeVorticity(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * ComputeSwirl(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * ComputeMachNumber(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * ComputeKineticEnergy(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
void CalculateFileSize(FILE *fp)
virtual int ReadVector(void *vfp, int extent[6], int wextent[6], int numDims, vtkDataArray *vector, vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord &currentRecord)
int ReadQHeader(FILE *fp, bool checkGrid, int &nq, int &nqc, int &overflow)
virtual void CloseFile(void *fp)
virtual int ReadIntScalar(void *vfp, int extent[6], int wextent[6], vtkDataArray *scalar, vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord &currentRecord)
int ReadMesh(const std::string &fname, int piece, int npieces, int nghosts, vtkDataObject *output) override
Overridden from superclass to do actual reading.
int CheckFunctionFile(FILE *&fFp)
vtkDataArray * ComputeVelocityMagnitude(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
int ReadPoints(const std::string &fname, int piece, int npieces, int nghosts, vtkDataObject *output) override
Overridden from superclass to do actual reading.
int CheckGeometryFile(FILE *&xyzFp)
int AutoDetectionCheck(FILE *fp)
vtkMultiProcessController * Controller
void SetQFileName(VTK_FILEPATH const char *name)
Set/Get the PLOT3D solution filename.
void RemoveAllFunctions()
Specify additional functions to read.
int ReadIntBlock(FILE *fp, int n, int *block)
vtkDataArray * CreateFloatArray()
vtkDataArray * ComputeTemperature(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
double GetTimeValue(const std::string &fname) override
Overridden from superclass to do actual reading.
~vtkMultiBlockPLOT3DReader() override
virtual int ReadScalar(void *vfp, int extent[6], int wextent[6], vtkDataArray *scalar, vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord &currentRecord)
double GetGamma(vtkIdType idx, vtkDataArray *gamma)
int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject *output) override
These methods have to be overwritten from superclass because Plot3D actually uses the XYZ file to rea...
void SetByteOrderToBigEndian()
Set the byte order of the file (remember, more Unix workstations write big endian whereas PCs write l...
std::vector< std::string > FunctionNames
vtkDataArray * ComputePressure(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * ComputeVorticityMagnitude(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
void AddFunction(int functionNumber)
Specify additional functions to read.
VTK_FILEPATH const char * GetFileName()
Set/Get the PLOT3D geometry filename.
void RemoveFunction(int)
Specify additional functions to read.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkDataArray * ComputeEntropy(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkSetFilePathMacro(FunctionFileName)
Set/Get the PLOT3D function filename.
int CheckFile(FILE *&fp, const char *fname)
void SetScalarFunctionNumber(int num)
Specify the scalar function to extract.
int ReadGeometryHeader(FILE *fp)
void MapFunction(int fNumber, vtkStructuredGrid *output)
vtkDataArray * ComputePressureGradient(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
int SkipByteCount(FILE *fp)
void SetFileName(VTK_FILEPATH const char *name)
Set/Get the PLOT3D geometry filename.
void AssignAttribute(int fNumber, vtkStructuredGrid *output, int attributeType)
vtkMultiBlockPLOT3DReaderInternals * Internal
int ReadMetaData(vtkInformation *metadata) override
These methods have to be overwritten from superclass because Plot3D actually uses the XYZ file to rea...
void AddFunctionName(const std::string &name)
static vtkMultiBlockPLOT3DReader * New()
vtkMultiBlockDataSet * GetOutput(int)
Get the output data object for a port on this algorithm.
int GetNumberOfBlocksInternal(FILE *xyzFp, int allocate)
vtkDataArray * ComputePressureCoefficient(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
VTK_FILEPATH const char * GetFileName(int i)
Set/Get the PLOT3D geometry filename.
vtkGetFilePathMacro(XYZFileName)
Set/Get the PLOT3D geometry filename.
void SetController(vtkMultiProcessController *c)
Set/Get the communicator object (we'll use global World controller if you don't set a different one).
Multiprocessing communication superclass.
Superclass for algorithms that are parallel aware.
VTK_FILEPATH const char * GetFileName(int i) const
Returns a particular filename stored by the reader.
topologically regular array of data
dynamic, self-adjusting array of unsigned char
@ vector
Definition: vtkX3D.h:243
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ extent
Definition: vtkX3D.h:351
@ name
Definition: vtkX3D.h:225
@ offset
Definition: vtkX3D.h:444
@ string
Definition: vtkX3D.h:496
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH