VTK  9.1.0
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=========================================================================*/
96#ifndef vtkMultiBlockPLOT3DReader_h
97#define vtkMultiBlockPLOT3DReader_h
98
99#include "vtkIOParallelModule.h" // For export macro
100#include "vtkParallelReader.h"
101#include <vector> // For holding function-names
102
103class vtkDataArray;
105class vtkIntArray;
112
113namespace Functors
114{
115class ComputeFunctor;
116class ComputeTemperatureFunctor;
117class ComputePressureFunctor;
118class ComputePressureCoefficientFunctor;
119class ComputeMachNumberFunctor;
120class ComputeSoundSpeedFunctor;
121class ComputeEnthalpyFunctor;
122class ComputeKinecticEnergyFunctor;
123class ComputeVelocityMagnitudeFunctor;
124class ComputeEntropyFunctor;
125class ComputeSwirlFunctor;
126class ComputeVelocityFunctor;
127class ComputeVorticityMagnitudeFunctor;
128class ComputePressureGradientFunctor;
129class ComputeVorticityFunctor;
130class ComputeStrainRateFunctor;
131}
132
133class VTKIOPARALLEL_EXPORT vtkMultiBlockPLOT3DReader : public vtkParallelReader
134{
135 friend class Functors::ComputeFunctor;
136 friend class Functors::ComputeTemperatureFunctor;
137 friend class Functors::ComputePressureFunctor;
138 friend class Functors::ComputePressureCoefficientFunctor;
139 friend class Functors::ComputeMachNumberFunctor;
140 friend class Functors::ComputeSoundSpeedFunctor;
141 friend class Functors::ComputeEnthalpyFunctor;
142 friend class Functors::ComputeKinecticEnergyFunctor;
143 friend class Functors::ComputeVelocityMagnitudeFunctor;
144 friend class Functors::ComputeEntropyFunctor;
145 friend class Functors::ComputeSwirlFunctor;
146 friend class Functors::ComputeVelocityFunctor;
147 friend class Functors::ComputeVorticityMagnitudeFunctor;
148 friend class Functors::ComputePressureGradientFunctor;
149 friend class Functors::ComputeVorticityFunctor;
150 friend class Functors::ComputeStrainRateFunctor;
151
152public:
155 void PrintSelf(ostream& os, vtkIndent indent) override;
156
158
164
166
169 void SetFileName(VTK_FILEPATH const char* name) { this->SetXYZFileName(name); }
170 VTK_FILEPATH const char* GetFileName() { return this->GetXYZFileName(); }
171 VTK_FILEPATH const char* GetFileName(int i) { return this->vtkParallelReader::GetFileName(i); }
172 virtual void SetXYZFileName(VTK_FILEPATH const char*);
175
177
187 void SetQFileName(VTK_FILEPATH const char* name);
190
192
195 vtkSetFilePathMacro(FunctionFileName);
196 vtkGetFilePathMacro(FunctionFileName);
198
200
210 vtkSetMacro(AutoDetectFormat, vtkTypeBool);
211 vtkGetMacro(AutoDetectFormat, vtkTypeBool);
212 vtkBooleanMacro(AutoDetectFormat, vtkTypeBool);
214
216
220 vtkSetMacro(BinaryFile, vtkTypeBool);
221 vtkGetMacro(BinaryFile, vtkTypeBool);
222 vtkBooleanMacro(BinaryFile, vtkTypeBool);
224
226
232 vtkSetMacro(MultiGrid, vtkTypeBool);
233 vtkGetMacro(MultiGrid, vtkTypeBool);
234 vtkBooleanMacro(MultiGrid, vtkTypeBool);
236
238
243 vtkSetMacro(HasByteCount, vtkTypeBool);
244 vtkGetMacro(HasByteCount, vtkTypeBool);
245 vtkBooleanMacro(HasByteCount, vtkTypeBool);
247
249
254 vtkSetMacro(IBlanking, vtkTypeBool);
255 vtkGetMacro(IBlanking, vtkTypeBool);
256 vtkBooleanMacro(IBlanking, vtkTypeBool);
258
260
264 vtkSetMacro(TwoDimensionalGeometry, vtkTypeBool);
265 vtkGetMacro(TwoDimensionalGeometry, vtkTypeBool);
266 vtkBooleanMacro(TwoDimensionalGeometry, vtkTypeBool);
268
270
275 vtkSetMacro(DoublePrecision, vtkTypeBool);
276 vtkGetMacro(DoublePrecision, vtkTypeBool);
277 vtkBooleanMacro(DoublePrecision, vtkTypeBool);
279
281
287 vtkSetMacro(ForceRead, vtkTypeBool);
288 vtkGetMacro(ForceRead, vtkTypeBool);
289 vtkBooleanMacro(ForceRead, vtkTypeBool);
291
293
301 vtkSetMacro(ByteOrder, int);
302 vtkGetMacro(ByteOrder, int);
303 const char* GetByteOrderAsString();
305
307
310 vtkSetMacro(R, double);
311 vtkGetMacro(R, double);
313
315
318 vtkSetMacro(Gamma, double);
319 vtkGetMacro(Gamma, double);
321
323
331 vtkSetMacro(PreserveIntermediateFunctions, bool);
332 vtkGetMacro(PreserveIntermediateFunctions, bool);
333 vtkBooleanMacro(PreserveIntermediateFunctions, bool);
334
336
341 vtkGetMacro(ScalarFunctionNumber, int);
343
345
350 vtkGetMacro(VectorFunctionNumber, int);
352
354
359 void AddFunction(int functionNumber);
360 void RemoveFunction(int);
363
368 virtual int CanReadBinaryFile(VTK_FILEPATH const char* fname);
369
371
376 vtkGetObjectMacro(Controller, vtkMultiProcessController);
378
379 void AddFunctionName(const std::string& name) { FunctionNames.push_back(name); }
380
381 enum
382 {
383 FILE_BIG_ENDIAN = 0,
384 FILE_LITTLE_ENDIAN = 1
385 };
386
388
394 int ReadMetaData(vtkInformation* metadata) override;
395 int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
396 int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
397 int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
399
400protected:
403
405
408 double GetTimeValue(const std::string& fname) override;
410 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
412 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
414 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
416
418
419 int CheckFile(FILE*& fp, const char* fname);
420 int CheckGeometryFile(FILE*& xyzFp);
421 int CheckFunctionFile(FILE*& fFp);
422
424 int SkipByteCount(FILE* fp);
425 int ReadIntBlock(FILE* fp, int n, int* block);
426
427 vtkIdType ReadValues(FILE* fp, int n, vtkDataArray* scalar);
428 virtual int ReadIntScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
429 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
430 virtual int ReadScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
431 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
432 virtual int ReadVector(void* vfp, int extent[6], int wextent[6], int numDims,
433 vtkDataArray* vector, vtkTypeUInt64 offset,
434 const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
435 virtual int OpenFileForDataRead(void*& fp, const char* fname);
436 virtual void CloseFile(void* fp);
437
438 int GetNumberOfBlocksInternal(FILE* xyzFp, int allocate);
439
440 int ReadGeometryHeader(FILE* fp);
441 int ReadQHeader(FILE* fp, bool checkGrid, int& nq, int& nqc, int& overflow);
442 int ReadFunctionHeader(FILE* fp, int* nFunctions);
443
444 void CalculateFileSize(FILE* fp);
445
446 int AutoDetectionCheck(FILE* fp);
447
448 void AssignAttribute(int fNumber, vtkStructuredGrid* output, int attributeType);
449 void MapFunction(int fNumber, vtkStructuredGrid* output);
450
452
472
473 // Returns a vtkFloatArray or a vtkDoubleArray depending
474 // on DoublePrecision setting
476
477 // Delete references to any existing vtkPoints and
478 // I-blank arrays. The next Update() will (re)read
479 // the XYZ file.
481
482 double GetGamma(vtkIdType idx, vtkDataArray* gamma);
483
485
486 // plot3d FileNames
499
501
502 size_t FileSize;
503
504 // parameters used in computing derived functions
505 double R;
506 double Gamma;
507 double GammaInf;
508
510
511 // named functions from meta data
512 std::vector<std::string> FunctionNames;
513
514 // functions to read that are not scalars or vectors
516
519
521
523
524private:
526 void operator=(const vtkMultiBlockPLOT3DReader&) = delete;
527
528 // Key used to flag intermediate results.
529 static vtkInformationIntegerKey* INTERMEDIATE_RESULT();
530
534 void RemoveIntermediateFunctions(vtkDataSetAttributes* dsa);
535};
536
537#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
general representation of visualization data
Definition: vtkDataObject.h:69
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition: vtkIndent.h:43
Key for integer values in vtkInformation.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
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
@ 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