VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
vtkParticleReader Class Reference

Read ASCII or binary particle data and (optionally) one scalar value associated with each particle. More...

#include <vtkParticleReader.h>

Inheritance diagram for vtkParticleReader:
Inheritance graph
[legend]
Collaboration diagram for vtkParticleReader:
Collaboration graph
[legend]

List of all members.

Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkParticleReaderNewInstance () const
void PrintSelf (ostream &os, vtkIndent indent)
virtual void SetFileName (const char *)
virtual char * GetFileName ()
void SetDataByteOrderToBigEndian ()
void SetDataByteOrderToLittleEndian ()
int GetDataByteOrder ()
void SetDataByteOrder (int)
const char * GetDataByteOrderAsString ()
virtual void SetSwapBytes (int)
int GetSwapBytes ()
virtual void SwapBytesOn ()
virtual void SwapBytesOff ()
virtual void SetHasScalar (int)
virtual int GetHasScalar ()
virtual void HasScalarOn ()
virtual void HasScalarOff ()
virtual void SetFileType (int)
virtual int GetFileType ()
void SetFileTypeToUnknown ()
void SetFileTypeToText ()
void SetFileTypeToBinary ()
virtual void SetDataType (int)
virtual int GetDataType ()
void SetDataTypeToFloat ()
void SetDataTypeToDouble ()

Static Public Member Functions

static vtkParticleReaderNew ()
static int IsTypeOf (const char *type)
static vtkParticleReaderSafeDownCast (vtkObjectBase *o)

Protected Types

enum  FILE_TYPE { FILE_TYPE_IS_UNKNOWN = 0, FILE_TYPE_IS_TEXT, FILE_TYPE_IS_BINARY }

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 vtkParticleReader ()
 ~vtkParticleReader ()
void OpenFile ()
int RequestInformation (vtkInformation *, vtkInformationVector **, vtkInformationVector *)
int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *)
int DetermineFileType ()
void DoProgressUpdate (size_t &bytesRead, size_t &fileLength)
int ProduceOutputFromTextFileDouble (vtkInformationVector *outputVector)
int ProduceOutputFromTextFileFloat (vtkInformationVector *outputVector)
int ProduceOutputFromBinaryFileDouble (vtkInformationVector *outputVector)
int ProduceOutputFromBinaryFileFloat (vtkInformationVector *outputVector)

Protected Attributes

char * FileName
ifstream * File
int HasScalar
int FileType
int DataType
size_t Alliquot
size_t Count
int SwapBytes
size_t NumberOfPoints

Detailed Description

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.

Examples:
vtkParticleReader (Examples)
Tests:
vtkParticleReader (Tests)

Definition at line 49 of file vtkParticleReader.h.


Member Typedef Documentation

Reimplemented from vtkPolyDataAlgorithm.

Definition at line 53 of file vtkParticleReader.h.


Member Enumeration Documentation

enum vtkParticleReader::FILE_TYPE [protected]

Enumerate the supported file types.

 - 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. 
Enumerator:
FILE_TYPE_IS_UNKNOWN 
FILE_TYPE_IS_TEXT 
FILE_TYPE_IS_BINARY 

Definition at line 171 of file vtkParticleReader.h.


Constructor & Destructor Documentation


Member Function Documentation

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkPolyDataAlgorithm.

static int vtkParticleReader::IsTypeOf ( const char *  name) [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkPolyDataAlgorithm.

virtual int vtkParticleReader::IsA ( const char *  name) [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkPolyDataAlgorithm.

Reimplemented from vtkPolyDataAlgorithm.

virtual vtkObjectBase* vtkParticleReader::NewInstanceInternal ( ) const [protected, virtual]

Reimplemented from vtkPolyDataAlgorithm.

Reimplemented from vtkPolyDataAlgorithm.

void vtkParticleReader::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkPolyDataAlgorithm.

virtual void vtkParticleReader::SetFileName ( const char *  ) [virtual]

Specify file name.

virtual char* vtkParticleReader::GetFileName ( ) [virtual]

Specify file name.

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.

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.

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.

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.

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.

virtual void vtkParticleReader::SetSwapBytes ( int  ) [virtual]

Set/Get the byte swapping to explicitly swap the bytes of a file. Not used when reading text files.

Set/Get the byte swapping to explicitly swap the bytes of a file. Not used when reading text files.

Definition at line 85 of file vtkParticleReader.h.

virtual void vtkParticleReader::SwapBytesOn ( ) [virtual]

Set/Get the byte swapping to explicitly swap the bytes of a file. Not used when reading text files.

virtual void vtkParticleReader::SwapBytesOff ( ) [virtual]

Set/Get the byte swapping to explicitly swap the bytes of a file. Not used when reading text files.

virtual void vtkParticleReader::SetHasScalar ( int  ) [virtual]

Default: 1. If 1 then each particle has a value associated with it.

virtual int vtkParticleReader::GetHasScalar ( ) [virtual]

Default: 1. If 1 then each particle has a value associated with it.

virtual void vtkParticleReader::HasScalarOn ( ) [virtual]

Default: 1. If 1 then each particle has a value associated with it.

virtual void vtkParticleReader::HasScalarOff ( ) [virtual]

Default: 1. If 1 then each particle has a value associated with it.

virtual void vtkParticleReader::SetFileType ( int  ) [virtual]

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.

virtual int vtkParticleReader::GetFileType ( ) [virtual]

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.

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.

Definition at line 103 of file vtkParticleReader.h.

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.

Definition at line 104 of file vtkParticleReader.h.

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.

Definition at line 105 of file vtkParticleReader.h.

virtual void vtkParticleReader::SetDataType ( int  ) [virtual]

Get/Set the data type. The options are: - VTK_FLOAT (default) single precision floating point. - VTK_DOUBLE double precision floating point.

virtual int vtkParticleReader::GetDataType ( ) [virtual]

Get/Set the data type. The options are: - VTK_FLOAT (default) single precision floating point. - VTK_DOUBLE double precision floating point.

Get/Set the data type. The options are: - VTK_FLOAT (default) single precision floating point. - VTK_DOUBLE double precision floating point.

Definition at line 114 of file vtkParticleReader.h.

Get/Set the data type. The options are: - VTK_FLOAT (default) single precision floating point. - VTK_DOUBLE double precision floating point.

Definition at line 115 of file vtkParticleReader.h.

void vtkParticleReader::OpenFile ( ) [protected]

Reimplemented from vtkPolyDataAlgorithm.

int vtkParticleReader::RequestData ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
) [protected, virtual]

This is called by the superclass. This is the method you should override.

Reimplemented from vtkPolyDataAlgorithm.

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.

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.

This reader assumes that the file is binary and consists of floating point values by default.

This reader assumes that the file is binary and consists of floating point values by default.

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.

void vtkParticleReader::DoProgressUpdate ( size_t &  bytesRead,
size_t &  fileLength 
) [protected]

Update of the progress.


Member Data Documentation

char* vtkParticleReader::FileName [protected]

Definition at line 125 of file vtkParticleReader.h.

ifstream* vtkParticleReader::File [protected]

Definition at line 126 of file vtkParticleReader.h.

Definition at line 176 of file vtkParticleReader.h.

Used to decide which reader should be used.

Definition at line 178 of file vtkParticleReader.h.

Used to specify the data type.

Definition at line 180 of file vtkParticleReader.h.

size_t vtkParticleReader::Alliquot [protected]

Set an alliquot of bytes.

Definition at line 183 of file vtkParticleReader.h.

size_t vtkParticleReader::Count [protected]

Count of the number of alliquots processed.

Definition at line 185 of file vtkParticleReader.h.

Definition at line 187 of file vtkParticleReader.h.

Definition at line 188 of file vtkParticleReader.h.


The documentation for this class was generated from the following file: