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
106class vtkDataArray;
108class vtkIntArray;
115
116namespace Functors
117{
118class ComputeFunctor;
119class ComputeTemperatureFunctor;
120class ComputePressureFunctor;
121class ComputePressureCoefficientFunctor;
122class ComputeMachNumberFunctor;
123class ComputeSoundSpeedFunctor;
124class ComputeEnthalpyFunctor;
125class ComputeKinecticEnergyFunctor;
126class ComputeVelocityMagnitudeFunctor;
127class ComputeEntropyFunctor;
128class ComputeSwirlFunctor;
129class ComputeVelocityFunctor;
130class ComputeVorticityMagnitudeFunctor;
131class ComputePressureGradientFunctor;
132class ComputeVorticityFunctor;
133class ComputeStrainRateFunctor;
134}
135
136class 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
155public:
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*);
178
180
190 void SetQFileName(VTK_FILEPATH const char* name);
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
344 vtkGetMacro(ScalarFunctionNumber, int);
346
348
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
403protected:
406
408
411 double GetTimeValue(const std::string& fname) override;
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
487 int FillOutputPortInformation(int port, vtkInformation* info) override;
488
489 // plot3d FileNames
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
527private:
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
general representation of visualization data
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 * 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