VTK  9.3.20240424
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
187#ifndef vtkMultiBlockPLOT3DReader_h
188#define vtkMultiBlockPLOT3DReader_h
189
190#include "vtkIOParallelModule.h" // For export macro
191#include "vtkParallelReader.h"
192#include <vector> // For holding function-names
193
194VTK_ABI_NAMESPACE_BEGIN
195class vtkDataArray;
197class vtkIntArray;
204VTK_ABI_NAMESPACE_END
205
206namespace Functors
207{
208VTK_ABI_NAMESPACE_BEGIN
209class ComputeFunctor;
210class ComputeTemperatureFunctor;
211class ComputePressureFunctor;
212class ComputePressureCoefficientFunctor;
213class ComputeMachNumberFunctor;
214class ComputeSoundSpeedFunctor;
215class ComputeEnthalpyFunctor;
216class ComputeKinecticEnergyFunctor;
217class ComputeVelocityMagnitudeFunctor;
218class ComputeEntropyFunctor;
219class ComputeSwirlFunctor;
220class ComputeVelocityFunctor;
221class ComputeVorticityMagnitudeFunctor;
222class ComputePressureGradientFunctor;
223class ComputeVorticityFunctor;
224class ComputeStrainRateFunctor;
225VTK_ABI_NAMESPACE_END
226}
227
228VTK_ABI_NAMESPACE_BEGIN
229
230class VTKIOPARALLEL_EXPORT vtkMultiBlockPLOT3DReader : public vtkParallelReader
231{
232 friend class Functors::ComputeFunctor;
233 friend class Functors::ComputeTemperatureFunctor;
234 friend class Functors::ComputePressureFunctor;
235 friend class Functors::ComputePressureCoefficientFunctor;
236 friend class Functors::ComputeMachNumberFunctor;
237 friend class Functors::ComputeSoundSpeedFunctor;
238 friend class Functors::ComputeEnthalpyFunctor;
239 friend class Functors::ComputeKinecticEnergyFunctor;
240 friend class Functors::ComputeVelocityMagnitudeFunctor;
241 friend class Functors::ComputeEntropyFunctor;
242 friend class Functors::ComputeSwirlFunctor;
243 friend class Functors::ComputeVelocityFunctor;
244 friend class Functors::ComputeVorticityMagnitudeFunctor;
245 friend class Functors::ComputePressureGradientFunctor;
246 friend class Functors::ComputeVorticityFunctor;
247 friend class Functors::ComputeStrainRateFunctor;
248
249public:
252 void PrintSelf(ostream& os, vtkIndent indent) override;
253
255
261
263
266 void SetFileName(VTK_FILEPATH const char* name) { this->SetXYZFileName(name); }
267 VTK_FILEPATH const char* GetFileName() { return this->GetXYZFileName(); }
268 VTK_FILEPATH const char* GetFileName(int i) { return this->vtkParallelReader::GetFileName(i); }
269 virtual void SetXYZFileName(VTK_FILEPATH const char*);
272
274
284 void SetQFileName(VTK_FILEPATH const char* name);
287
289
292 vtkSetFilePathMacro(FunctionFileName);
293 vtkGetFilePathMacro(FunctionFileName);
295
297
307 vtkSetMacro(AutoDetectFormat, vtkTypeBool);
308 vtkGetMacro(AutoDetectFormat, vtkTypeBool);
309 vtkBooleanMacro(AutoDetectFormat, vtkTypeBool);
311
313
317 vtkSetMacro(BinaryFile, vtkTypeBool);
318 vtkGetMacro(BinaryFile, vtkTypeBool);
319 vtkBooleanMacro(BinaryFile, vtkTypeBool);
321
323
329 vtkSetMacro(MultiGrid, vtkTypeBool);
330 vtkGetMacro(MultiGrid, vtkTypeBool);
331 vtkBooleanMacro(MultiGrid, vtkTypeBool);
333
335
340 vtkSetMacro(HasByteCount, vtkTypeBool);
341 vtkGetMacro(HasByteCount, vtkTypeBool);
342 vtkBooleanMacro(HasByteCount, vtkTypeBool);
344
346
351 vtkSetMacro(IBlanking, vtkTypeBool);
352 vtkGetMacro(IBlanking, vtkTypeBool);
353 vtkBooleanMacro(IBlanking, vtkTypeBool);
355
357
361 vtkSetMacro(TwoDimensionalGeometry, vtkTypeBool);
362 vtkGetMacro(TwoDimensionalGeometry, vtkTypeBool);
363 vtkBooleanMacro(TwoDimensionalGeometry, vtkTypeBool);
365
367
372 vtkSetMacro(DoublePrecision, vtkTypeBool);
373 vtkGetMacro(DoublePrecision, vtkTypeBool);
374 vtkBooleanMacro(DoublePrecision, vtkTypeBool);
376
378
384 vtkSetMacro(ForceRead, vtkTypeBool);
385 vtkGetMacro(ForceRead, vtkTypeBool);
386 vtkBooleanMacro(ForceRead, vtkTypeBool);
388
390
398 vtkSetMacro(ByteOrder, int);
399 vtkGetMacro(ByteOrder, int);
400 const char* GetByteOrderAsString();
402
404
407 vtkSetMacro(R, double);
408 vtkGetMacro(R, double);
410
412
415 vtkSetMacro(Gamma, double);
416 vtkGetMacro(Gamma, double);
418
420
428 vtkSetMacro(PreserveIntermediateFunctions, bool);
429 vtkGetMacro(PreserveIntermediateFunctions, bool);
430 vtkBooleanMacro(PreserveIntermediateFunctions, bool);
431
433
438 vtkGetMacro(ScalarFunctionNumber, int);
440
442
447 vtkGetMacro(VectorFunctionNumber, int);
449
451
456 void AddFunction(int functionNumber);
457 void RemoveFunction(int);
460
465 virtual int CanReadBinaryFile(VTK_FILEPATH const char* fname);
466
468
473 vtkGetObjectMacro(Controller, vtkMultiProcessController);
475
476 void AddFunctionName(const std::string& name) { FunctionNames.push_back(name); }
477
478 enum
479 {
480 FILE_BIG_ENDIAN = 0,
481 FILE_LITTLE_ENDIAN = 1
482 };
483
485
491 int ReadMetaData(vtkInformation* metadata) override;
492 int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
493 int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
494 int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
496
497protected:
500
502
505 double GetTimeValue(const std::string& fname) override;
507 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
509 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
511 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
513
515
516 int CheckFile(FILE*& fp, const char* fname);
517 int CheckGeometryFile(FILE*& xyzFp);
518 int CheckFunctionFile(FILE*& fFp);
519
521 int SkipByteCount(FILE* fp);
522 int ReadIntBlock(FILE* fp, int n, int* block);
523
524 vtkIdType ReadValues(FILE* fp, int n, vtkDataArray* scalar);
525 virtual int ReadIntScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
526 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
527 virtual int ReadScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
528 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
529 virtual int ReadVector(void* vfp, int extent[6], int wextent[6], int numDims,
530 vtkDataArray* vector, vtkTypeUInt64 offset,
531 const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
532 virtual int OpenFileForDataRead(void*& fp, const char* fname);
533 virtual void CloseFile(void* fp);
534
535 int GetNumberOfBlocksInternal(FILE* xyzFp, int allocate);
536
537 int ReadGeometryHeader(FILE* fp);
538 int ReadQHeader(FILE* fp, bool checkGrid, int& nq, int& nqc, int& overflow);
539 int ReadFunctionHeader(FILE* fp, int* nFunctions);
540
541 void CalculateFileSize(FILE* fp);
542
543 int AutoDetectionCheck(FILE* fp);
544
545 void AssignAttribute(int fNumber, vtkStructuredGrid* output, int attributeType);
546 void MapFunction(int fNumber, vtkStructuredGrid* output);
547
549
569
570 // Returns a vtkFloatArray or a vtkDoubleArray depending
571 // on DoublePrecision setting
573
574 // Delete references to any existing vtkPoints and
575 // I-blank arrays. The next Update() will (re)read
576 // the XYZ file.
578
579 double GetGamma(vtkIdType idx, vtkDataArray* gamma);
580
581 int FillOutputPortInformation(int port, vtkInformation* info) override;
582
583 // plot3d FileNames
596
598
599 size_t FileSize;
600
601 // parameters used in computing derived functions
602 double R;
603 double Gamma;
604 double GammaInf;
605
607
608 // named functions from meta data
609 std::vector<std::string> FunctionNames;
610
611 // functions to read that are not scalars or vectors
613
616
618
620
621private:
623 void operator=(const vtkMultiBlockPLOT3DReader&) = delete;
624
625 // Key used to flag intermediate results.
626 static vtkInformationIntegerKey* INTERMEDIATE_RESULT();
627
631 void RemoveIntermediateFunctions(vtkDataSetAttributes* dsa);
632};
633
634VTK_ABI_NAMESPACE_END
635#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:108
Key for integer values in vtkInformation.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
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