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=========================================================================*/
40#ifndef vtkParticleReader_h
41#define vtkParticleReader_h
42
43#include "vtkIOGeometryModule.h" // For export macro
45
46#define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
47#define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
48
49
50class VTKIOGEOMETRY_EXPORT vtkParticleReader : public vtkPolyDataAlgorithm
51{
52public:
55 void PrintSelf(ostream& os, vtkIndent indent);
56
58
61 vtkSetStringMacro(FileName);
64
66
86
88
92 vtkSetMacro(SwapBytes,int);
93 int GetSwapBytes() {return this->SwapBytes;}
94 vtkBooleanMacro(SwapBytes,int);
96
98
101 vtkSetMacro(HasScalar,int);
102 vtkGetMacro(HasScalar,int);
103 vtkBooleanMacro(HasScalar,int);
105
107
116 vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
117 vtkGetMacro(FileType, int);
118 void SetFileTypeToUnknown() {this->SetFileType(FILE_TYPE_IS_UNKNOWN);}
119 void SetFileTypeToText() {this->SetFileType(FILE_TYPE_IS_TEXT);}
120 void SetFileTypeToBinary() {this->SetFileType(FILE_TYPE_IS_BINARY);}
122
124
129 vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
130 vtkGetMacro(DataType, int);
131 void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
132 void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
134
135
136protected:
139
140 void OpenFile();
141
142 char *FileName;
143 ifstream *File;
144
147
149
162
164
171
183
187 void DoProgressUpdate( size_t & bytesRead, size_t & fileLength );
188
197 enum FILE_TYPE { FILE_TYPE_IS_UNKNOWN = 0,
198 FILE_TYPE_IS_TEXT, FILE_TYPE_IS_BINARY };
199
209
213 size_t Alliquot;
217 size_t Count;
218
221
222private:
223 vtkParticleReader(const vtkParticleReader&) VTK_DELETE_FUNCTION;
224 void operator=(const vtkParticleReader&) VTK_DELETE_FUNCTION;
225};
226
227#endif
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Read ASCII or binary particle data and (optionally) one scalar value associated with each particle.
void SetDataByteOrder(int)
size_t Count
Count of the number of alliquots processed.
size_t Alliquot
Set an alliquot of bytes.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
int ProduceOutputFromBinaryFileDouble(vtkInformationVector *outputVector)
This reader assumes that the file is binary and consists of floating point values by default.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
const char * GetDataByteOrderAsString()
int ProduceOutputFromTextFileDouble(vtkInformationVector *outputVector)
The format that will be read if the file is a text file is: x, y, z, s (where s is some scalar value ...
int FileType
Used to decide which reader should be used.
int ProduceOutputFromTextFileFloat(vtkInformationVector *outputVector)
int DetermineFileType()
Determine the type of file based on an analysis of its contents.
FILE_TYPE
Enumerate the supported file types.
void SetDataByteOrderToLittleEndian()
void DoProgressUpdate(size_t &bytesRead, size_t &fileLength)
Update of the progress.
int DataType
Used to specify the data type.
int ProduceOutputFromBinaryFileFloat(vtkInformationVector *outputVector)
void SetDataByteOrderToBigEndian()
These methods should be used instead of the SwapBytes methods.
static vtkParticleReader * New()
Superclass for algorithms that produce only polydata as output.
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define VTK_DOUBLE
Definition: vtkType.h:59
#define VTK_FLOAT
Definition: vtkType.h:58