VTK  9.3.20240419
vtkParticleReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
47 #ifndef vtkParticleReader_h
48 #define vtkParticleReader_h
49 
50 #include "vtkIOGeometryModule.h" // For export macro
51 #include "vtkPolyDataAlgorithm.h"
52 
53 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
54 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
55 
56 VTK_ABI_NAMESPACE_BEGIN
57 class VTKIOGEOMETRY_EXPORT vtkParticleReader : public vtkPolyDataAlgorithm
58 {
59 public:
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
65 
71 
73 
90  void SetDataByteOrder(int);
91  const char* GetDataByteOrderAsString();
93 
95 
99  vtkSetMacro(SwapBytes, vtkTypeBool);
100  vtkTypeBool GetSwapBytes() { return this->SwapBytes; }
101  vtkBooleanMacro(SwapBytes, vtkTypeBool);
103 
105 
108  vtkSetMacro(HasScalar, vtkTypeBool);
109  vtkGetMacro(HasScalar, vtkTypeBool);
110  vtkBooleanMacro(HasScalar, vtkTypeBool);
112 
114 
123  vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
124  vtkGetMacro(FileType, int);
125  void SetFileTypeToUnknown() { this->SetFileType(FILE_TYPE_IS_UNKNOWN); }
126  void SetFileTypeToText() { this->SetFileType(FILE_TYPE_IS_TEXT); }
127  void SetFileTypeToBinary() { this->SetFileType(FILE_TYPE_IS_BINARY); }
129 
131 
136  vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
137  vtkGetMacro(DataType, int);
138  void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
139  void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
141 
142 protected:
144  ~vtkParticleReader() override;
145 
146  void OpenFile();
147 
148  char* FileName;
149  istream* File;
150 
153 
155 
168 
170 
177 
189 
193  void DoProgressUpdate(size_t& bytesRead, size_t& fileLength);
194 
203  {
204  FILE_TYPE_IS_UNKNOWN = 0,
206  FILE_TYPE_IS_BINARY
207  };
208 
213  int FileType;
217  int DataType;
218 
222  size_t Alliquot;
226  size_t Count;
227 
230 
231 private:
232  vtkParticleReader(const vtkParticleReader&) = delete;
233  void operator=(const vtkParticleReader&) = delete;
234 };
235 
236 VTK_ABI_NAMESPACE_END
237 #endif
a simple class to control print indentation
Definition: vtkIndent.h:108
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)
These methods should be used instead of the SwapBytes methods.
size_t Count
Count of the number of alliquots processed.
size_t Alliquot
Set an alliquot of bytes.
int ProduceOutputFromBinaryFileDouble(vtkInformationVector *outputVector)
This reader assumes that the file is binary and consists of floating point values by default.
int GetDataByteOrder()
These methods should be used instead of the SwapBytes methods.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkTypeBool GetSwapBytes()
Set/Get the byte swapping to explicitly swap the bytes of a file.
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 ...
void SetFileTypeToText()
Get/Set the file type.
vtkGetFilePathMacro(FileName)
Specify file name.
int FileType
Used to decide which reader should be used.
static vtkParticleReader * New()
vtkSetFilePathMacro(FileName)
Specify file name.
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 ...
int DetermineFileType()
Determine the type of file based on an analysis of its contents.
FILE_TYPE
Enumerate the supported file types.
void SetDataByteOrderToLittleEndian()
These methods should be used instead of the SwapBytes methods.
void SetDataTypeToDouble()
Get/Set the data type.
void SetFileTypeToBinary()
Get/Set the file type.
void DoProgressUpdate(size_t &bytesRead, size_t &fileLength)
Update of the progress.
void SetDataTypeToFloat()
Get/Set the data type.
~vtkParticleReader() override
const char * GetDataByteOrderAsString()
These methods should be used instead of the SwapBytes methods.
int DataType
Used to specify the data type.
int ProduceOutputFromBinaryFileFloat(vtkInformationVector *outputVector)
This reader assumes that the file is binary and consists of floating point values by default.
void SetFileTypeToUnknown()
Get/Set the file type.
void SetDataByteOrderToBigEndian()
These methods should be used instead of the SwapBytes methods.
Superclass for algorithms that produce only polydata as output.
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DOUBLE
Definition: vtkType.h:43
#define VTK_FLOAT
Definition: vtkType.h:42