VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkEnSightGoldBinaryReader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00042 #ifndef vtkEnSightGoldBinaryReader_h 00043 #define vtkEnSightGoldBinaryReader_h 00044 00045 #include "vtkIOEnSightModule.h" // For export macro 00046 #include "vtkEnSightReader.h" 00047 00048 00049 class vtkMultiBlockDataSet; 00050 00051 class VTKIOENSIGHT_EXPORT vtkEnSightGoldBinaryReader : public vtkEnSightReader 00052 { 00053 public: 00054 static vtkEnSightGoldBinaryReader *New(); 00055 vtkTypeMacro(vtkEnSightGoldBinaryReader, vtkEnSightReader); 00056 virtual void PrintSelf(ostream& os, vtkIndent indent); 00057 00058 protected: 00059 vtkEnSightGoldBinaryReader(); 00060 ~vtkEnSightGoldBinaryReader(); 00061 00062 // Returns 1 if successful. Sets file size as a side action. 00063 int OpenFile(const char* filename); 00064 00065 00066 // Returns 1 if successful. Handles constructing the filename, opening the file and checking 00067 // if it's binary 00068 int InitializeFile(const char* filename); 00069 00071 00073 virtual int ReadGeometryFile(const char* fileName, int timeStep, 00074 vtkMultiBlockDataSet *output); 00076 00078 00080 virtual int ReadMeasuredGeometryFile(const char* fileName, int timeStep, 00081 vtkMultiBlockDataSet *output); 00083 00085 00088 virtual int ReadScalarsPerNode(const char* fileName, const char* description, 00089 int timeStep, vtkMultiBlockDataSet *output, 00090 int measured = 0, 00091 int numberOfComponents = 1, 00092 int component = 0); 00094 00096 00098 virtual int ReadVectorsPerNode(const char* fileName, const char* description, 00099 int timeStep, vtkMultiBlockDataSet *output, 00100 int measured = 0); 00102 00104 00106 virtual int ReadTensorsPerNode(const char* fileName, const char* description, 00107 int timeStep, vtkMultiBlockDataSet *output); 00109 00111 00114 virtual int ReadScalarsPerElement(const char* fileName, const char* description, 00115 int timeStep, vtkMultiBlockDataSet *output, 00116 int numberOfComponents = 1, 00117 int component = 0); 00119 00121 00123 virtual int ReadVectorsPerElement(const char* fileName, const char* description, 00124 int timeStep, vtkMultiBlockDataSet *output); 00126 00128 00130 virtual int ReadTensorsPerElement(const char* fileName, const char* description, 00131 int timeStep, vtkMultiBlockDataSet *output); 00133 00135 00138 virtual int CreateUnstructuredGridOutput(int partId, 00139 char line[80], 00140 const char* name, 00141 vtkMultiBlockDataSet *output); 00143 00145 00147 virtual int CreateStructuredGridOutput(int partId, 00148 char line[256], 00149 const char* name, 00150 vtkMultiBlockDataSet *output); 00152 00154 00156 int CreateRectilinearGridOutput(int partId, char line[256], const char* name, 00157 vtkMultiBlockDataSet *output); 00159 00161 00163 int CreateImageDataOutput(int partId, char line[80], const char* name, 00164 vtkMultiBlockDataSet *output); 00166 00169 int ReadLine(char result[80]); 00170 00172 00174 int ReadInt(int *result); 00175 int ReadPartId(int *result); 00177 00180 int ReadIntArray(int *result, int numInts); 00181 00184 int ReadLong(vtkTypeInt64 *result); 00185 00188 int ReadFloatArray(float *result, int numFloats); 00189 00194 int CountTimeSteps(); 00195 00197 00198 int SkipTimeStep(); 00199 int SkipStructuredGrid(char line[256]); 00200 int SkipUnstructuredGrid(char line[256]); 00201 int SkipRectilinearGrid(char line[256]); 00202 int SkipImageData(char line[256]); 00204 00207 int SeekToCachedTimeStep(const char* fileName, int realTimeStep); 00208 00210 void AddTimeStepToCache(const char* fileName, int realTimeStep, vtkTypeInt64 address); 00211 00213 void AddFileIndexToCache(const char* fileName); 00214 00215 int NodeIdsListed; 00216 int ElementIdsListed; 00217 int Fortran; 00218 00219 ifstream *IFile; 00220 // The size of the file could be used to choose byte order. 00221 vtkIdType FileSize; 00222 00223 //BTX 00224 class FileOffsetMapInternal; 00225 FileOffsetMapInternal *FileOffsets; 00226 //ETX 00227 00228 private: 00229 int SizeOfInt; 00230 vtkEnSightGoldBinaryReader(const vtkEnSightGoldBinaryReader&); // Not implemented. 00231 void operator=(const vtkEnSightGoldBinaryReader&); // Not implemented. 00232 }; 00233 00234 #endif