VTK
|
Parse and evaluate a mathematical expression. More...
#include <vtkFunctionParser.h>
Parse and evaluate a mathematical expression.
vtkFunctionParser is a class that takes in a mathematical expression as a char string, parses it, and evaluates it at the specified values of the variables in the input string.
You can use the "if" operator to create conditional expressions such as if ( test, trueresult, falseresult). These evaluate the boolean valued test expression and then evaluate either the trueresult or the falseresult expression to produce a final (scalar or vector valued) value. "test" may contain <,>,=,|,&, and () and all three subexpressions can evaluate arbitrary function operators (ln, cos, +, if, etc)
Definition at line 126 of file vtkFunctionParser.h.
Reimplemented from vtkObject.
Definition at line 130 of file vtkFunctionParser.h.
vtkFunctionParser::vtkFunctionParser | ( | ) | [protected] |
vtkFunctionParser::~vtkFunctionParser | ( | ) | [protected] |
static vtkFunctionParser* vtkFunctionParser::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
virtual const char* vtkFunctionParser::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkObject.
static int vtkFunctionParser::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 vtkObject.
virtual int vtkFunctionParser::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 vtkObject.
static vtkFunctionParser* vtkFunctionParser::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkObject.
void vtkFunctionParser::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) | [virtual] |
void vtkFunctionParser::SetFunction | ( | const char * | function | ) |
Set/Get input string to evaluate.
virtual char* vtkFunctionParser::GetFunction | ( | ) | [virtual] |
Set/Get input string to evaluate.
int vtkFunctionParser::IsScalarResult | ( | ) |
Check whether the result is a scalar result. If it isn't, then either the result is a vector or an error has occurred.
int vtkFunctionParser::IsVectorResult | ( | ) |
Check whether the result is a vector result. If it isn't, then either the result is scalar or an error has occurred.
double vtkFunctionParser::GetScalarResult | ( | ) |
Get a scalar result from evaluating the input function.
double* vtkFunctionParser::GetVectorResult | ( | ) |
Get a vector result from evaluating the input function.
void vtkFunctionParser::GetVectorResult | ( | double | result[3] | ) | [inline] |
Get a vector result from evaluating the input function.
Definition at line 153 of file vtkFunctionParser.h.
void vtkFunctionParser::SetScalarVariableValue | ( | const char * | variableName, |
double | value | ||
) |
Set the value of a scalar variable. If a variable with this name exists, then its value will be set to the new value. If there is not already a variable with this name, variableName will be added to the list of variables, and its value will be set to the new value.
Set the value of a scalar variable. If a variable with this name exists, then its value will be set to the new value. If there is not already a variable with this name, variableName will be added to the list of variables, and its value will be set to the new value.
double vtkFunctionParser::GetScalarVariableValue | ( | const char * | variableName | ) |
Get the value of a scalar variable.
void vtkFunctionParser::SetVectorVariableValue | ( | const char * | variableName, |
double | xValue, | ||
double | yValue, | ||
double | zValue | ||
) |
Set the value of a vector variable. If a variable with this name exists, then its value will be set to the new value. If there is not already a variable with this name, variableName will be added to the list of variables, and its value will be set to the new value.
void vtkFunctionParser::SetVectorVariableValue | ( | const char * | variableName, |
const double | values[3] | ||
) | [inline] |
Set the value of a vector variable. If a variable with this name exists, then its value will be set to the new value. If there is not already a variable with this name, variableName will be added to the list of variables, and its value will be set to the new value.
Definition at line 180 of file vtkFunctionParser.h.
void vtkFunctionParser::SetVectorVariableValue | ( | int | i, |
double | xValue, | ||
double | yValue, | ||
double | zValue | ||
) |
Set the value of a vector variable. If a variable with this name exists, then its value will be set to the new value. If there is not already a variable with this name, variableName will be added to the list of variables, and its value will be set to the new value.
Set the value of a vector variable. If a variable with this name exists, then its value will be set to the new value. If there is not already a variable with this name, variableName will be added to the list of variables, and its value will be set to the new value.
Definition at line 185 of file vtkFunctionParser.h.
double* vtkFunctionParser::GetVectorVariableValue | ( | const char * | variableName | ) |
Get the value of a vector variable.
void vtkFunctionParser::GetVectorVariableValue | ( | const char * | variableName, |
double | value[3] | ||
) | [inline] |
Get the value of a vector variable.
Definition at line 192 of file vtkFunctionParser.h.
Get the value of a vector variable.
Definition at line 196 of file vtkFunctionParser.h.
virtual int vtkFunctionParser::GetNumberOfScalarVariables | ( | ) | [virtual] |
Get the number of scalar variables.
virtual int vtkFunctionParser::GetNumberOfVectorVariables | ( | ) | [virtual] |
Get the number of vector variables.
char* vtkFunctionParser::GetScalarVariableName | ( | int | i | ) |
Get the ith scalar variable name.
char* vtkFunctionParser::GetVectorVariableName | ( | int | i | ) |
Get the ith vector variable name.
void vtkFunctionParser::RemoveAllVariables | ( | ) |
Remove all the current variables.
void vtkFunctionParser::RemoveScalarVariables | ( | ) |
Remove all the scalar variables.
void vtkFunctionParser::RemoveVectorVariables | ( | ) |
Remove all the vector variables.
virtual void vtkFunctionParser::SetReplaceInvalidValues | ( | int | ) | [virtual] |
When ReplaceInvalidValues is on, all invalid values (such as sqrt(-2), note that function parser does not handle complex numbers) will be replaced by ReplacementValue. Otherwise an error will be reported
virtual int vtkFunctionParser::GetReplaceInvalidValues | ( | ) | [virtual] |
When ReplaceInvalidValues is on, all invalid values (such as sqrt(-2), note that function parser does not handle complex numbers) will be replaced by ReplacementValue. Otherwise an error will be reported
virtual void vtkFunctionParser::ReplaceInvalidValuesOn | ( | ) | [virtual] |
When ReplaceInvalidValues is on, all invalid values (such as sqrt(-2), note that function parser does not handle complex numbers) will be replaced by ReplacementValue. Otherwise an error will be reported
virtual void vtkFunctionParser::ReplaceInvalidValuesOff | ( | ) | [virtual] |
When ReplaceInvalidValues is on, all invalid values (such as sqrt(-2), note that function parser does not handle complex numbers) will be replaced by ReplacementValue. Otherwise an error will be reported
virtual void vtkFunctionParser::SetReplacementValue | ( | double | ) | [virtual] |
When ReplaceInvalidValues is on, all invalid values (such as sqrt(-2), note that function parser does not handle complex numbers) will be replaced by ReplacementValue. Otherwise an error will be reported
virtual double vtkFunctionParser::GetReplacementValue | ( | ) | [virtual] |
When ReplaceInvalidValues is on, all invalid values (such as sqrt(-2), note that function parser does not handle complex numbers) will be replaced by ReplacementValue. Otherwise an error will be reported
void vtkFunctionParser::CheckExpression | ( | int & | pos, |
char ** | error | ||
) |
Check the validity of the function expression.
int vtkFunctionParser::Parse | ( | ) | [protected] |
bool vtkFunctionParser::Evaluate | ( | ) | [protected] |
Evaluate the function, returning true on success, false on failure.
int vtkFunctionParser::CheckSyntax | ( | ) | [protected] |
void vtkFunctionParser::CopyParseError | ( | int & | position, |
char ** | error | ||
) | [protected] |
void vtkFunctionParser::RemoveSpaces | ( | ) | [protected] |
char* vtkFunctionParser::RemoveSpacesFrom | ( | const char * | variableName | ) | [protected] |
int vtkFunctionParser::BuildInternalFunctionStructure | ( | ) | [protected] |
void vtkFunctionParser::BuildInternalSubstringStructure | ( | int | beginIndex, |
int | endIndex | ||
) | [protected] |
void vtkFunctionParser::AddInternalByte | ( | unsigned char | newByte | ) | [protected] |
unsigned char vtkFunctionParser::GetElementaryOperatorNumber | ( | char | op | ) | [protected] |
unsigned char vtkFunctionParser::GetOperandNumber | ( | int | currentIndex | ) | [protected] |
int vtkFunctionParser::DisambiguateOperators | ( | ) | [protected] |
virtual void vtkFunctionParser::SetParseError | ( | const char * | ) | [protected, virtual] |
char* vtkFunctionParser::Function [protected] |
Definition at line 284 of file vtkFunctionParser.h.
char* vtkFunctionParser::FunctionWithSpaces [protected] |
Definition at line 285 of file vtkFunctionParser.h.
int vtkFunctionParser::FunctionLength [protected] |
Definition at line 287 of file vtkFunctionParser.h.
int vtkFunctionParser::NumberOfScalarVariables [protected] |
Definition at line 288 of file vtkFunctionParser.h.
int vtkFunctionParser::NumberOfVectorVariables [protected] |
Definition at line 289 of file vtkFunctionParser.h.
char** vtkFunctionParser::ScalarVariableNames [protected] |
Definition at line 290 of file vtkFunctionParser.h.
char** vtkFunctionParser::VectorVariableNames [protected] |
Definition at line 291 of file vtkFunctionParser.h.
double* vtkFunctionParser::ScalarVariableValues [protected] |
Definition at line 292 of file vtkFunctionParser.h.
double** vtkFunctionParser::VectorVariableValues [protected] |
Definition at line 293 of file vtkFunctionParser.h.
unsigned char* vtkFunctionParser::ByteCode [protected] |
Definition at line 294 of file vtkFunctionParser.h.
int vtkFunctionParser::ByteCodeSize [protected] |
Definition at line 295 of file vtkFunctionParser.h.
double* vtkFunctionParser::Immediates [protected] |
Definition at line 296 of file vtkFunctionParser.h.
int vtkFunctionParser::ImmediatesSize [protected] |
Definition at line 297 of file vtkFunctionParser.h.
double* vtkFunctionParser::Stack [protected] |
Definition at line 298 of file vtkFunctionParser.h.
int vtkFunctionParser::StackSize [protected] |
Definition at line 299 of file vtkFunctionParser.h.
int vtkFunctionParser::StackPointer [protected] |
Definition at line 300 of file vtkFunctionParser.h.
vtkTimeStamp vtkFunctionParser::FunctionMTime [protected] |
Definition at line 302 of file vtkFunctionParser.h.
vtkTimeStamp vtkFunctionParser::ParseMTime [protected] |
Definition at line 303 of file vtkFunctionParser.h.
vtkTimeStamp vtkFunctionParser::VariableMTime [protected] |
Definition at line 304 of file vtkFunctionParser.h.
vtkTimeStamp vtkFunctionParser::EvaluateMTime [protected] |
Definition at line 305 of file vtkFunctionParser.h.
vtkTimeStamp vtkFunctionParser::CheckMTime [protected] |
Definition at line 306 of file vtkFunctionParser.h.
int vtkFunctionParser::ReplaceInvalidValues [protected] |
Definition at line 308 of file vtkFunctionParser.h.
double vtkFunctionParser::ReplacementValue [protected] |
Definition at line 309 of file vtkFunctionParser.h.
int vtkFunctionParser::ParseErrorPositon [protected] |
Definition at line 311 of file vtkFunctionParser.h.
char* vtkFunctionParser::ParseError [protected] |
Definition at line 312 of file vtkFunctionParser.h.