00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00039 #ifndef __vtkParticleReader_h
00040 #define __vtkParticleReader_h
00041
00042 #include "vtkPolyDataAlgorithm.h"
00043
00044 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00045 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00046
00047
00048 class VTK_IO_EXPORT vtkParticleReader : public vtkPolyDataAlgorithm
00049 {
00050 public:
00051 static vtkParticleReader *New();
00052 vtkTypeMacro(vtkParticleReader,vtkPolyDataAlgorithm);
00053 void PrintSelf(ostream& os, vtkIndent indent);
00054
00056
00057 vtkSetStringMacro(FileName);
00058 vtkGetStringMacro(FileName);
00060
00062
00073 void SetDataByteOrderToBigEndian();
00074 void SetDataByteOrderToLittleEndian();
00075 int GetDataByteOrder();
00076 void SetDataByteOrder(int);
00077 const char *GetDataByteOrderAsString();
00079
00081
00083 vtkSetMacro(SwapBytes,int);
00084 int GetSwapBytes() {return this->SwapBytes;}
00085 vtkBooleanMacro(SwapBytes,int);
00087
00089
00090 vtkSetMacro(HasScalar,int);
00091 vtkGetMacro(HasScalar,int);
00092 vtkBooleanMacro(HasScalar,int);
00094
00096
00100 vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
00101 vtkGetMacro(FileType, int);
00102 void SetFileTypeToUnknown() {this->SetFileType(FILE_TYPE_IS_UNKNOWN);}
00103 void SetFileTypeToText() {this->SetFileType(FILE_TYPE_IS_TEXT);}
00104 void SetFileTypeToBinary() {this->SetFileType(FILE_TYPE_IS_BINARY);}
00106
00108
00111 vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
00112 vtkGetMacro(DataType, int);
00113 void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
00114 void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
00116
00117
00118 protected:
00119 vtkParticleReader();
00120 ~vtkParticleReader();
00121
00122 void OpenFile();
00123
00124 char *FileName;
00125 ifstream *File;
00126
00127 int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00128 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00129
00131
00139 int ProduceOutputFromTextFileDouble(vtkInformationVector *outputVector);
00140 int ProduceOutputFromTextFileFloat(vtkInformationVector *outputVector);
00142
00144
00146 int ProduceOutputFromBinaryFileDouble(vtkInformationVector *outputVector);
00147 int ProduceOutputFromBinaryFileFloat(vtkInformationVector *outputVector);
00149
00159 int DetermineFileType();
00160
00162 void DoProgressUpdate( size_t & bytesRead, size_t & fileLength );
00163
00164
00166
00170 enum FILE_TYPE { FILE_TYPE_IS_UNKNOWN = 0,
00171 FILE_TYPE_IS_TEXT, FILE_TYPE_IS_BINARY };
00172
00174
00175 int HasScalar;
00177
00178 int FileType;
00179
00180
00181 int DataType;
00183
00185
00186 size_t Alliquot;
00187
00188
00189 size_t Count;
00191
00192 int SwapBytes;
00193 size_t NumberOfPoints;
00194
00195 private:
00196 vtkParticleReader(const vtkParticleReader&);
00197 void operator=(const vtkParticleReader&);
00198 };
00199
00200 #endif