VTK
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 =========================================================================*/
43 #ifndef vtkEnSightGoldBinaryReader_h
44 #define vtkEnSightGoldBinaryReader_h
45 
46 #include "vtkIOEnSightModule.h" // For export macro
47 #include "vtkEnSightReader.h"
48 
49 
51 
52 class VTKIOENSIGHT_EXPORT vtkEnSightGoldBinaryReader : public vtkEnSightReader
53 {
54 public:
57  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
58 
59 protected:
62 
63  // Returns 1 if successful. Sets file size as a side action.
64  int OpenFile(const char* filename);
65 
66 
67  // Returns 1 if successful. Handles constructing the filename, opening the file and checking
68  // if it's binary
69  int InitializeFile(const char* filename);
70 
74  virtual int ReadGeometryFile(const char* fileName, int timeStep,
75  vtkMultiBlockDataSet *output);
76 
81  virtual int ReadMeasuredGeometryFile(const char* fileName, int timeStep,
82  vtkMultiBlockDataSet *output);
83 
89  virtual int ReadScalarsPerNode(const char* fileName, const char* description,
90  int timeStep, vtkMultiBlockDataSet *output,
91  int measured = 0,
92  int numberOfComponents = 1,
93  int component = 0);
94 
99  virtual int ReadVectorsPerNode(const char* fileName, const char* description,
100  int timeStep, vtkMultiBlockDataSet *output,
101  int measured = 0);
102 
107  virtual int ReadTensorsPerNode(const char* fileName, const char* description,
108  int timeStep, vtkMultiBlockDataSet *output);
109 
115  virtual int ReadScalarsPerElement(const char* fileName, const char* description,
116  int timeStep, vtkMultiBlockDataSet *output,
117  int numberOfComponents = 1,
118  int component = 0);
119 
124  virtual int ReadVectorsPerElement(const char* fileName, const char* description,
125  int timeStep, vtkMultiBlockDataSet *output);
126 
131  virtual int ReadTensorsPerElement(const char* fileName, const char* description,
132  int timeStep, vtkMultiBlockDataSet *output);
133 
139  virtual int CreateUnstructuredGridOutput(int partId,
140  char line[80],
141  const char* name,
142  vtkMultiBlockDataSet *output);
143 
148  virtual int CreateStructuredGridOutput(int partId,
149  char line[256],
150  const char* name,
151  vtkMultiBlockDataSet *output);
152 
157  int CreateRectilinearGridOutput(int partId, char line[256], const char* name,
158  vtkMultiBlockDataSet *output);
159 
164  int CreateImageDataOutput(int partId, char line[80], const char* name,
165  vtkMultiBlockDataSet *output);
166 
171  int ReadLine(char result[80]);
172 
174 
178  int ReadInt(int *result);
179  int ReadPartId(int *result);
181 
186  int ReadIntArray(int *result, int numInts);
187 
192  int ReadLong(vtkTypeInt64 *result);
193 
198  int ReadFloatArray(float *result, int numFloats);
199 
207 
209 
213  int SkipStructuredGrid(char line[256]);
214  int SkipUnstructuredGrid(char line[256]);
215  int SkipRectilinearGrid(char line[256]);
216  int SkipImageData(char line[256]);
218 
222  int SeekToCachedTimeStep(const char* fileName, int realTimeStep);
223 
227  void AddTimeStepToCache(const char* fileName, int realTimeStep, vtkTypeInt64 address);
228 
232  void AddFileIndexToCache(const char* fileName);
233 
236  int Fortran;
237 
238  ifstream *IFile;
239  // The size of the file could be used to choose byte order.
241 
242  class FileOffsetMapInternal;
243  FileOffsetMapInternal *FileOffsets;
244 
245 private:
246  int SizeOfInt;
247  vtkEnSightGoldBinaryReader(const vtkEnSightGoldBinaryReader&) VTK_DELETE_FUNCTION;
248  void operator=(const vtkEnSightGoldBinaryReader&) VTK_DELETE_FUNCTION;
249 };
250 
251 #endif
class to read binary EnSight Gold files
int SkipStructuredGrid(char line[256])
virtual int ReadTensorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output)
Read tensors per element for this dataset.
void AddTimeStepToCache(const char *fileName, int realTimeStep, vtkTypeInt64 address)
Add an entry the time step cache.
int InitializeFile(const char *filename)
virtual int ReadScalarsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int numberOfComponents=1, int component=0)
Read scalars per element for this dataset.
int CountTimeSteps()
Counts the number of timesteps in the geometry file This function assumes the file is already open an...
virtual int ReadVectorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int measured=0)
Read vectors per node for this dataset.
virtual int ReadTensorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output)
Read tensors per node for this dataset.
virtual int ReadGeometryFile(const char *fileName, int timeStep, vtkMultiBlockDataSet *output)
Read the geometry file.
void AddFileIndexToCache(const char *fileName)
Read the file index, if available, and add it to the time step cache.
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 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)
int ReadLine(char result[80])
Internal function to read in a line up to 80 characters.
int SkipTimeStep()
Read to the next time step in the geometry file.
virtual int ReadVectorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output)
Read vectors per element for this dataset.
int SkipRectilinearGrid(char line[256])
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int ReadMeasuredGeometryFile(const char *fileName, int timeStep, vtkMultiBlockDataSet *output)
Read the measured geometry file.
virtual int ReadScalarsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int measured=0, int numberOfComponents=1, int component=0)
Read scalars 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])
int ReadFloatArray(float *result, int numFloats)
Internal function to read in a float array.
int ReadIntArray(int *result, int numInts)
Internal function to read in an integer array.
static vtkEnSightGoldBinaryReader * New()
virtual int CreateUnstructuredGridOutput(int partId, char line[80], const char *name, vtkMultiBlockDataSet *output)
Read an unstructured part (partId) from the geometry file and create a vtkUnstructuredGrid output.
int OpenFile(const char *filename)
int SkipImageData(char line[256])
virtual int CreateStructuredGridOutput(int partId, char line[256], const char *name, vtkMultiBlockDataSet *output)
Read a structured part from the geometry file and create a vtkStructuredGrid output.
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:40
Composite dataset that organizes datasets into blocks.
@ component
Definition: vtkX3D.h:175
@ address
Definition: vtkX3D.h:270
@ description
Definition: vtkX3D.h:322
@ name
Definition: vtkX3D.h:219
int vtkIdType
Definition: vtkType.h:287