/usr/include/vtk-7.1/vtkParticleReader.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkParticleReader.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkParticleReader
* @brief Read ASCII or binary particle
* data and (optionally) one scalar
* value associated with each particle.
*
* vtkParticleReader reads either a binary or a text file of
* particles. Each particle can have associated with it an optional
* scalar value. So the format is: x, y, z, scalar
* (all floats or doubles). The text file can consist of a comma
* delimited set of values. In most cases vtkParticleReader can
* automatically determine whether the file is text or binary.
* The data can be either float or double.
* Progress updates are provided.
* With respect to binary files, random access into the file to read
* pieces is supported.
*
*/
#ifndef vtkParticleReader_h
#define vtkParticleReader_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkPolyDataAlgorithm.h"
#define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
#define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
class VTKIOGEOMETRY_EXPORT vtkParticleReader : public vtkPolyDataAlgorithm
{
public:
static vtkParticleReader *New();
vtkTypeMacro(vtkParticleReader,vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
//@{
/**
* Specify file name.
*/
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
//@}
//@{
/**
* These methods should be used instead of the SwapBytes methods.
* They indicate the byte ordering of the file you are trying
* to read in. These methods will then either swap or not swap
* the bytes depending on the byte ordering of the machine it is
* being run on. For example, reading in a BigEndian file on a
* BigEndian machine will result in no swapping. Trying to read
* the same file on a LittleEndian machine will result in swapping.
* As a quick note most UNIX machines are BigEndian while PC's
* and VAX tend to be LittleEndian. So if the file you are reading
* in was generated on a VAX or PC, SetDataByteOrderToLittleEndian
* otherwise SetDataByteOrderToBigEndian. Not used when reading
* text files.
*/
void SetDataByteOrderToBigEndian();
void SetDataByteOrderToLittleEndian();
int GetDataByteOrder();
void SetDataByteOrder(int);
const char *GetDataByteOrderAsString();
//@}
//@{
/**
* Set/Get the byte swapping to explicitly swap the bytes of a file.
* Not used when reading text files.
*/
vtkSetMacro(SwapBytes,int);
int GetSwapBytes() {return this->SwapBytes;}
vtkBooleanMacro(SwapBytes,int);
//@}
//@{
/**
* Default: 1. If 1 then each particle has a value associated with it.
*/
vtkSetMacro(HasScalar,int);
vtkGetMacro(HasScalar,int);
vtkBooleanMacro(HasScalar,int);
//@}
//@{
/**
* Get/Set the file type. The options are:
* - FILE_TYPE_IS_UNKNOWN (default) the class
* will attempt to determine the file type.
* If this fails then you should set the file type
* yourself.
* - FILE_TYPE_IS_TEXT the file type is text.
* - FILE_TYPE_IS_BINARY the file type is binary.
*/
vtkSetClampMacro(FileType, int, FILE_TYPE_IS_UNKNOWN, FILE_TYPE_IS_BINARY);
vtkGetMacro(FileType, int);
void SetFileTypeToUnknown() {this->SetFileType(FILE_TYPE_IS_UNKNOWN);}
void SetFileTypeToText() {this->SetFileType(FILE_TYPE_IS_TEXT);}
void SetFileTypeToBinary() {this->SetFileType(FILE_TYPE_IS_BINARY);}
//@}
//@{
/**
* Get/Set the data type. The options are:
* - VTK_FLOAT (default) single precision floating point.
* - VTK_DOUBLE double precision floating point.
*/
vtkSetClampMacro(DataType, int, VTK_FLOAT, VTK_DOUBLE);
vtkGetMacro(DataType, int);
void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
//@}
protected:
vtkParticleReader();
~vtkParticleReader();
void OpenFile();
char *FileName;
ifstream *File;
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
//@{
/**
* The format that will be read if the file is a text file is:
* x, y, z, s (where s is some scalar value associated with the particle).
* Each line corresponding to a particle is terminated with a line feed.
* If y, z, or s is missing, zero is substituted for them.
* Comment lines in the file are handled as follows:
* 1) Any line containing "\/\/" "\#" "\%" anywhere in the line is discarded.
* 2) Lines containing "\/\*" are discarded until a "\*\/" is found. The line
* following the "\*\/" will be read.
*/
int ProduceOutputFromTextFileDouble(vtkInformationVector *outputVector);
int ProduceOutputFromTextFileFloat(vtkInformationVector *outputVector);
//@}
//@{
/**
* This reader assumes that the file is binary and consists of floating
* point values by default.
*/
int ProduceOutputFromBinaryFileDouble(vtkInformationVector *outputVector);
int ProduceOutputFromBinaryFileFloat(vtkInformationVector *outputVector);
//@}
/**
* Determine the type of file based on an analysis of its contents.
* Up to 5000 bytes of the file are read and classified. The classification
* of a file as either binary or text is based on the proportions of bytes in
* various classifications. The classification of the file is not infallible
* but should work correctly most of the time. If it fails, use SetFileTypeToText()
* or SetFileTypeToBinary() to set the file type.
* This algorithm probably only identifies ASCII text correctly and will not
* work for UTF-8 UCS-2 (or UTF-16) or UCS-4 or EBCIDIC.
*/
int DetermineFileType();
/**
* Update of the progress.
*/
void DoProgressUpdate( size_t & bytesRead, size_t & fileLength );
/**
* Enumerate the supported file types.
* <pre>
* - FILE_TYPE_IS_UNKNOWN, (default) the class will attempt to determine the file type.
* - FILE_TYPE_IS_TEXT, the file type is text.
* - FILE_TYPE_IS_BINARY, the file type is binary.
* </pre>
*/
enum FILE_TYPE { FILE_TYPE_IS_UNKNOWN = 0,
FILE_TYPE_IS_TEXT, FILE_TYPE_IS_BINARY };
int HasScalar;
/**
* Used to decide which reader should be used.
*/
int FileType;
/**
* Used to specify the data type.
*/
int DataType;
/**
* Set an alliquot of bytes.
*/
size_t Alliquot;
/**
* Count of the number of alliquots processed.
*/
size_t Count;
int SwapBytes;
size_t NumberOfPoints;
private:
vtkParticleReader(const vtkParticleReader&) VTK_DELETE_FUNCTION;
void operator=(const vtkParticleReader&) VTK_DELETE_FUNCTION;
};
#endif
|