vtkParticleReader Class Reference

#include <vtkParticleReader.h>

Inheritance diagram for vtkParticleReader:

Inheritance graph
[legend]
Collaboration diagram for vtkParticleReader:

Collaboration graph
[legend]

List of all members.


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 48 of file vtkParticleReader.h.


Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
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 (vtkObject *o)

Protected Types

enum  FILE_TYPE { FILE_TYPE_IS_UNKNOWN = 0, FILE_TYPE_IS_TEXT, FILE_TYPE_IS_BINARY }

Protected Member Functions

 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 SwapBytes
size_t NumberOfPoints
int FileType
int DataType
size_t Alliquot
size_t Count

Member Typedef Documentation

Reimplemented from vtkPolyDataAlgorithm.

Definition at line 52 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 170 of file vtkParticleReader.h.


Constructor & Destructor Documentation

vtkParticleReader::vtkParticleReader (  )  [protected]

vtkParticleReader::~vtkParticleReader (  )  [protected]


Member Function Documentation

static vtkParticleReader* vtkParticleReader::New (  )  [static]

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

Reimplemented from vtkPolyDataAlgorithm.

virtual const char* vtkParticleReader::GetClassName (  )  [virtual]

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.

static vtkParticleReader* vtkParticleReader::SafeDownCast ( vtkObject o  )  [static]

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.

void vtkParticleReader::SetDataByteOrderToBigEndian (  ) 

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 vtkParticleReader::SetDataByteOrderToLittleEndian (  ) 

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.

int vtkParticleReader::GetDataByteOrder (  ) 

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 vtkParticleReader::SetDataByteOrder ( int   ) 

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.

const char* vtkParticleReader::GetDataByteOrderAsString (  ) 

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.

int vtkParticleReader::GetSwapBytes (  )  [inline]

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

Definition at line 84 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.

void vtkParticleReader::SetFileTypeToUnknown (  )  [inline]

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 102 of file vtkParticleReader.h.

void vtkParticleReader::SetFileTypeToText (  )  [inline]

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.

void vtkParticleReader::SetFileTypeToBinary (  )  [inline]

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.

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.

void vtkParticleReader::SetDataTypeToFloat (  )  [inline]

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

Definition at line 113 of file vtkParticleReader.h.

void vtkParticleReader::SetDataTypeToDouble (  )  [inline]

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.

void vtkParticleReader::OpenFile (  )  [protected]

int vtkParticleReader::RequestInformation ( vtkInformation ,
vtkInformationVector **  ,
vtkInformationVector  
) [protected, virtual]

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.

int vtkParticleReader::ProduceOutputFromTextFileDouble ( vtkInformationVector outputVector  )  [protected]

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 vtkParticleReader::ProduceOutputFromTextFileFloat ( vtkInformationVector outputVector  )  [protected]

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 vtkParticleReader::ProduceOutputFromBinaryFileDouble ( vtkInformationVector outputVector  )  [protected]

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

int vtkParticleReader::ProduceOutputFromBinaryFileFloat ( vtkInformationVector outputVector  )  [protected]

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

int vtkParticleReader::DetermineFileType (  )  [protected]

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 124 of file vtkParticleReader.h.

ifstream* vtkParticleReader::File [protected]

Definition at line 125 of file vtkParticleReader.h.

Definition at line 175 of file vtkParticleReader.h.

int vtkParticleReader::FileType [protected]

Used to decide which reader should be used.

Definition at line 178 of file vtkParticleReader.h.

int vtkParticleReader::DataType [protected]

Used to decide which reader should be used.

Definition at line 181 of file vtkParticleReader.h.

size_t vtkParticleReader::Alliquot [protected]

Set an alliquot of bytes.

Definition at line 186 of file vtkParticleReader.h.

size_t vtkParticleReader::Count [protected]

Set an alliquot of bytes.

Definition at line 189 of file vtkParticleReader.h.

Definition at line 192 of file vtkParticleReader.h.

Definition at line 193 of file vtkParticleReader.h.


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

Generated on Mon Sep 27 18:39:22 2010 for VTK by  doxygen 1.5.6