VTK  9.2.6
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
44 #include "vtkPolyDataAlgorithm.h"
45 
46 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
47 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
48 
49 class VTKIOGEOMETRY_EXPORT vtkParticleReader : public vtkPolyDataAlgorithm
50 {
51 public:
52  static vtkParticleReader* New();
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
57 
60  vtkSetFilePathMacro(FileName);
61  vtkGetFilePathMacro(FileName);
63 
65 
79  void SetDataByteOrderToBigEndian();
80  void SetDataByteOrderToLittleEndian();
81  int GetDataByteOrder();
82  void SetDataByteOrder(int);
83  const char* GetDataByteOrderAsString();
85 
87 
91  vtkSetMacro(SwapBytes, vtkTypeBool);
92  vtkTypeBool GetSwapBytes() { return this->SwapBytes; }
93  vtkBooleanMacro(SwapBytes, vtkTypeBool);
95 
97 
100  vtkSetMacro(HasScalar, vtkTypeBool);
101  vtkGetMacro(HasScalar, vtkTypeBool);
102  vtkBooleanMacro(HasScalar, vtkTypeBool);
104 
106 
115  vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
116  vtkGetMacro(FileType, int);
117  void SetFileTypeToUnknown() { this->SetFileType(FILE_TYPE_IS_UNKNOWN); }
118  void SetFileTypeToText() { this->SetFileType(FILE_TYPE_IS_TEXT); }
119  void SetFileTypeToBinary() { this->SetFileType(FILE_TYPE_IS_BINARY); }
121 
123 
128  vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
129  vtkGetMacro(DataType, int);
130  void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
131  void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
133 
134 protected:
136  ~vtkParticleReader() override;
137 
138  void OpenFile();
139 
140  char* FileName;
141  istream* File;
142 
145 
147 
157  int ProduceOutputFromTextFileDouble(vtkInformationVector* outputVector);
158  int ProduceOutputFromTextFileFloat(vtkInformationVector* outputVector);
160 
162 
166  int ProduceOutputFromBinaryFileDouble(vtkInformationVector* outputVector);
167  int ProduceOutputFromBinaryFileFloat(vtkInformationVector* outputVector);
169 
180  int DetermineFileType();
181 
185  void DoProgressUpdate(size_t& bytesRead, size_t& fileLength);
186 
195  {
196  FILE_TYPE_IS_UNKNOWN = 0,
198  FILE_TYPE_IS_BINARY
199  };
200 
205  int FileType;
209  int DataType;
210 
214  size_t Alliquot;
218  size_t Count;
219 
222 
223 private:
224  vtkParticleReader(const vtkParticleReader&) = delete;
225  void operator=(const vtkParticleReader&) = delete;
226 };
227 
228 #endif
FILE_TYPE
Enumerate the supported file types.
vtkTypeBool GetSwapBytes()
Set/Get the byte swapping to explicitly swap the bytes of a file.
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.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void SetFileTypeToText()
Get/Set the file type.
Read ASCII or binary particle data and (optionally) one scalar value associated with each particle...
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE
Definition: vtkType.h:55
void SetDataTypeToFloat()
Get/Set the data type.
#define VTK_FLOAT
Definition: vtkType.h:54
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:39
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void SetFileTypeToBinary()
Get/Set the file type.
void SetDataTypeToDouble()
Get/Set the data type.
void SetFileTypeToUnknown()
Get/Set the file type.
Store zero or more vtkInformation instances.
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.