Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

vtkKWEGPUArrayCalculator Class Reference

perform mathematical operations on data in field data arrays on the GPU More...

#include <vtkKWEGPUArrayCalculator.h>

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

List of all members.

Public Member Functions

 vtkTypeRevisionMacro (vtkKWEGPUArrayCalculator, vtkArrayCalculator)
void PrintSelf (ostream &os, vtkIndent indent)
bool GetSupportedByHardware ()
virtual void SetFunction (const char *function)
void Calibrate ()
virtual void RemoveScalarVariables ()
virtual void RemoveVectorVariables ()
virtual void RemoveCoordinateScalarVariables ()
virtual void RemoveCoordinateVectorVariables ()

virtual vtkRenderWindowGetContext ()
void SetContext (vtkRenderWindow *)

virtual void SetSizeThreshold (vtkIdType)
virtual vtkIdType GetSizeThreshold ()

virtual int GetUseCalibration ()
virtual void SetUseCalibration (int)
virtual void UseCalibrationOn ()
virtual void UseCalibrationOff ()

virtual vtkIdType GetCalibratedSizeThreshold ()

virtual void SetMaxGPUMemorySizeInBytes (vtkIdType)
virtual vtkIdType GetMaxGPUMemorySizeInBytes ()

Static Public Member Functions

static vtkKWEGPUArrayCalculatorNew ()

Protected Member Functions

 vtkKWEGPUArrayCalculator ()
virtual ~vtkKWEGPUArrayCalculator ()
void SimulateGPUComputation (vtkFloatArray *values)
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual void ComputeSubRange (vtkDataArray *array, vtkIdType first, vtkIdType last, double subRange[2])

Protected Attributes

vtkRenderWindowContext
vtkKWEFunctionToGLSLFunctionParserToGLSL
vtkIdType MaxGPUMemorySizeInBytes
vtkIdType SizeThreshold
int UseCalibration
vtkIdType CalibratedSizeThreshold
bool CalibrationDone
bool SupportedByHardware

Detailed Description

perform mathematical operations on data in field data arrays on the GPU

vtkGPUArrayCalculator performs operations on vectors or scalars in field data arrays on the GPU. It uses vtkFunctionParser to do the parsing and to evaluate the function for each entry in the input arrays. The arrays used in a given function must be all in point data or all in cell data. The resulting array will be stored as a field data array. The result array can either be stored in a new array or it can overwrite an existing array.

The functions that this array calculator understands is:

 standard operations: + - * / ^ .
 access vector components: iHat, jHat, kHat
 abs
 acos
 asin
 atan
 ceil
 cos
 cosh
 exp
 floor
 log
 mag
 min
 max
 norm
 sign
 sin
 sinh
 sqrt
 tan
 tanh
 

Note that some of these operations work on scalars, some on vectors, and some on both (e.g., you can multiply a scalar times a vector). The operations are performed tuple-wise (i.e., tuple-by-tuple). The user must specify which arrays to use as vectors and/or scalars, and the name of the output data array.

See also:
vtkFunctionParser

Definition at line 78 of file vtkKWEGPUArrayCalculator.h.


Constructor & Destructor Documentation

vtkKWEGPUArrayCalculator::vtkKWEGPUArrayCalculator (  )  [protected]
virtual vtkKWEGPUArrayCalculator::~vtkKWEGPUArrayCalculator (  )  [protected, virtual]

Member Function Documentation

vtkKWEGPUArrayCalculator::vtkTypeRevisionMacro ( vtkKWEGPUArrayCalculator  ,
vtkArrayCalculator   
)
void vtkKWEGPUArrayCalculator::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Reimplemented from vtkArrayCalculator.

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

Reimplemented from vtkArrayCalculator.

virtual vtkRenderWindow* vtkKWEGPUArrayCalculator::GetContext (  )  [virtual]

Get/Set the rendering context.

void vtkKWEGPUArrayCalculator::SetContext ( vtkRenderWindow  ) 

Get/Set the rendering context.

bool vtkKWEGPUArrayCalculator::GetSupportedByHardware (  ) 

Tells if the GPU implementation is supported by the graphics card in use.

virtual void vtkKWEGPUArrayCalculator::SetFunction ( const char *  function  )  [virtual]

Set/Get the function to be evaluated.

Reimplemented from vtkArrayCalculator.

virtual void vtkKWEGPUArrayCalculator::SetSizeThreshold ( vtkIdType   )  [virtual]

Set/Get the dataset size threshold. Under this size, the CPU implementation is used (see vtkArrayCalculator). Above or equal to this size, the GPU is used if it supports the required OpenGL extensions. Initial value is 0, trying to use the GPU in any case. The GPU implementation is faster than the CPU implementation if the data array is large enough. This threshold depends on the both the speed of the CPU and the GPU, the RAM and VRAM. An experiment on an Intel Core 2 Duo T9500, 4GB with a nVidia Quadro FX 3600M, 512MB shows that 15000 is a good threshold.

virtual vtkIdType vtkKWEGPUArrayCalculator::GetSizeThreshold (  )  [virtual]

Set/Get the dataset size threshold. Under this size, the CPU implementation is used (see vtkArrayCalculator). Above or equal to this size, the GPU is used if it supports the required OpenGL extensions. Initial value is 0, trying to use the GPU in any case. The GPU implementation is faster than the CPU implementation if the data array is large enough. This threshold depends on the both the speed of the CPU and the GPU, the RAM and VRAM. An experiment on an Intel Core 2 Duo T9500, 4GB with a nVidia Quadro FX 3600M, 512MB shows that 15000 is a good threshold.

virtual int vtkKWEGPUArrayCalculator::GetUseCalibration (  )  [virtual]

Tell the filter to use CalibratedSizeThreshold instead of SizeThreshold. If CalibratedSizeThreshold has not been computed yet, a calibration is performed (expensive call to Calibrate() that happens once).

virtual void vtkKWEGPUArrayCalculator::SetUseCalibration ( int   )  [virtual]

Tell the filter to use CalibratedSizeThreshold instead of SizeThreshold. If CalibratedSizeThreshold has not been computed yet, a calibration is performed (expensive call to Calibrate() that happens once).

virtual void vtkKWEGPUArrayCalculator::UseCalibrationOn (  )  [virtual]

Tell the filter to use CalibratedSizeThreshold instead of SizeThreshold. If CalibratedSizeThreshold has not been computed yet, a calibration is performed (expensive call to Calibrate() that happens once).

virtual void vtkKWEGPUArrayCalculator::UseCalibrationOff (  )  [virtual]

Tell the filter to use CalibratedSizeThreshold instead of SizeThreshold. If CalibratedSizeThreshold has not been computed yet, a calibration is performed (expensive call to Calibrate() that happens once).

void vtkKWEGPUArrayCalculator::Calibrate (  ) 

Tell the filter to calibrate itself. Starting for the current value of SizeThreshold, try to find the actual threshold size at which the GPU implementation is faster than the CPU one. This call is expensive. This method is usually called automatically once when UseCalibration is on. But you can call it directly to control at what time the calibration happens or to force a new calibration.

virtual vtkIdType vtkKWEGPUArrayCalculator::GetCalibratedSizeThreshold (  )  [virtual]

Return the size threshold computed by the last calibration. Initial value is 0.

virtual void vtkKWEGPUArrayCalculator::RemoveScalarVariables (  )  [virtual]

Remove all the scalar variable names and their associated array names.

Reimplemented from vtkArrayCalculator.

virtual void vtkKWEGPUArrayCalculator::RemoveVectorVariables (  )  [virtual]

Remove all the scalar variable names and their associated array names.

Reimplemented from vtkArrayCalculator.

virtual void vtkKWEGPUArrayCalculator::RemoveCoordinateScalarVariables (  )  [virtual]

Remove all the coordinate variables.

Reimplemented from vtkArrayCalculator.

virtual void vtkKWEGPUArrayCalculator::RemoveCoordinateVectorVariables (  )  [virtual]

Remove all the coordinate variables.

Reimplemented from vtkArrayCalculator.

virtual void vtkKWEGPUArrayCalculator::SetMaxGPUMemorySizeInBytes ( vtkIdType   )  [virtual]

User-defined maximum size in bytes of GPU memory that can be assigned to the array calculator. Initial value is 134217728 bytes (128*2^20=128Mb). In a 32-bit build, this ivar can encode up to 4GB. A null value means no limit.

virtual vtkIdType vtkKWEGPUArrayCalculator::GetMaxGPUMemorySizeInBytes (  )  [virtual]

User-defined maximum size in bytes of GPU memory that can be assigned to the array calculator. Initial value is 134217728 bytes (128*2^20=128Mb). In a 32-bit build, this ivar can encode up to 4GB. A null value means no limit.

void vtkKWEGPUArrayCalculator::SimulateGPUComputation ( vtkFloatArray values  )  [protected]
virtual int vtkKWEGPUArrayCalculator::RequestData ( vtkInformation ,
vtkInformationVector **  ,
vtkInformationVector  
) [protected, virtual]

Reimplemented from vtkArrayCalculator.

virtual void vtkKWEGPUArrayCalculator::ComputeSubRange ( vtkDataArray array,
vtkIdType  first,
vtkIdType  last,
double  subRange[2] 
) [protected, virtual]

Member Data Documentation

Definition at line 173 of file vtkKWEGPUArrayCalculator.h.

Definition at line 175 of file vtkKWEGPUArrayCalculator.h.

Definition at line 177 of file vtkKWEGPUArrayCalculator.h.

Definition at line 179 of file vtkKWEGPUArrayCalculator.h.

Definition at line 180 of file vtkKWEGPUArrayCalculator.h.

Definition at line 181 of file vtkKWEGPUArrayCalculator.h.

Definition at line 182 of file vtkKWEGPUArrayCalculator.h.

Definition at line 183 of file vtkKWEGPUArrayCalculator.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines