VTK  9.1.0
vtkEnSightGoldBinaryReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkEnSightGoldBinaryReader.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 =========================================================================*/
40 #ifndef vtkEnSightGoldBinaryReader_h
41 #define vtkEnSightGoldBinaryReader_h
42 
43 #include "vtkEnSightReader.h"
44 #include "vtkIOEnSightModule.h" // For export macro
45 
47 
48 class VTKIOENSIGHT_EXPORT vtkEnSightGoldBinaryReader : public vtkEnSightReader
49 {
50 public:
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
55 protected:
58 
59  // Returns 1 if successful. Sets file size as a side action.
60  int OpenFile(const char* filename);
61 
62  // Returns 1 if successful. Handles constructing the filename, opening the file and checking
63  // if it's binary
64  int InitializeFile(const char* filename);
65 
69  int ReadGeometryFile(const char* fileName, int timeStep, vtkMultiBlockDataSet* output) override;
70 
76  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) override;
77 
83  int ReadScalarsPerNode(const char* fileName, const char* description, int timeStep,
84  vtkMultiBlockDataSet* output, int measured = 0, int numberOfComponents = 1,
85  int component = 0) override;
86 
91  int ReadVectorsPerNode(const char* fileName, const char* description, int timeStep,
92  vtkMultiBlockDataSet* output, int measured = 0) override;
93 
98  int ReadAsymmetricTensorsPerNode(const char* fileName, const char* description, int timeStep,
99  vtkMultiBlockDataSet* output) override;
100 
105  int ReadTensorsPerNode(const char* fileName, const char* description, int timeStep,
106  vtkMultiBlockDataSet* output) override;
107 
113  int ReadScalarsPerElement(const char* fileName, const char* description, int timeStep,
114  vtkMultiBlockDataSet* output, int numberOfComponents = 1, int component = 0) override;
115 
120  int ReadVectorsPerElement(const char* fileName, const char* description, int timeStep,
121  vtkMultiBlockDataSet* output) override;
122 
127  int ReadAsymmetricTensorsPerElement(const char* fileName, const char* description, int timeStep,
128  vtkMultiBlockDataSet* output) override;
129 
134  int ReadTensorsPerElement(const char* fileName, const char* description, int timeStep,
135  vtkMultiBlockDataSet* output) override;
136 
143  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) override;
144 
150  int partId, char line[256], const char* name, vtkMultiBlockDataSet* output) override;
151 
157  int partId, char line[256], const char* name, vtkMultiBlockDataSet* output);
158 
164  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output);
165 
170  int ReadLine(char result[80]);
171 
173 
177  int ReadInt(int* result);
178  int ReadPartId(int* result);
180 
185  int ReadFloat(float* result);
186 
191  int ReadIntArray(int* result, int numInts);
192 
197  int ReadLong(vtkTypeInt64* result);
198 
203  int ReadFloatArray(float* result, int numFloats);
204 
212 
214 
218  int SkipStructuredGrid(char line[256]);
219  int SkipUnstructuredGrid(char line[256]);
220  int SkipRectilinearGrid(char line[256]);
221  int SkipImageData(char line[256]);
223 
227  int SeekToCachedTimeStep(const char* fileName, int realTimeStep);
228 
232  void AddTimeStepToCache(const char* fileName, int realTimeStep, vtkTypeInt64 address);
233 
237  void AddFileIndexToCache(const char* fileName);
238 
241  int Fortran;
242  int FortranSkipBytes; // Number of bytes to skip when seeking within a fortran-written file
243 
244  istream* GoldIFile;
245  // The size of the file could be used to choose byte order.
246  vtkTypeUInt64 FileSize;
247 
248  class FileOffsetMapInternal;
249  FileOffsetMapInternal* FileOffsets;
250 
251 private:
252  int SizeOfInt;
254  void operator=(const vtkEnSightGoldBinaryReader&) = delete;
255 
260  bool OpenVariableFile(const char* fname, const char* variableType);
261 
266  bool SkipToTimeStep(const char* fileName, int timeStep, vtkMultiBlockDataSet* compositeOutput,
267  int attributeType, int numComponents, bool measured);
268 
272  bool ReadMeasureVariableArray(
273  const char* description, vtkMultiBlockDataSet* compositeOutput, int numComponents);
274 
275  bool ReadVariableArray(const char* description, vtkMultiBlockDataSet* compositeOutput,
276  int attributeType, int numComponents, int component = -1);
277 
278  class vtkUtilities;
279  friend class vtkUtilities;
280 };
281 
282 #endif
class to read binary EnSight Gold files
int SkipStructuredGrid(char line[256])
Read to the next time step in the geometry file.
void AddTimeStepToCache(const char *fileName, int realTimeStep, vtkTypeInt64 address)
Add an entry the time step cache.
int InitializeFile(const char *filename)
int ReadVectorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int measured=0) override
Read vectors per node for this dataset.
int CountTimeSteps()
Counts the number of timesteps in the geometry file This function assumes the file is already open an...
int ReadFloat(float *result)
Internal function to read a single float.
void AddFileIndexToCache(const char *fileName)
Read the file index, if available, and add it to the time step cache.
int ReadMeasuredGeometryFile(const char *fileName, int timeStep, vtkMultiBlockDataSet *output) override
Read the measured geometry file.
int SeekToCachedTimeStep(const char *fileName, int realTimeStep)
Seeks the IFile to the nearest time step that is <= the target time step.
int ReadInt(int *result)
Internal function to read in a single integer.
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.
int CreateRectilinearGridOutput(int partId, char line[256], const char *name, vtkMultiBlockDataSet *output)
Read a structured part from the geometry file and create a vtkRectilinearGrid output.
int ReadPartId(int *result)
Internal function to read in a single integer.
~vtkEnSightGoldBinaryReader() override
int ReadLine(char result[80])
Internal function to read in a line up to 80 characters.
int CreateStructuredGridOutput(int partId, char line[256], const char *name, vtkMultiBlockDataSet *output) override
Read a structured part from the geometry file and create a vtkStructuredGrid output.
int ReadAsymmetricTensorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read asymmetric tensors per node for this dataset.
int ReadGeometryFile(const char *fileName, int timeStep, vtkMultiBlockDataSet *output) override
Read the geometry file.
int SkipTimeStep()
Read to the next time step in the geometry file.
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.
int SkipRectilinearGrid(char line[256])
Read to the next time step in the geometry file.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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.
int ReadTensorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read tensors per node for this dataset.
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.
int SkipUnstructuredGrid(char line[256])
Read to the next time step in the geometry file.
int ReadFloatArray(float *result, int numFloats)
Internal function to read in a float array.
int ReadTensorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read tensors per element for this dataset.
int ReadIntArray(int *result, int numInts)
Internal function to read in an integer array.
static vtkEnSightGoldBinaryReader * New()
int OpenFile(const char *filename)
int ReadVectorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read vectors per element for this dataset.
int ReadAsymmetricTensorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output) override
Read asymmetric tensors per element for this dataset.
int SkipImageData(char line[256])
Read to the next time step in the geometry file.
int ReadLong(vtkTypeInt64 *result)
Internal function to read in a single long.
superclass for EnSight file readers
a simple class to control print indentation
Definition: vtkIndent.h:34
Composite dataset that organizes datasets into blocks.
@ component
Definition: vtkX3D.h:181
@ address
Definition: vtkX3D.h:276
@ description
Definition: vtkX3D.h:328
@ name
Definition: vtkX3D.h:225