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=========================================================================*/
199#ifndef vtkMultiBlockPLOT3DReader_h
200#define vtkMultiBlockPLOT3DReader_h
201
202#include "vtkIOParallelModule.h" // For export macro
203#include "vtkParallelReader.h"
204#include <vector> // For holding function-names
205
206class vtkDataArray;
208class vtkIntArray;
215
216namespace Functors
217{
218class ComputeFunctor;
219class ComputeTemperatureFunctor;
220class ComputePressureFunctor;
221class ComputePressureCoefficientFunctor;
222class ComputeMachNumberFunctor;
223class ComputeSoundSpeedFunctor;
224class ComputeEnthalpyFunctor;
225class ComputeKinecticEnergyFunctor;
226class ComputeVelocityMagnitudeFunctor;
227class ComputeEntropyFunctor;
228class ComputeSwirlFunctor;
229class ComputeVelocityFunctor;
230class ComputeVorticityMagnitudeFunctor;
231class ComputePressureGradientFunctor;
232class ComputeVorticityFunctor;
233class ComputeStrainRateFunctor;
234}
235
236class VTKIOPARALLEL_EXPORT vtkMultiBlockPLOT3DReader : public vtkParallelReader
237{
238 friend class Functors::ComputeFunctor;
239 friend class Functors::ComputeTemperatureFunctor;
240 friend class Functors::ComputePressureFunctor;
241 friend class Functors::ComputePressureCoefficientFunctor;
242 friend class Functors::ComputeMachNumberFunctor;
243 friend class Functors::ComputeSoundSpeedFunctor;
244 friend class Functors::ComputeEnthalpyFunctor;
245 friend class Functors::ComputeKinecticEnergyFunctor;
246 friend class Functors::ComputeVelocityMagnitudeFunctor;
247 friend class Functors::ComputeEntropyFunctor;
248 friend class Functors::ComputeSwirlFunctor;
249 friend class Functors::ComputeVelocityFunctor;
250 friend class Functors::ComputeVorticityMagnitudeFunctor;
251 friend class Functors::ComputePressureGradientFunctor;
252 friend class Functors::ComputeVorticityFunctor;
253 friend class Functors::ComputeStrainRateFunctor;
254
255public:
258 void PrintSelf(ostream& os, vtkIndent indent) override;
259
261
267
269
272 void SetFileName(VTK_FILEPATH const char* name) { this->SetXYZFileName(name); }
273 VTK_FILEPATH const char* GetFileName() { return this->GetXYZFileName(); }
274 VTK_FILEPATH const char* GetFileName(int i) { return this->vtkParallelReader::GetFileName(i); }
275 virtual void SetXYZFileName(VTK_FILEPATH const char*);
278
280
290 void SetQFileName(VTK_FILEPATH const char* name);
293
295
298 vtkSetFilePathMacro(FunctionFileName);
299 vtkGetFilePathMacro(FunctionFileName);
301
303
313 vtkSetMacro(AutoDetectFormat, vtkTypeBool);
314 vtkGetMacro(AutoDetectFormat, vtkTypeBool);
315 vtkBooleanMacro(AutoDetectFormat, vtkTypeBool);
317
319
323 vtkSetMacro(BinaryFile, vtkTypeBool);
324 vtkGetMacro(BinaryFile, vtkTypeBool);
325 vtkBooleanMacro(BinaryFile, vtkTypeBool);
327
329
335 vtkSetMacro(MultiGrid, vtkTypeBool);
336 vtkGetMacro(MultiGrid, vtkTypeBool);
337 vtkBooleanMacro(MultiGrid, vtkTypeBool);
339
341
346 vtkSetMacro(HasByteCount, vtkTypeBool);
347 vtkGetMacro(HasByteCount, vtkTypeBool);
348 vtkBooleanMacro(HasByteCount, vtkTypeBool);
350
352
357 vtkSetMacro(IBlanking, vtkTypeBool);
358 vtkGetMacro(IBlanking, vtkTypeBool);
359 vtkBooleanMacro(IBlanking, vtkTypeBool);
361
363
367 vtkSetMacro(TwoDimensionalGeometry, vtkTypeBool);
368 vtkGetMacro(TwoDimensionalGeometry, vtkTypeBool);
369 vtkBooleanMacro(TwoDimensionalGeometry, vtkTypeBool);
371
373
378 vtkSetMacro(DoublePrecision, vtkTypeBool);
379 vtkGetMacro(DoublePrecision, vtkTypeBool);
380 vtkBooleanMacro(DoublePrecision, vtkTypeBool);
382
384
390 vtkSetMacro(ForceRead, vtkTypeBool);
391 vtkGetMacro(ForceRead, vtkTypeBool);
392 vtkBooleanMacro(ForceRead, vtkTypeBool);
394
396
404 vtkSetMacro(ByteOrder, int);
405 vtkGetMacro(ByteOrder, int);
406 const char* GetByteOrderAsString();
408
410
413 vtkSetMacro(R, double);
414 vtkGetMacro(R, double);
416
418
421 vtkSetMacro(Gamma, double);
422 vtkGetMacro(Gamma, double);
424
426
434 vtkSetMacro(PreserveIntermediateFunctions, bool);
435 vtkGetMacro(PreserveIntermediateFunctions, bool);
436 vtkBooleanMacro(PreserveIntermediateFunctions, bool);
437
439
444 vtkGetMacro(ScalarFunctionNumber, int);
446
448
453 vtkGetMacro(VectorFunctionNumber, int);
455
457
462 void AddFunction(int functionNumber);
463 void RemoveFunction(int);
466
471 virtual int CanReadBinaryFile(VTK_FILEPATH const char* fname);
472
474
479 vtkGetObjectMacro(Controller, vtkMultiProcessController);
481
482 void AddFunctionName(const std::string& name) { FunctionNames.push_back(name); }
483
484 enum
485 {
486 FILE_BIG_ENDIAN = 0,
487 FILE_LITTLE_ENDIAN = 1
488 };
489
491
497 int ReadMetaData(vtkInformation* metadata) override;
498 int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
499 int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
500 int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
502
503protected:
506
508
511 double GetTimeValue(const std::string& fname) override;
513 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
515 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
517 const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) override;
519
521
522 int CheckFile(FILE*& fp, const char* fname);
523 int CheckGeometryFile(FILE*& xyzFp);
524 int CheckFunctionFile(FILE*& fFp);
525
527 int SkipByteCount(FILE* fp);
528 int ReadIntBlock(FILE* fp, int n, int* block);
529
530 vtkIdType ReadValues(FILE* fp, int n, vtkDataArray* scalar);
531 virtual int ReadIntScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
532 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
533 virtual int ReadScalar(void* vfp, int extent[6], int wextent[6], vtkDataArray* scalar,
534 vtkTypeUInt64 offset, const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
535 virtual int ReadVector(void* vfp, int extent[6], int wextent[6], int numDims,
536 vtkDataArray* vector, vtkTypeUInt64 offset,
537 const vtkMultiBlockPLOT3DReaderRecord& currentRecord);
538 virtual int OpenFileForDataRead(void*& fp, const char* fname);
539 virtual void CloseFile(void* fp);
540
541 int GetNumberOfBlocksInternal(FILE* xyzFp, int allocate);
542
543 int ReadGeometryHeader(FILE* fp);
544 int ReadQHeader(FILE* fp, bool checkGrid, int& nq, int& nqc, int& overflow);
545 int ReadFunctionHeader(FILE* fp, int* nFunctions);
546
547 void CalculateFileSize(FILE* fp);
548
549 int AutoDetectionCheck(FILE* fp);
550
551 void AssignAttribute(int fNumber, vtkStructuredGrid* output, int attributeType);
552 void MapFunction(int fNumber, vtkStructuredGrid* output);
553
555
575
576 // Returns a vtkFloatArray or a vtkDoubleArray depending
577 // on DoublePrecision setting
579
580 // Delete references to any existing vtkPoints and
581 // I-blank arrays. The next Update() will (re)read
582 // the XYZ file.
584
585 double GetGamma(vtkIdType idx, vtkDataArray* gamma);
586
588
589 // plot3d FileNames
602
604
605 size_t FileSize;
606
607 // parameters used in computing derived functions
608 double R;
609 double Gamma;
610 double GammaInf;
611
613
614 // named functions from meta data
615 std::vector<std::string> FunctionNames;
616
617 // functions to read that are not scalars or vectors
619
622
624
626
627private:
629 void operator=(const vtkMultiBlockPLOT3DReader&) = delete;
630
631 // Key used to flag intermediate results.
632 static vtkInformationIntegerKey* INTERMEDIATE_RESULT();
633
637 void RemoveIntermediateFunctions(vtkDataSetAttributes* dsa);
638};
639
640#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
general representation of visualization data
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition: vtkIndent.h:119
Key for integer values in vtkInformation.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:155
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