VTK
vtkParticleReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkParticleReader.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 =========================================================================*/
39 #ifndef __vtkParticleReader_h
40 #define __vtkParticleReader_h
41 
42 #include "vtkPolyDataAlgorithm.h"
43 
44 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
45 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
46 
47 
49 {
50 public:
51  static vtkParticleReader *New();
53  void PrintSelf(ostream& os, vtkIndent indent);
54 
56 
57  vtkSetStringMacro(FileName);
58  vtkGetStringMacro(FileName);
60 
62 
73  void SetDataByteOrderToBigEndian();
74  void SetDataByteOrderToLittleEndian();
75  int GetDataByteOrder();
76  void SetDataByteOrder(int);
77  const char *GetDataByteOrderAsString();
79 
81 
83  vtkSetMacro(SwapBytes,int);
84  int GetSwapBytes() {return this->SwapBytes;}
85  vtkBooleanMacro(SwapBytes,int);
87 
89 
90  vtkSetMacro(HasScalar,int);
91  vtkGetMacro(HasScalar,int);
92  vtkBooleanMacro(HasScalar,int);
94 
96 
100  vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
101  vtkGetMacro(FileType, int);
102  void SetFileTypeToUnknown() {this->SetFileType(FILE_TYPE_IS_UNKNOWN);}
103  void SetFileTypeToText() {this->SetFileType(FILE_TYPE_IS_TEXT);}
104  void SetFileTypeToBinary() {this->SetFileType(FILE_TYPE_IS_BINARY);}
106 
108 
111  vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
112  vtkGetMacro(DataType, int);
113  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
114  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
116 
117 
118 protected:
121 
122  void OpenFile();
123 
124  char *FileName;
125  ifstream *File;
126 
129 
131 
139  int ProduceOutputFromTextFileDouble(vtkInformationVector *outputVector);
140  int ProduceOutputFromTextFileFloat(vtkInformationVector *outputVector);
142 
144 
146  int ProduceOutputFromBinaryFileDouble(vtkInformationVector *outputVector);
147  int ProduceOutputFromBinaryFileFloat(vtkInformationVector *outputVector);
149 
159  int DetermineFileType();
160 
162  void DoProgressUpdate( size_t & bytesRead, size_t & fileLength );
163 
164  //BTX
166 
170  enum FILE_TYPE { FILE_TYPE_IS_UNKNOWN = 0,
171  FILE_TYPE_IS_TEXT, FILE_TYPE_IS_BINARY };
172  //ETX
174 
177 
178  int FileType;
179  // Description:
180  // Used to specify the data type.
181  int DataType;
183 
185 
186  size_t Alliquot;
187  // Description:
188  // Count of the number of alliquots processed.
189  size_t Count;
191 
194 
195 private:
196  vtkParticleReader(const vtkParticleReader&); // Not implemented.
197  void operator=(const vtkParticleReader&); // Not implemented.
198 };
199 
200 #endif