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

vtkKWEFunctionToGLSL Class Reference

Parse a mathematical expression and generate a GLSL source code string. More...

#include <vtkKWEFunctionToGLSL.h>

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

List of all members.

Public Member Functions

 vtkTypeRevisionMacro (vtkKWEFunctionToGLSL, vtkFunctionParser)
void PrintSelf (ostream &os, vtkIndent indent)
virtual bool GetParseStatus ()
virtual void GenerateGLSL ()
virtual int GetResultDimension ()
virtual vtkStdStringGetGLSLCode ()
virtual bool GetScalarIsUsed (int index)
virtual bool GetVectorIsUsed (int index)
vtkStdStringGetGLSLScalarName (int index)
vtkStdStringGetGLSLVectorName (int index)
virtual int GetNumberOfUsedScalarVariables ()
virtual int GetNumberOfUsedVectorVariables ()

Static Public Member Functions

static vtkKWEFunctionToGLSLNew ()

Protected Member Functions

 vtkKWEFunctionToGLSL ()
 ~vtkKWEFunctionToGLSL ()
void AllocateStringStack ()
void DeleteStringStack ()
void BuildGLSLVariableNames ()

Protected Attributes

bool ParseStatus
vtkStdStringGLSLCode
vtkStdStringStringStack
int * PrecedenceStack
bool * ScalarIsUsed
int ScalarIsUsedSize
vtkStdStringGLSLScalarNames
int NumberOfUsedScalarVariables
bool * VectorIsUsed
int VectorIsUsedSize
vtkStdStringGLSLVectorNames
int NumberOfUsedVectorVariables
int ResultDimension

Detailed Description

Parse a mathematical expression and generate a GLSL source code string.

vtkKWEFunctionToGLSL parses a mathematical expression conformed to the syntax parsed by vtkFunctionParser. However, instead of evaluating a value by executing the bytecode, it uses the bytecode to generate a GLSL source code used by vtkKWEGPUArrayCalculator.

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 vtkKWEGPUArrayCalculator.

Definition at line 74 of file vtkKWEFunctionToGLSL.h.


Constructor & Destructor Documentation

vtkKWEFunctionToGLSL::vtkKWEFunctionToGLSL (  )  [protected]

Default constructor. The function expression is a null pointer. The GLSLCode is a null pointer. ParseStatus is false.

vtkKWEFunctionToGLSL::~vtkKWEFunctionToGLSL (  )  [protected]

Destructor.


Member Function Documentation

vtkKWEFunctionToGLSL::vtkTypeRevisionMacro ( vtkKWEFunctionToGLSL  ,
vtkFunctionParser   
)
void vtkKWEFunctionToGLSL::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Reimplemented from vtkFunctionParser.

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

Reimplemented from vtkFunctionParser.

virtual bool vtkKWEFunctionToGLSL::GetParseStatus (  )  [virtual]

Value modified by GenerateGLSL().

virtual void vtkKWEFunctionToGLSL::GenerateGLSL (  )  [virtual]

Generate GLSL source code in GLSLCode. Update ParseStatus.

virtual int vtkKWEFunctionToGLSL::GetResultDimension (  )  [virtual]

Return the dimension of the result of the expression.

Precondition:
valid_expression: GetParseStatus()
Postcondition:
valid_result: result==1 || result==3
virtual vtkStdString* vtkKWEFunctionToGLSL::GetGLSLCode (  )  [virtual]

Return the GLSLCode generated by GenerateGLSL() in a string.

Precondition:
valid_expression: GetParseStatus()
virtual bool vtkKWEFunctionToGLSL::GetScalarIsUsed ( int  index  )  [virtual]

Return if a given scalar data array is used in the function expression.

Precondition:
valid_expression: GetParseStatus()
valid_index:index>=0 && index<this->NumberOfScalarVariables
virtual bool vtkKWEFunctionToGLSL::GetVectorIsUsed ( int  index  )  [virtual]

Return if a given vector data array is used in the function expression.

Precondition:
valid_expression: GetParseStatus()
valid_index:index>=0 && index<this->NumberOfVectorVariables
vtkStdString* vtkKWEFunctionToGLSL::GetGLSLScalarName ( int  index  ) 

Return the GLSL name attached to the a given scalar data array.

Precondition:
valid_expression: GetParseStatus()
valid_index:index>=0 && index<this->NumberOfScalarVariables
used_scalar: this->GetScalarIsUsed(index)
vtkStdString* vtkKWEFunctionToGLSL::GetGLSLVectorName ( int  index  ) 

Return the GLSL name attached to the a given vector data array.

Precondition:
valid_expression: GetParseStatus()
valid_index:index>=0 && index<this->NumberOfVectorVariables
used_vector: this->GetVectorIsUsed(index)
virtual int vtkKWEFunctionToGLSL::GetNumberOfUsedScalarVariables (  )  [virtual]

Return the number of scalar variables used in the expression.

Precondition:
valid_expression: GetParseStatus()
Postcondition:
valid_result: result>=0 && result<=GetNumberOfScalarVariables()
virtual int vtkKWEFunctionToGLSL::GetNumberOfUsedVectorVariables (  )  [virtual]

Return the number of vector variables used in the expression.

Precondition:
valid_expression: GetParseStatus()
Postcondition:
valid_result: result>=0 && result<=GetNumberOfVectorVariables()
void vtkKWEFunctionToGLSL::AllocateStringStack (  )  [protected]

Allocate string stack.

Precondition:
void: this->StringStack==0
positive_size: this->StackSize>0
Postcondition:
allocated: this->StringStack!=0
void vtkKWEFunctionToGLSL::DeleteStringStack (  )  [protected]

Delete string stack.

void vtkKWEFunctionToGLSL::BuildGLSLVariableNames (  )  [protected]

Build the name of the variable for GLSL. Only load the variables used in the function expression.

Precondition:
parsed: bytcode exists and is valid

Member Data Documentation

Definition at line 149 of file vtkKWEFunctionToGLSL.h.

Definition at line 150 of file vtkKWEFunctionToGLSL.h.

Definition at line 152 of file vtkKWEFunctionToGLSL.h.

Definition at line 153 of file vtkKWEFunctionToGLSL.h.

Definition at line 155 of file vtkKWEFunctionToGLSL.h.

Definition at line 156 of file vtkKWEFunctionToGLSL.h.

Definition at line 157 of file vtkKWEFunctionToGLSL.h.

Definition at line 158 of file vtkKWEFunctionToGLSL.h.

Definition at line 160 of file vtkKWEFunctionToGLSL.h.

Definition at line 161 of file vtkKWEFunctionToGLSL.h.

Definition at line 162 of file vtkKWEFunctionToGLSL.h.

Definition at line 163 of file vtkKWEFunctionToGLSL.h.

Definition at line 165 of file vtkKWEFunctionToGLSL.h.


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