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 "vtkIOGeometryModule.h" // For export macro
43 #include "vtkPolyDataAlgorithm.h"
44 
45 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
46 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
47 
48 
50 {
51 public:
52  static vtkParticleReader *New();
54  void PrintSelf(ostream& os, vtkIndent indent);
55 
57 
58  vtkSetStringMacro(FileName);
59  vtkGetStringMacro(FileName);
61 
63 
74  void SetDataByteOrderToBigEndian();
75  void SetDataByteOrderToLittleEndian();
76  int GetDataByteOrder();
77  void SetDataByteOrder(int);
78  const char *GetDataByteOrderAsString();
80 
82 
84  vtkSetMacro(SwapBytes,int);
85  int GetSwapBytes() {return this->SwapBytes;}
86  vtkBooleanMacro(SwapBytes,int);
88 
90 
91  vtkSetMacro(HasScalar,int);
92  vtkGetMacro(HasScalar,int);
93  vtkBooleanMacro(HasScalar,int);
95 
97 
101  vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
102  vtkGetMacro(FileType, int);
103  void SetFileTypeToUnknown() {this->SetFileType(FILE_TYPE_IS_UNKNOWN);}
104  void SetFileTypeToText() {this->SetFileType(FILE_TYPE_IS_TEXT);}
105  void SetFileTypeToBinary() {this->SetFileType(FILE_TYPE_IS_BINARY);}
107 
109 
112  vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
113  vtkGetMacro(DataType, int);
114  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
115  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
117 
118 
119 protected:
122 
123  void OpenFile();
124 
125  char *FileName;
126  ifstream *File;
127 
130 
132 
140  int ProduceOutputFromTextFileDouble(vtkInformationVector *outputVector);
141  int ProduceOutputFromTextFileFloat(vtkInformationVector *outputVector);
143 
145 
147  int ProduceOutputFromBinaryFileDouble(vtkInformationVector *outputVector);
148  int ProduceOutputFromBinaryFileFloat(vtkInformationVector *outputVector);
150 
160  int DetermineFileType();
161 
163  void DoProgressUpdate( size_t & bytesRead, size_t & fileLength );
164 
165  //BTX
167 
171  enum FILE_TYPE { FILE_TYPE_IS_UNKNOWN = 0,
172  FILE_TYPE_IS_TEXT, FILE_TYPE_IS_BINARY };
173  //ETX
175 
178  int FileType;
180  int DataType;
181 
183  size_t Alliquot;
185  size_t Count;
186 
189 
190 private:
191  vtkParticleReader(const vtkParticleReader&); // Not implemented.
192  void operator=(const vtkParticleReader&); // Not implemented.
193 };
194 
195 #endif
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTKIOGEOMETRY_EXPORT
Read ASCII or binary particle data and (optionally) one scalar value associated with each particle...
static vtkPolyDataAlgorithm * New()
#define VTK_DOUBLE
Definition: vtkType.h:36
void PrintSelf(ostream &os, vtkIndent indent)
#define VTK_FLOAT
Definition: vtkType.h:35
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store zero or more vtkInformation instances.