VTK
dox/IO/EnSight/vtkEnSightGoldBinaryReader.h
Go to the documentation of this file.
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 class vtkMultiBlockDataSet;
00049 
00050 class VTKIOENSIGHT_EXPORT vtkEnSightGoldBinaryReader : public vtkEnSightReader
00051 {
00052 public:
00053   static vtkEnSightGoldBinaryReader *New();
00054   vtkTypeMacro(vtkEnSightGoldBinaryReader, vtkEnSightReader);
00055   virtual void PrintSelf(ostream& os, vtkIndent indent);
00056 
00057 protected:
00058   vtkEnSightGoldBinaryReader();
00059   ~vtkEnSightGoldBinaryReader();
00060 
00061   // Returns 1 if successful.  Sets file size as a side action.
00062   int OpenFile(const char* filename);
00063 
00064 
00065   // Returns 1 if successful.  Handles constructing the filename, opening the file and checking
00066   // if it's binary
00067   int InitializeFile(const char* filename);
00068 
00070 
00072   virtual int ReadGeometryFile(const char* fileName, int timeStep,
00073     vtkMultiBlockDataSet *output);
00075 
00077 
00079   virtual int ReadMeasuredGeometryFile(const char* fileName, int timeStep,
00080     vtkMultiBlockDataSet *output);
00082 
00084 
00087   virtual int ReadScalarsPerNode(const char* fileName, const char* description,
00088     int timeStep, vtkMultiBlockDataSet *output,
00089     int measured = 0, int numberOfComponents = 1,
00090     int component = 0);
00092 
00094 
00096   virtual int ReadVectorsPerNode(const char* fileName, const char* description,
00097     int timeStep, vtkMultiBlockDataSet *output,
00098     int measured = 0);
00100 
00102 
00104   virtual int ReadTensorsPerNode(const char* fileName, const char* description,
00105     int timeStep, vtkMultiBlockDataSet *output);
00107 
00109 
00112   virtual int ReadScalarsPerElement(const char* fileName, const char* description,
00113     int timeStep, vtkMultiBlockDataSet *output,
00114     int numberOfComponents = 1,
00115     int component = 0);
00117 
00119 
00121   virtual int ReadVectorsPerElement(const char* fileName, const char* description,
00122     int timeStep, vtkMultiBlockDataSet *output);
00124 
00126 
00128   virtual int ReadTensorsPerElement(const char* fileName, const char* description,
00129     int timeStep, vtkMultiBlockDataSet *output);
00131 
00133 
00136   virtual int CreateUnstructuredGridOutput(int partId,
00137     char line[80],
00138     const char* name,
00139     vtkMultiBlockDataSet *output);
00141 
00143 
00145   virtual int CreateStructuredGridOutput(int partId,
00146     char line[256],
00147     const char* name,
00148     vtkMultiBlockDataSet *output);
00150 
00152 
00154   int CreateRectilinearGridOutput(int partId, char line[256], const char* name,
00155     vtkMultiBlockDataSet *output);
00157 
00159 
00161   int CreateImageDataOutput(int partId, char line[80], const char* name,
00162     vtkMultiBlockDataSet *output);
00164 
00167   int ReadLine(char result[80]);
00168 
00170 
00172   int ReadInt(int *result);
00173   int ReadPartId(int *result);
00175 
00178   int ReadIntArray(int *result, int numInts);
00179 
00182   int ReadFloatArray(float *result, int numFloats);
00183 
00188   int CountTimeSteps();
00189 
00191 
00192   int SkipTimeStep();
00193   int SkipStructuredGrid(char line[256]);
00194   int SkipUnstructuredGrid(char line[256]);
00195   int SkipRectilinearGrid(char line[256]);
00196   int SkipImageData(char line[256]);
00198 
00199   int NodeIdsListed;
00200   int ElementIdsListed;
00201   int Fortran;
00202 
00203   ifstream *IFile;
00204   // The size of the file could be used to choose byte order.
00205   vtkIdType FileSize;
00206 
00207 private:
00208   int SizeOfInt;
00209   vtkEnSightGoldBinaryReader(const vtkEnSightGoldBinaryReader&);  // Not implemented.
00210   void operator=(const vtkEnSightGoldBinaryReader&);  // Not implemented.
00211 };
00212 
00213 #endif