VTK: IO/EnSight/vtkEnSightGoldBinaryReader.h Source File

| VTK 9.3.1

vtkEnSightGoldBinaryReader.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
31 #ifndef vtkEnSightGoldBinaryReader_h
32 #define vtkEnSightGoldBinaryReader_h
33
34 #include "vtkEnSightReader.h"
35 #include "vtkIOEnSightModule.h" // For export macro
36
37 VTK_ABI_NAMESPACE_BEGIN
38 class vtkMultiBlockDataSet;
39
40 class VTKIOENSIGHT_EXPORT vtkEnSightGoldBinaryReader : public vtkEnSightReader
41 {
42 public:
43 static vtkEnSightGoldBinaryReader* New();
44 vtkTypeMacro(vtkEnSightGoldBinaryReader, vtkEnSightReader);
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
47 protected:
48 vtkEnSightGoldBinaryReader();
49 ~vtkEnSightGoldBinaryReader() override;
50
51 // Returns 1 if successful. Sets file size as a side action.
52 int OpenFile(const char* filename);
53
54 // Returns 1 if successful. Handles constructing the filename, opening the file and checking
55 // if it's binary
56 int InitializeFile(const char* filename);
57
61 int ReadGeometryFile(const char* fileName, int timeStep, vtkMultiBlockDataSet* output) override;
62
67 int ReadMeasuredGeometryFile(
68 const char* fileName, int timeStep, vtkMultiBlockDataSet* output) override;
69
75 int ReadScalarsPerNode(const char* fileName, const char* description, int timeStep,
76 vtkMultiBlockDataSet* output, int measured = 0, int numberOfComponents = 1,
77 int component = 0) override;
78
83 int ReadVectorsPerNode(const char* fileName, const char* description, int timeStep,
84 vtkMultiBlockDataSet* output, int measured = 0) override;
85
90 int ReadAsymmetricTensorsPerNode(const char* fileName, const char* description, int timeStep,
91 vtkMultiBlockDataSet* output) override;
92
97 int ReadTensorsPerNode(const char* fileName, const char* description, int timeStep,
98 vtkMultiBlockDataSet* output) override;
99
105 int ReadScalarsPerElement(const char* fileName, const char* description, int timeStep,
106 vtkMultiBlockDataSet* output, int numberOfComponents = 1, int component = 0) override;
107
112 int ReadVectorsPerElement(const char* fileName, const char* description, int timeStep,
113 vtkMultiBlockDataSet* output) override;
114
119 int ReadAsymmetricTensorsPerElement(const char* fileName, const char* description, int timeStep,
120 vtkMultiBlockDataSet* output) override;
121
126 int ReadTensorsPerElement(const char* fileName, const char* description, int timeStep,
127 vtkMultiBlockDataSet* output) override;
128
134 int CreateUnstructuredGridOutput(
135 int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) override;
136
141 int CreateStructuredGridOutput(
142 int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) override;
143
148 int CreateRectilinearGridOutput(
149 int partId, char line[80], const char* name, vtkMultiBlockDataSet* output);
150
155 int CreateImageDataOutput(
156 int partId, char line[80], const char* name, vtkMultiBlockDataSet* output);
157
162 int ReadLine(char result[80]);
163
165
169 int ReadInt(int* result);
170 int ReadPartId(int* result);
172
177 int ReadFloat(float* result);
178
183 int ReadIntArray(int* result, int numInts);
184
189 int ReadLong(vtkTypeInt64* result);
190
195 int ReadFloatArray(float* result, int numFloats);
196
203 int CountTimeSteps();
204
206
209 int SkipTimeStep();
210 int SkipStructuredGrid(char line[256]);
211 int SkipUnstructuredGrid(char line[256]);
212 int SkipRectilinearGrid(char line[256]);
213 int SkipImageData(char line[256]);
215
219 int SeekToCachedTimeStep(const char* fileName, int realTimeStep);
220
224 void AddTimeStepToCache(const char* fileName, int realTimeStep, vtkTypeInt64 address);
225
229 void AddFileIndexToCache(const char* fileName);
230
231 int NodeIdsListed;
232 int ElementIdsListed;
233 int Fortran;
234 int FortranSkipBytes; // Number of bytes to skip when seeking within a fortran-written file
235
236 istream* GoldIFile;
237 // The size of the file could be used to choose byte order.
238 vtkTypeUInt64 FileSize;
239
240 class FileOffsetMapInternal;
241 FileOffsetMapInternal* FileOffsets;
242
243 private:
244 int SizeOfInt;
245 vtkEnSightGoldBinaryReader(const vtkEnSightGoldBinaryReader&) = delete;
246 void operator=(const vtkEnSightGoldBinaryReader&) = delete;
247
252 bool OpenVariableFile(const char* fname, const char* variableType);
253
258 bool SkipToTimeStep(const char* fileName, int timeStep, vtkMultiBlockDataSet* compositeOutput,
259 int attributeType, int numComponents, bool measured);
260
264 bool ReadMeasureVariableArray(
265 const char* description, vtkMultiBlockDataSet* compositeOutput, int numComponents);
266
267 bool ReadVariableArray(const char* description, vtkMultiBlockDataSet* compositeOutput,
268 int attributeType, int numComponents, int component = -1);
269
270 class vtkUtilities;
271 friend class vtkUtilities;
272 };
273
274 VTK_ABI_NAMESPACE_END
275 #endif
vtkEnSightGoldBinaryReader
class to read binary EnSight Gold files
Definition: vtkEnSightGoldBinaryReader.h:41
vtkEnSightGoldBinaryReader::FileOffsets
FileOffsetMapInternal * FileOffsets
Definition: vtkEnSightGoldBinaryReader.h:240
vtkEnSightGoldBinaryReader::SkipStructuredGrid
int SkipStructuredGrid(char line[256])
Read to the next time step in the geometry file.
vtkEnSightGoldBinaryReader::AddTimeStepToCache
void AddTimeStepToCache(const char *fileName, int realTimeStep, vtkTypeInt64 address)
Add an entry the time step cache.
vtkEnSightGoldBinaryReader::FortranSkipBytes
int FortranSkipBytes
Definition: vtkEnSightGoldBinaryReader.h:234
vtkEnSightGoldBinaryReader::CreateStructuredGridOutput
int CreateStructuredGridOutput(int partId, char line[80], const char *name, vtkMultiBlockDataSet *output) override
Read a structured part from the geometry file and create a vtkStructuredGrid output.
vtkEnSightGoldBinaryReader::NodeIdsListed
int NodeIdsListed
Definition: vtkEnSightGoldBinaryReader.h:231
vtkEnSightGoldBinaryReader::InitializeFile
int InitializeFile(const char *filename)
vtkEnSightGoldBinaryReader::ReadVectorsPerNode
int ReadVectorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int measured=0) override
Read vectors per node for this dataset.
vtkEnSightGoldBinaryReader::CreateRectilinearGridOutput
int CreateRectilinearGridOutput(int partId, char line[80], const char *name, vtkMultiBlockDataSet *output)
Read a structured part from the geometry file and create a vtkRectilinearGrid output.
vtkEnSightGoldBinaryReader::CountTimeSteps
int CountTimeSteps()
Counts the number of timesteps in the geometry file This function assumes the file is already open an...
vtkEnSightGoldBinaryReader::ReadFloat
int ReadFloat(float *result)
Internal function to read a single float.
vtkEnSightGoldBinaryReader::AddFileIndexToCache
void AddFileIndexToCache(const char *fileName)
Read the file index, if available, and add it to the time step cache.
vtkEnSightGoldBinaryReader::ReadMeasuredGeometryFile
int ReadMeasuredGeometryFile(const char *fileName, int timeStep, vtkMultiBlockDataSet *output) override
Read the measured geometry file.
vtkEnSightGoldBinaryReader::SeekToCachedTimeStep
int SeekToCachedTimeStep(const char *fileName, int realTimeStep)
Seeks the IFile to the nearest time step that is <= the target time step.
vtkEnSightGoldBinaryReader::ElementIdsListed
int ElementIdsListed
Definition: vtkEnSightGoldBinaryReader.h:232
vtkEnSightGoldBinaryReader::ReadInt
int ReadInt(int *result)
Internal function to read in a single integer.
vtkEnSightGoldBinaryReader::ReadScalarsPerElement
int ReadScalarsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int numberOfComponents=1, int component=0) override
Read scalars per element for this dataset.
vtkEnSightGoldBinaryReader::ReadPartId
int ReadPartId(int *result)
Internal function to read in a single integer.
vtkEnSightGoldBinaryReader::FileSize
vtkTypeUInt64 FileSize
Definition: vtkEnSightGoldBinaryReader.h:238
vtkEnSightGoldBinaryReader::~vtkEnSightGoldBinaryReader
~vtkEnSightGoldBinaryReader() override
vtkEnSightGoldBinaryReader::ReadLine
int ReadLine(char result[80])
Internal function to read in a line up to 80 characters.
vtkEnSightGoldBinaryReader::ReadAsymmetricTensorsPerNode
int ReadAsymmetricTensorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read asymmetric tensors per node for this dataset.
vtkEnSightGoldBinaryReader::ReadGeometryFile
int ReadGeometryFile(const char *fileName, int timeStep, vtkMultiBlockDataSet *output) override
Read the geometry file.
vtkEnSightGoldBinaryReader::SkipTimeStep
int SkipTimeStep()
Read to the next time step in the geometry file.
vtkEnSightGoldBinaryReader::CreateUnstructuredGridOutput
int CreateUnstructuredGridOutput(int partId, char line[80], const char *name, vtkMultiBlockDataSet *output) override
Read an unstructured part (partId) from the geometry file and create a vtkUnstructuredGrid output.
vtkEnSightGoldBinaryReader::SkipRectilinearGrid
int SkipRectilinearGrid(char line[256])
Read to the next time step in the geometry file.
vtkEnSightGoldBinaryReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkEnSightGoldBinaryReader::ReadScalarsPerNode
int ReadScalarsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int measured=0, int numberOfComponents=1, int component=0) override
Read scalars per node for this dataset.
vtkEnSightGoldBinaryReader::ReadTensorsPerNode
int ReadTensorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read tensors per node for this dataset.
vtkEnSightGoldBinaryReader::GoldIFile
istream * GoldIFile
Definition: vtkEnSightGoldBinaryReader.h:236
vtkEnSightGoldBinaryReader::CreateImageDataOutput
int CreateImageDataOutput(int partId, char line[80], const char *name, vtkMultiBlockDataSet *output)
Read a structured part from the geometry file and create a vtkImageData output.
vtkEnSightGoldBinaryReader::SkipUnstructuredGrid
int SkipUnstructuredGrid(char line[256])
Read to the next time step in the geometry file.
vtkEnSightGoldBinaryReader::ReadFloatArray
int ReadFloatArray(float *result, int numFloats)
Internal function to read in a float array.
vtkEnSightGoldBinaryReader::vtkEnSightGoldBinaryReader
vtkEnSightGoldBinaryReader()
vtkEnSightGoldBinaryReader::ReadTensorsPerElement
int ReadTensorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read tensors per element for this dataset.
vtkEnSightGoldBinaryReader::ReadIntArray
int ReadIntArray(int *result, int numInts)
Internal function to read in an integer array.
vtkEnSightGoldBinaryReader::New
static vtkEnSightGoldBinaryReader * New()
vtkEnSightGoldBinaryReader::OpenFile
int OpenFile(const char *filename)
vtkEnSightGoldBinaryReader::ReadVectorsPerElement
int ReadVectorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read vectors per element for this dataset.
vtkEnSightGoldBinaryReader::ReadAsymmetricTensorsPerElement
int ReadAsymmetricTensorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read asymmetric tensors per element for this dataset.
vtkEnSightGoldBinaryReader::Fortran
int Fortran
Definition: vtkEnSightGoldBinaryReader.h:233
vtkEnSightGoldBinaryReader::SkipImageData
int SkipImageData(char line[256])
Read to the next time step in the geometry file.
vtkEnSightGoldBinaryReader::ReadLong
int ReadLong(vtkTypeInt64 *result)
Internal function to read in a single long.
vtkEnSightReader
superclass for EnSight file readers
Definition: vtkEnSightReader.h:22
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:50
vtkX3D::component
@ component
Definition: vtkX3D.h:175
vtkX3D::address
@ address
Definition: vtkX3D.h:270
vtkX3D::description
@ description
Definition: vtkX3D.h:322
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkEnSightReader.h