VTK  9.3.0
vtkMultiBlockPLOT3DReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
78#ifndef vtkMultiBlockPLOT3DReader_h
79#define vtkMultiBlockPLOT3DReader_h
80
81#include "vtkIOParallelModule.h" // For export macro
82#include "vtkParallelReader.h"
83#include <vector> // For holding function-names
84
85VTK_ABI_NAMESPACE_BEGIN
86class vtkDataArray;
88class vtkIntArray;
95VTK_ABI_NAMESPACE_END
96
97namespace Functors
98{
99VTK_ABI_NAMESPACE_BEGIN
100class ComputeFunctor;
101class ComputeTemperatureFunctor;
102class ComputePressureFunctor;
103class ComputePressureCoefficientFunctor;
104class ComputeMachNumberFunctor;
105class ComputeSoundSpeedFunctor;
106class ComputeEnthalpyFunctor;
107class ComputeKinecticEnergyFunctor;
108class ComputeVelocityMagnitudeFunctor;
109class ComputeEntropyFunctor;
110class ComputeSwirlFunctor;
111class ComputeVelocityFunctor;
112class ComputeVorticityMagnitudeFunctor;
113class ComputePressureGradientFunctor;
114class ComputeVorticityFunctor;
115class ComputeStrainRateFunctor;
116VTK_ABI_NAMESPACE_END
117}
118
119VTK_ABI_NAMESPACE_BEGIN
120
121class VTKIOPARALLEL_EXPORT vtkMultiBlockPLOT3DReader : public vtkParallelReader
122{
123 friend class Functors::ComputeFunctor;
124 friend class Functors::ComputeTemperatureFunctor;
125 friend class Functors::ComputePressureFunctor;
126 friend class Functors::ComputePressureCoefficientFunctor;
127 friend class Functors::ComputeMachNumberFunctor;
128 friend class Functors::ComputeSoundSpeedFunctor;
129 friend class Functors::ComputeEnthalpyFunctor;
130 friend class Functors::ComputeKinecticEnergyFunctor;
131 friend class Functors::ComputeVelocityMagnitudeFunctor;
132 friend class Functors::ComputeEntropyFunctor;
133 friend class Functors::ComputeSwirlFunctor;
134 friend class Functors::ComputeVelocityFunctor;
135 friend class Functors::ComputeVorticityMagnitudeFunctor;
136 friend class Functors::ComputePressureGradientFunctor;
137 friend class Functors::ComputeVorticityFunctor;
138 friend class Functors::ComputeStrainRateFunctor;
139
140public:
143 void PrintSelf(ostream& os, vtkIndent indent) override;
144
146
152
154
157 void SetFileName(VTK_FILEPATH const char* name) { this->SetXYZFileName(name); }
158 VTK_FILEPATH const char* GetFileName() { return this->GetXYZFileName(); }
159 VTK_FILEPATH const char* GetFileName(int i) { return this->vtkParallelReader::GetFileName(i); }
160 virtual void SetXYZFileName(VTK_FILEPATH const char*);
163
165
175 void SetQFileName(VTK_FILEPATH const char* name);
178
180
183 vtkSetFilePathMacro(FunctionFileName);
184 vtkGetFilePathMacro(FunctionFileName);
186
188
198 vtkSetMacro(AutoDetectFormat, vtkTypeBool);
199 vtkGetMacro(AutoDetectFormat, vtkTypeBool);
200 vtkBooleanMacro(AutoDetectFormat, vtkTypeBool);
202
204
208 vtkSetMacro(BinaryFile, vtkTypeBool);
209 vtkGetMacro(BinaryFile, vtkTypeBool);
210 vtkBooleanMacro(BinaryFile, vtkTypeBool);
212
214
220 vtkSetMacro(MultiGrid, vtkTypeBool);
221 vtkGetMacro(MultiGrid, vtkTypeBool);
222 vtkBooleanMacro(MultiGrid, vtkTypeBool);
224
226
231 vtkSetMacro(HasByteCount, vtkTypeBool);
232 vtkGetMacro(HasByteCount, vtkTypeBool);
233 vtkBooleanMacro(HasByteCount, vtkTypeBool);
235
237
242 vtkSetMacro(IBlanking, vtkTypeBool);
243 vtkGetMacro(IBlanking, vtkTypeBool);
244 vtkBooleanMacro(IBlanking, vtkTypeBool);
246
248
252 vtkSetMacro(TwoDimensionalGeometry, vtkTypeBool);
253 vtkGetMacro(TwoDimensionalGeometry, vtkTypeBool);
254 vtkBooleanMacro(TwoDimensionalGeometry, vtkTypeBool);
256
258
263 vtkSetMacro(DoublePrecision, vtkTypeBool);
264 vtkGetMacro(DoublePrecision, vtkTypeBool);
265 vtkBooleanMacro(DoublePrecision, vtkTypeBool);
267
269
275 vtkSetMacro(ForceRead, vtkTypeBool);
276 vtkGetMacro(ForceRead, vtkTypeBool);
277 vtkBooleanMacro(ForceRead, vtkTypeBool);
279
281
289 vtkSetMacro(ByteOrder, int);
290 vtkGetMacro(ByteOrder, int);
291 const char* GetByteOrderAsString();
293
295
298 vtkSetMacro(R, double);
299 vtkGetMacro(R, double);
301
303
306 vtkSetMacro(Gamma, double);
307 vtkGetMacro(Gamma, double);
309
311
319 vtkSetMacro(PreserveIntermediateFunctions, bool);
320 vtkGetMacro(PreserveIntermediateFunctions, bool);
321 vtkBooleanMacro(PreserveIntermediateFunctions, bool);
322
324
329 vtkGetMacro(ScalarFunctionNumber, int);
331
333
338 vtkGetMacro(VectorFunctionNumber, int);
340
342
347 void AddFunction(int functionNumber);
348 void RemoveFunction(int);
351
356 virtual int CanReadBinaryFile(VTK_FILEPATH const char* fname);
357
359
364 vtkGetObjectMacro(Controller, vtkMultiProcessController);
366
367 void AddFunctionName(const std::string& name) { FunctionNames.push_back(name); }
368
369 enum
370 {
371 FILE_BIG_ENDIAN = 0,
372 FILE_LITTLE_ENDIAN = 1
373 };
374
376
382 int ReadMetaData(vtkInformation* metadata) override;
383 int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
384 int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
385 int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
387
388protected:
391
393
396 double GetTimeValue(const std::string& fname) override;
398 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
400 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
402 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
404
406
407 int CheckFile(FILE*& fp, const char* fname);
408 int CheckGeometryFile(FILE*& xyzFp);
409 int CheckFunctionFile(FILE*& fFp);
410
412 int SkipByteCount(FILE* fp);
413 int ReadIntBlock(FILE* fp, int n, int* block);
414
415 vtkIdType ReadValues(FILE* fp, int n, vtkDataArray* scalar);
416 virtual int ReadIntScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
417 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
418 virtual int ReadScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
419 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
420 virtual int ReadVector(void* vfp, int extent[6], int wextent[6], int numDims,
421 vtkDataArray* vector, vtkTypeUInt64 offset,
422 const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
423 virtual int OpenFileForDataRead(void*& fp, const char* fname);
424 virtual void CloseFile(void* fp);
425
426 int GetNumberOfBlocksInternal(FILE* xyzFp, int allocate);
427
428 int ReadGeometryHeader(FILE* fp);
429 int ReadQHeader(FILE* fp, bool checkGrid, int& nq, int& nqc, int& overflow);
430 int ReadFunctionHeader(FILE* fp, int* nFunctions);
431
432 void CalculateFileSize(FILE* fp);
433
434 int AutoDetectionCheck(FILE* fp);
435
436 void AssignAttribute(int fNumber, vtkStructuredGrid* output, int attributeType);
437 void MapFunction(int fNumber, vtkStructuredGrid* output);
438
440
460
461 // Returns a vtkFloatArray or a vtkDoubleArray depending
462 // on DoublePrecision setting
464
465 // Delete references to any existing vtkPoints and
466 // I-blank arrays. The next Update() will (re)read
467 // the XYZ file.
469
470 double GetGamma(vtkIdType idx, vtkDataArray* gamma);
471
472 int FillOutputPortInformation(int port, vtkInformation* info) override;
473
474 // plot3d FileNames
487
489
490 size_t FileSize;
491
492 // parameters used in computing derived functions
493 double R;
494 double Gamma;
495 double GammaInf;
496
498
499 // named functions from meta data
500 std::vector<std::string> FunctionNames;
501
502 // functions to read that are not scalars or vectors
504
507
509
511
512private:
514 void operator=(const vtkMultiBlockPLOT3DReader&) = delete;
515
516 // Key used to flag intermediate results.
517 static vtkInformationIntegerKey* INTERMEDIATE_RESULT();
518
522 void RemoveIntermediateFunctions(vtkDataSetAttributes* dsa);
523};
524
525VTK_ABI_NAMESPACE_END
526#endif
abstract superclass for arrays of numeric data
general representation of visualization data
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition vtkIndent.h:29
Key for integer values in vtkInformation.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:35
Composite dataset that organizes datasets into blocks.
virtual int OpenFileForDataRead(void *&fp, const char *fname)
vtkDataArray * ComputeVelocity(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
int ReadFunctionHeader(FILE *fp, int *nFunctions)
void SetByteOrderToLittleEndian()
Set the byte order of the file (remember, more Unix workstations write big endian whereas PCs write l...
VTK_FILEPATH const char * GetFileName()
Set/Get the PLOT3D geometry filename.
vtkGetFilePathMacro(FunctionFileName)
Set/Get the PLOT3D function filename.
vtkDataArray * ComputeEntropy(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
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...
static vtkMultiBlockPLOT3DReader * New()
vtkIdType ReadValues(FILE *fp, int n, vtkDataArray *scalar)
vtkDataArray * ComputeKineticEnergy(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
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 * ComputePressureGradient(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.
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.
void CalculateFileSize(FILE *fp)
vtkDataArray * ComputePressureCoefficient(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
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)
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 * ComputeEnthalpy(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * ComputeSoundSpeed(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
double GetTimeValue(const std::string &fname) override
Overridden from superclass to do actual reading.
vtkDataArray * ComputeSwirl(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
~vtkMultiBlockPLOT3DReader() override
vtkDataArray * ComputeVelocityMagnitude(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
virtual int ReadScalar(void *vfp, int extent[6], int wextent[6], vtkDataArray *scalar, vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord &currentRecord)
double GetGamma(vtkIdType idx, vtkDataArray *gamma)
VTK_FILEPATH const char * GetFileName(int i)
Set/Get the PLOT3D geometry filename.
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...
VTK_FILEPATH const char * GetQFileName()
Set/Get the PLOT3D solution filename.
std::vector< std::string > FunctionNames
void AddFunction(int functionNumber)
Specify additional functions to read.
void RemoveFunction(int)
Specify additional functions to read.
vtkDataArray * ComputeTemperature(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkSetFilePathMacro(FunctionFileName)
Set/Get the PLOT3D function filename.
int CheckFile(FILE *&fp, const char *fname)
vtkDataArray * NewFloatArray()
void SetScalarFunctionNumber(int num)
Specify the scalar function to extract.
vtkDataArray * ComputeVorticity(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * ComputeVorticityMagnitude(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkMultiBlockDataSet * GetOutput(int)
Get the output data object for a port on this algorithm.
int ReadGeometryHeader(FILE *fp)
void MapFunction(int fNumber, vtkStructuredGrid *output)
int SkipByteCount(FILE *fp)
vtkDataArray * CreateFloatArray()
void SetFileName(VTK_FILEPATH const char *name)
Set/Get the PLOT3D geometry filename.
const char * GetByteOrderAsString()
Set the byte order of the file (remember, more Unix workstations write big endian whereas PCs write l...
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...
vtkDataArray * ComputePressure(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
vtkDataArray * ComputeMachNumber(vtkStructuredGrid *output)
Each of these methods compute a derived quantity.
void AddFunctionName(const std::string &name)
int GetNumberOfBlocksInternal(FILE *xyzFp, int allocate)
vtkDataArray * ComputeStrainRate(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.
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
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315
#define VTK_FILEPATH