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=========================================================================*/
90#ifndef vtkMultiBlockPLOT3DReader_h
91#define vtkMultiBlockPLOT3DReader_h
92
93#include "vtkIOParallelModule.h" // For export macro
94#include "vtkParallelReader.h"
95#include <vector> // For holding function-names
96
97class vtkDataArray;
99class vtkIntArray;
106
107namespace Functors
108{
109class ComputeFunctor;
110class ComputeTemperatureFunctor;
111class ComputePressureFunctor;
112class ComputePressureCoefficientFunctor;
113class ComputeMachNumberFunctor;
114class ComputeSoundSpeedFunctor;
115class ComputeEnthalpyFunctor;
116class ComputeKinecticEnergyFunctor;
117class ComputeVelocityMagnitudeFunctor;
118class ComputeEntropyFunctor;
119class ComputeSwirlFunctor;
120class ComputeVelocityFunctor;
121class ComputeVorticityMagnitudeFunctor;
122class ComputePressureGradientFunctor;
123class ComputeVorticityFunctor;
124class ComputeStrainRateFunctor;
125}
126
127class VTKIOPARALLEL_EXPORT vtkMultiBlockPLOT3DReader : public vtkParallelReader
128{
129 friend class Functors::ComputeFunctor;
130 friend class Functors::ComputeTemperatureFunctor;
131 friend class Functors::ComputePressureFunctor;
132 friend class Functors::ComputePressureCoefficientFunctor;
133 friend class Functors::ComputeMachNumberFunctor;
134 friend class Functors::ComputeSoundSpeedFunctor;
135 friend class Functors::ComputeEnthalpyFunctor;
136 friend class Functors::ComputeKinecticEnergyFunctor;
137 friend class Functors::ComputeVelocityMagnitudeFunctor;
138 friend class Functors::ComputeEntropyFunctor;
139 friend class Functors::ComputeSwirlFunctor;
140 friend class Functors::ComputeVelocityFunctor;
141 friend class Functors::ComputeVorticityMagnitudeFunctor;
142 friend class Functors::ComputePressureGradientFunctor;
143 friend class Functors::ComputeVorticityFunctor;
144 friend class Functors::ComputeStrainRateFunctor;
145
146public:
149 void PrintSelf(ostream& os, vtkIndent indent) override;
150
152
158
160
163 void SetFileName(VTK_FILEPATH const char* name) { this->SetXYZFileName(name); }
164 VTK_FILEPATH const char* GetFileName() { return this->GetXYZFileName(); }
165 VTK_FILEPATH const char* GetFileName(int i) { return this->vtkParallelReader::GetFileName(i); }
166 virtual void SetXYZFileName(VTK_FILEPATH const char*);
169
171
181 void SetQFileName(VTK_FILEPATH const char* name);
184
186
189 vtkSetFilePathMacro(FunctionFileName);
190 vtkGetFilePathMacro(FunctionFileName);
192
194
204 vtkSetMacro(AutoDetectFormat, vtkTypeBool);
205 vtkGetMacro(AutoDetectFormat, vtkTypeBool);
206 vtkBooleanMacro(AutoDetectFormat, vtkTypeBool);
208
210
214 vtkSetMacro(BinaryFile, vtkTypeBool);
215 vtkGetMacro(BinaryFile, vtkTypeBool);
216 vtkBooleanMacro(BinaryFile, vtkTypeBool);
218
220
226 vtkSetMacro(MultiGrid, vtkTypeBool);
227 vtkGetMacro(MultiGrid, vtkTypeBool);
228 vtkBooleanMacro(MultiGrid, vtkTypeBool);
230
232
237 vtkSetMacro(HasByteCount, vtkTypeBool);
238 vtkGetMacro(HasByteCount, vtkTypeBool);
239 vtkBooleanMacro(HasByteCount, vtkTypeBool);
241
243
248 vtkSetMacro(IBlanking, vtkTypeBool);
249 vtkGetMacro(IBlanking, vtkTypeBool);
250 vtkBooleanMacro(IBlanking, vtkTypeBool);
252
254
258 vtkSetMacro(TwoDimensionalGeometry, vtkTypeBool);
259 vtkGetMacro(TwoDimensionalGeometry, vtkTypeBool);
260 vtkBooleanMacro(TwoDimensionalGeometry, vtkTypeBool);
262
264
269 vtkSetMacro(DoublePrecision, vtkTypeBool);
270 vtkGetMacro(DoublePrecision, vtkTypeBool);
271 vtkBooleanMacro(DoublePrecision, vtkTypeBool);
273
275
281 vtkSetMacro(ForceRead, vtkTypeBool);
282 vtkGetMacro(ForceRead, vtkTypeBool);
283 vtkBooleanMacro(ForceRead, vtkTypeBool);
285
287
295 vtkSetMacro(ByteOrder, int);
296 vtkGetMacro(ByteOrder, int);
297 const char* GetByteOrderAsString();
299
301
304 vtkSetMacro(R, double);
305 vtkGetMacro(R, double);
307
309
312 vtkSetMacro(Gamma, double);
313 vtkGetMacro(Gamma, double);
315
317
325 vtkSetMacro(PreserveIntermediateFunctions, bool);
326 vtkGetMacro(PreserveIntermediateFunctions, bool);
327 vtkBooleanMacro(PreserveIntermediateFunctions, bool);
328
330
335 vtkGetMacro(ScalarFunctionNumber, int);
337
339
344 vtkGetMacro(VectorFunctionNumber, int);
346
348
353 void AddFunction(int functionNumber);
354 void RemoveFunction(int);
357
362 virtual int CanReadBinaryFile(VTK_FILEPATH const char* fname);
363
365
370 vtkGetObjectMacro(Controller, vtkMultiProcessController);
372
373 void AddFunctionName(const std::string& name) { FunctionNames.push_back(name); }
374
375 enum
376 {
377 FILE_BIG_ENDIAN = 0,
378 FILE_LITTLE_ENDIAN = 1
379 };
380
382
388 int ReadMetaData(vtkInformation* metadata) override;
389 int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
390 int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
391 int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
393
394protected:
397
399
402 double GetTimeValue(const std::string& fname) override;
404 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
406 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
408 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
410
412
413 int CheckFile(FILE*& fp, const char* fname);
414 int CheckGeometryFile(FILE*& xyzFp);
415 int CheckFunctionFile(FILE*& fFp);
416
418 int SkipByteCount(FILE* fp);
419 int ReadIntBlock(FILE* fp, int n, int* block);
420
421 vtkIdType ReadValues(FILE* fp, int n, vtkDataArray* scalar);
422 virtual int ReadIntScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
423 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
424 virtual int ReadScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
425 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
426 virtual int ReadVector(void* vfp, int extent[6], int wextent[6], int numDims,
427 vtkDataArray* vector, vtkTypeUInt64 offset,
428 const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
429 virtual int OpenFileForDataRead(void*& fp, const char* fname);
430 virtual void CloseFile(void* fp);
431
432 int GetNumberOfBlocksInternal(FILE* xyzFp, int allocate);
433
434 int ReadGeometryHeader(FILE* fp);
435 int ReadQHeader(FILE* fp, bool checkGrid, int& nq, int& nqc, int& overflow);
436 int ReadFunctionHeader(FILE* fp, int* nFunctions);
437
438 void CalculateFileSize(FILE* fp);
439
440 int AutoDetectionCheck(FILE* fp);
441
442 void AssignAttribute(int fNumber, vtkStructuredGrid* output, int attributeType);
443 void MapFunction(int fNumber, vtkStructuredGrid* output);
444
446
466
467 // Returns a vtkFloatArray or a vtkDoubleArray depending
468 // on DoublePrecision setting
470
471 // Delete references to any existing vtkPoints and
472 // I-blank arrays. The next Update() will (re)read
473 // the XYZ file.
475
476 double GetGamma(vtkIdType idx, vtkDataArray* gamma);
477
478 int FillOutputPortInformation(int port, vtkInformation* info) override;
479
480 // plot3d FileNames
493
495
496 size_t FileSize;
497
498 // parameters used in computing derived functions
499 double R;
500 double Gamma;
501 double GammaInf;
502
504
505 // named functions from meta data
506 std::vector<std::string> FunctionNames;
507
508 // functions to read that are not scalars or vectors
510
513
515
517
518private:
520 void operator=(const vtkMultiBlockPLOT3DReader&) = delete;
521
522 // Key used to flag intermediate results.
523 static vtkInformationIntegerKey* INTERMEDIATE_RESULT();
524
528 void RemoveIntermediateFunctions(vtkDataSetAttributes* dsa);
529};
530
531#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:56
general representation of visualization data
Definition: vtkDataObject.h:66
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition: vtkIndent.h:40
Key for integer values in vtkInformation.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
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:69
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH