VTK  9.1.0
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 =========================================================================*/
53 #ifndef vtkParticleReader_h
54 #define vtkParticleReader_h
55 
56 #include "vtkIOGeometryModule.h" // For export macro
57 #include "vtkPolyDataAlgorithm.h"
58 
59 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
60 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
61 
62 class VTKIOGEOMETRY_EXPORT vtkParticleReader : public vtkPolyDataAlgorithm
63 {
64 public:
67  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
70 
76 
78 
95  void SetDataByteOrder(int);
96  const char* GetDataByteOrderAsString();
98 
100 
104  vtkSetMacro(SwapBytes, vtkTypeBool);
105  vtkTypeBool GetSwapBytes() { return this->SwapBytes; }
106  vtkBooleanMacro(SwapBytes, vtkTypeBool);
108 
110 
113  vtkSetMacro(HasScalar, vtkTypeBool);
114  vtkGetMacro(HasScalar, vtkTypeBool);
115  vtkBooleanMacro(HasScalar, vtkTypeBool);
117 
119 
128  vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
129  vtkGetMacro(FileType, int);
130  void SetFileTypeToUnknown() { this->SetFileType(FILE_TYPE_IS_UNKNOWN); }
131  void SetFileTypeToText() { this->SetFileType(FILE_TYPE_IS_TEXT); }
132  void SetFileTypeToBinary() { this->SetFileType(FILE_TYPE_IS_BINARY); }
134 
136 
141  vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
142  vtkGetMacro(DataType, int);
143  void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
144  void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
146 
147 protected:
149  ~vtkParticleReader() override;
150 
151  void OpenFile();
152 
153  char* FileName;
154  istream* File;
155 
158 
160 
173 
175 
182 
194 
198  void DoProgressUpdate(size_t& bytesRead, size_t& fileLength);
199 
208  {
209  FILE_TYPE_IS_UNKNOWN = 0,
211  FILE_TYPE_IS_BINARY
212  };
213 
218  int FileType;
222  int DataType;
223 
227  size_t Alliquot;
231  size_t Count;
232 
235 
236 private:
237  vtkParticleReader(const vtkParticleReader&) = delete;
238  void operator=(const vtkParticleReader&) = delete;
239 };
240 
241 #endif
vtkParticleReader::GetSwapBytes
vtkTypeBool GetSwapBytes()
Set/Get the byte swapping to explicitly swap the bytes of a file.
Definition: vtkParticleReader.h:105
vtkParticleReader::~vtkParticleReader
~vtkParticleReader() override
vtkParticleReader::SetDataByteOrder
void SetDataByteOrder(int)
These methods should be used instead of the SwapBytes methods.
vtkParticleReader::vtkSetFilePathMacro
vtkSetFilePathMacro(FileName)
Specify file name.
vtkParticleReader::DetermineFileType
int DetermineFileType()
Determine the type of file based on an analysis of its contents.
vtkParticleReader::DoProgressUpdate
void DoProgressUpdate(size_t &bytesRead, size_t &fileLength)
Update of the progress.
vtkParticleReader::SetDataByteOrderToLittleEndian
void SetDataByteOrderToLittleEndian()
These methods should be used instead of the SwapBytes methods.
vtkParticleReader::FILE_TYPE_IS_TEXT
@ FILE_TYPE_IS_TEXT
Definition: vtkParticleReader.h:210
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkParticleReader::File
istream * File
Definition: vtkParticleReader.h:154
vtkParticleReader::GetDataByteOrder
int GetDataByteOrder()
These methods should be used instead of the SwapBytes methods.
vtkParticleReader::NumberOfPoints
size_t NumberOfPoints
Definition: vtkParticleReader.h:234
vtkParticleReader::OpenFile
void OpenFile()
vtkParticleReader::FileType
int FileType
Used to decide which reader should be used.
Definition: vtkParticleReader.h:218
vtkParticleReader::ProduceOutputFromTextFileFloat
int ProduceOutputFromTextFileFloat(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 ...
vtkPolyDataAlgorithm.h
vtkParticleReader::SetFileTypeToText
void SetFileTypeToText()
Get/Set the file type.
Definition: vtkParticleReader.h:131
vtkParticleReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkParticleReader::ProduceOutputFromTextFileDouble
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 ...
vtkParticleReader::vtkGetFilePathMacro
vtkGetFilePathMacro(FileName)
Specify file name.
vtkParticleReader::SetDataTypeToFloat
void SetDataTypeToFloat()
Get/Set the data type.
Definition: vtkParticleReader.h:143
vtkParticleReader::Alliquot
size_t Alliquot
Set an alliquot of bytes.
Definition: vtkParticleReader.h:227
vtkParticleReader::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkParticleReader::FileName
char * FileName
Definition: vtkParticleReader.h:153
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:54
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:55
vtkParticleReader::vtkParticleReader
vtkParticleReader()
vtkParticleReader::SetFileTypeToUnknown
void SetFileTypeToUnknown()
Get/Set the file type.
Definition: vtkParticleReader.h:130
vtkParticleReader
Read ASCII or binary particle data and (optionally) one scalar value associated with each particle.
Definition: vtkParticleReader.h:63
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkParticleReader::SetDataByteOrderToBigEndian
void SetDataByteOrderToBigEndian()
These methods should be used instead of the SwapBytes methods.
vtkParticleReader::New
static vtkParticleReader * New()
vtkParticleReader::SetFileTypeToBinary
void SetFileTypeToBinary()
Get/Set the file type.
Definition: vtkParticleReader.h:132
vtkParticleReader::ProduceOutputFromBinaryFileFloat
int ProduceOutputFromBinaryFileFloat(vtkInformationVector *outputVector)
This reader assumes that the file is binary and consists of floating point values by default.
vtkParticleReader::SwapBytes
vtkTypeBool SwapBytes
Definition: vtkParticleReader.h:233
vtkParticleReader::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkParticleReader::SetDataTypeToDouble
void SetDataTypeToDouble()
Get/Set the data type.
Definition: vtkParticleReader.h:144
vtkParticleReader::DataType
int DataType
Used to specify the data type.
Definition: vtkParticleReader.h:222
vtkParticleReader::HasScalar
vtkTypeBool HasScalar
Definition: vtkParticleReader.h:214
vtkParticleReader::FILE_TYPE
FILE_TYPE
Enumerate the supported file types.
Definition: vtkParticleReader.h:208
vtkParticleReader::GetDataByteOrderAsString
const char * GetDataByteOrderAsString()
These methods should be used instead of the SwapBytes methods.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkParticleReader::ProduceOutputFromBinaryFileDouble
int ProduceOutputFromBinaryFileDouble(vtkInformationVector *outputVector)
This reader assumes that the file is binary and consists of floating point values by default.
vtkParticleReader::Count
size_t Count
Count of the number of alliquots processed.
Definition: vtkParticleReader.h:231
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:151