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 =========================================================================*/
34 #ifndef vtkParticleReader_h
35 #define vtkParticleReader_h
36 
37 #include "vtkIOGeometryModule.h" // For export macro
38 #include "vtkPolyDataAlgorithm.h"
39 
40 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
41 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
42 
43 
44 class VTKIOGEOMETRY_EXPORT vtkParticleReader : public vtkPolyDataAlgorithm
45 {
46 public:
47  static vtkParticleReader *New();
49  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
50 
52 
55  vtkSetStringMacro(FileName);
56  vtkGetStringMacro(FileName);
58 
60 
74  void SetDataByteOrderToBigEndian();
75  void SetDataByteOrderToLittleEndian();
76  int GetDataByteOrder();
77  void SetDataByteOrder(int);
78  const char *GetDataByteOrderAsString();
80 
82 
86  vtkSetMacro(SwapBytes,int);
87  int GetSwapBytes() {return this->SwapBytes;}
88  vtkBooleanMacro(SwapBytes,int);
90 
92 
95  vtkSetMacro(HasScalar,int);
96  vtkGetMacro(HasScalar,int);
97  vtkBooleanMacro(HasScalar,int);
99 
101 
110  vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
111  vtkGetMacro(FileType, int);
112  void SetFileTypeToUnknown() {this->SetFileType(FILE_TYPE_IS_UNKNOWN);}
113  void SetFileTypeToText() {this->SetFileType(FILE_TYPE_IS_TEXT);}
114  void SetFileTypeToBinary() {this->SetFileType(FILE_TYPE_IS_BINARY);}
116 
118 
123  vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
124  vtkGetMacro(DataType, int);
125  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
126  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
128 
129 
130 protected:
132  ~vtkParticleReader() VTK_OVERRIDE;
133 
134  void OpenFile();
135 
136  char *FileName;
137  ifstream *File;
138 
139  int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
140  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
141 
143 
153  int ProduceOutputFromTextFileDouble(vtkInformationVector *outputVector);
154  int ProduceOutputFromTextFileFloat(vtkInformationVector *outputVector);
156 
158 
162  int ProduceOutputFromBinaryFileDouble(vtkInformationVector *outputVector);
163  int ProduceOutputFromBinaryFileFloat(vtkInformationVector *outputVector);
165 
176  int DetermineFileType();
177 
181  void DoProgressUpdate( size_t & bytesRead, size_t & fileLength );
182 
191  enum FILE_TYPE { FILE_TYPE_IS_UNKNOWN = 0,
192  FILE_TYPE_IS_TEXT, FILE_TYPE_IS_BINARY };
193 
198  int FileType;
202  int DataType;
203 
207  size_t Alliquot;
211  size_t Count;
212 
215 
216 private:
217  vtkParticleReader(const vtkParticleReader&) VTK_DELETE_FUNCTION;
218  void operator=(const vtkParticleReader&) VTK_DELETE_FUNCTION;
219 };
220 
221 #endif
FILE_TYPE
Enumerate the supported file types.
int FileType
Used to decide which reader should be used.
size_t Count
Count of the number of alliquots processed.
Store vtkAlgorithm input/output information.
void SetFileTypeToText()
Get/Set the file type.
int GetSwapBytes()
Set/Get the byte swapping to explicitly swap the bytes of a file.
Read ASCII or binary particle data and (optionally) one scalar value associated with each particle...
static vtkPolyDataAlgorithm * New()
#define VTK_DOUBLE
Definition: vtkType.h:59
void SetDataTypeToFloat()
Get/Set the data type.
#define VTK_FLOAT
Definition: vtkType.h:58
Superclass for algorithms that produce only polydata as output.
size_t Alliquot
Set an alliquot of bytes.
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetFileTypeToBinary()
Get/Set the file type.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
void SetDataTypeToDouble()
Get/Set the data type.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetFileTypeToUnknown()
Get/Set the file type.
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
int DataType
Used to specify the data type.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.