VTK  9.1.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkFunctionParser Class Reference

Parse and evaluate a mathematical expression. More...

#include <vtkFunctionParser.h>

Inheritance diagram for vtkFunctionParser:
[legend]
Collaboration diagram for vtkFunctionParser:
[legend]

Public Types

typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
vtkFunctionParserNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
vtkMTimeType GetMTime () override
 Return parser's MTime. More...
 
int IsScalarResult ()
 Check whether the result is a scalar result. More...
 
int IsVectorResult ()
 Check whether the result is a vector result. More...
 
double GetScalarResult ()
 Get a scalar result from evaluating the input function. More...
 
int GetNumberOfScalarVariables ()
 Get the number of scalar variables. More...
 
int GetScalarVariableIndex (const char *name)
 Get scalar variable index or -1 if not found. More...
 
int GetScalarVariableIndex (const std::string &name)
 
int GetNumberOfVectorVariables ()
 Get the number of vector variables. More...
 
int GetVectorVariableIndex (const char *name)
 Get scalar variable index or -1 if not found. More...
 
int GetVectorVariableIndex (const std::string &name)
 
const char * GetScalarVariableName (int i)
 Get the ith scalar variable name. More...
 
const char * GetVectorVariableName (int i)
 Get the ith vector variable name. More...
 
void RemoveAllVariables ()
 Remove all the current variables. More...
 
void RemoveScalarVariables ()
 Remove all the scalar variables. More...
 
void RemoveVectorVariables ()
 Remove all the vector variables. More...
 
void CheckExpression (int &pos, char **error)
 Check the validity of the function expression. More...
 
void InvalidateFunction ()
 Allow the user to force the function to be re-parsed. More...
 
void SetFunction (const char *function)
 Set/Get input string to evaluate. More...
 
virtual char * GetFunction ()
 Set/Get input string to evaluate. More...
 
double * GetVectorResult ()
 Get a vector result from evaluating the input function. More...
 
void GetVectorResult (double result[3])
 Get a vector result from evaluating the input function. More...
 
void SetScalarVariableValue (const char *variableName, double value)
 Set the value of a scalar variable. More...
 
void SetScalarVariableValue (const std::string &variableName, double value)
 Set the value of a scalar variable. More...
 
void SetScalarVariableValue (int i, double value)
 Set the value of a scalar variable. More...
 
double GetScalarVariableValue (const char *variableName)
 Get the value of a scalar variable. More...
 
double GetScalarVariableValue (const std::string &variableName)
 Get the value of a scalar variable. More...
 
double GetScalarVariableValue (int i)
 Get the value of a scalar variable. More...
 
void SetVectorVariableValue (const char *variableName, double xValue, double yValue, double zValue)
 Set the value of a vector variable. More...
 
void SetVectorVariableValue (const std::string &variableName, double xValue, double yValue, double zValue)
 Set the value of a vector variable. More...
 
void SetVectorVariableValue (const char *variableName, const double values[3])
 Set the value of a vector variable. More...
 
void SetVectorVariableValue (const std::string &variableName, const double values[3])
 Set the value of a vector variable. More...
 
void SetVectorVariableValue (int i, double xValue, double yValue, double zValue)
 Set the value of a vector variable. More...
 
void SetVectorVariableValue (int i, const double values[3])
 Set the value of a vector variable. More...
 
double * GetVectorVariableValue (const char *variableName)
 Get the value of a vector variable. More...
 
double * GetVectorVariableValue (const std::string &variableName)
 Get the value of a vector variable. More...
 
void GetVectorVariableValue (const char *variableName, double value[3])
 Get the value of a vector variable. More...
 
void GetVectorVariableValue (const std::string &variableName, double value[3])
 Get the value of a vector variable. More...
 
double * GetVectorVariableValue (int i)
 Get the value of a vector variable. More...
 
void GetVectorVariableValue (int i, double value[3])
 Get the value of a vector variable. More...
 
bool GetScalarVariableNeeded (int i)
 Returns whether a scalar variable is needed for the function evaluation. More...
 
bool GetScalarVariableNeeded (const char *variableName)
 Returns whether a scalar variable is needed for the function evaluation. More...
 
bool GetScalarVariableNeeded (const std::string &variableName)
 Returns whether a scalar variable is needed for the function evaluation. More...
 
bool GetVectorVariableNeeded (int i)
 Returns whether a vector variable is needed for the function evaluation. More...
 
bool GetVectorVariableNeeded (const char *variableName)
 Returns whether a vector variable is needed for the function evaluation. More...
 
bool GetVectorVariableNeeded (const std::string &variableName)
 Returns whether a vector variable is needed for the function evaluation. More...
 
virtual void SetReplaceInvalidValues (vtkTypeBool)
 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. More...
 
virtual vtkTypeBool GetReplaceInvalidValues ()
 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. More...
 
virtual void ReplaceInvalidValuesOn ()
 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. More...
 
virtual void ReplaceInvalidValuesOff ()
 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. More...
 
virtual void SetReplacementValue (double)
 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. More...
 
virtual double GetReplacementValue ()
 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. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method. More...
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
int InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual vtkTypeBool IsA (const char *name)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses. More...
 

Static Public Member Functions

static vtkFunctionParserNew ()
 
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkFunctionParserSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static int GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class. More...
 
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within. More...
 
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkFunctionParser ()
 
 ~vtkFunctionParser () override
 
int Parse ()
 
bool Evaluate ()
 Evaluate the function, returning true on success, false on failure. More...
 
int CheckSyntax ()
 
void CopyParseError (int &position, char **error)
 
void RemoveSpaces ()
 
char * RemoveSpacesFrom (const char *variableName)
 
int OperatorWithinVariable (int idx)
 
int BuildInternalFunctionStructure ()
 
void BuildInternalSubstringStructure (int beginIndex, int endIndex)
 
void AddInternalByte (unsigned int newByte)
 
int IsSubstringCompletelyEnclosed (int beginIndex, int endIndex)
 
int FindEndOfMathFunction (int beginIndex)
 
int FindEndOfMathConstant (int beginIndex)
 
int IsVariableName (int currentIndex)
 
int IsElementaryOperator (int op)
 
int GetMathFunctionNumber (int currentIndex)
 
int GetMathFunctionNumberByCheckingParenthesis (int currentIndex)
 
int GetMathFunctionStringLength (int mathFunctionNumber)
 
int GetMathConstantNumber (int currentIndex)
 
int GetMathConstantStringLength (int mathConstantNumber)
 
unsigned char GetElementaryOperatorNumber (char op)
 
unsigned int GetOperandNumber (int currentIndex)
 
int GetVariableNameLength (int variableNumber)
 
int DisambiguateOperators ()
 
void UpdateNeededVariables ()
 Collects meta-data about which variables are needed by the current function. More...
 
virtual void SetParseError (const char *)
 
int FindPositionInOriginalFunction (const int &pos)
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events. More...
 
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events. More...
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void RegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

char * Function
 
char * FunctionWithSpaces
 
int FunctionLength
 
std::vector< std::string > ScalarVariableNames
 
std::vector< std::string > VectorVariableNames
 
std::vector< double > ScalarVariableValues
 
std::vector< vtkTuple< double, 3 > > VectorVariableValues
 
std::vector< bool > ScalarVariableNeeded
 
std::vector< bool > VectorVariableNeeded
 
std::vector< unsigned int > ByteCode
 
int ByteCodeSize
 
double * Immediates
 
int ImmediatesSize
 
double * Stack
 
int StackSize
 
int StackPointer
 
vtkTimeStamp FunctionMTime
 
vtkTimeStamp ParseMTime
 
vtkTimeStamp VariableMTime
 
vtkTimeStamp EvaluateMTime
 
vtkTimeStamp CheckMTime
 
vtkTypeBool ReplaceInvalidValues
 
double ReplacementValue
 
int ParseErrorPositon
 
char * ParseError
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 

Detailed Description

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)

Thanks:
Juha Nieminen (juha..nosp@m.niem.nosp@m.inen@.nosp@m.gmai.nosp@m.l.com) for relicensing this branch of the function parser code that this class is based upon under the new BSD license so that it could be used in VTK. Note, the BSD license applies to this version of the function parser only (by permission of the author), and not the original library.
Thanks:
Thomas Dunne (thoma.nosp@m.s.du.nosp@m.nne@i.nosp@m.wr.u.nosp@m.ni-he.nosp@m.idel.nosp@m.berg..nosp@m.de) for adding code for two-parameter-parsing and a few functions (sign, min, max).
Thanks:
Sid Sydoriak (sxs@l.nosp@m.anl..nosp@m.gov) for adding boolean operations and conditional expressions and for fixing a variety of bugs.
Online Examples:

Definition at line 152 of file vtkFunctionParser.h.

Member Typedef Documentation

◆ Superclass

Definition at line 156 of file vtkFunctionParser.h.

Constructor & Destructor Documentation

◆ vtkFunctionParser()

vtkFunctionParser::vtkFunctionParser ( )
protected

◆ ~vtkFunctionParser()

vtkFunctionParser::~vtkFunctionParser ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkFunctionParser * vtkFunctionParser::New ( )
static

◆ IsTypeOf()

static vtkTypeBool vtkFunctionParser::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool 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 vtkObjectBase.

◆ SafeDownCast()

static vtkFunctionParser * vtkFunctionParser::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkFunctionParser::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkFunctionParser * vtkFunctionParser::NewInstance ( ) const

◆ PrintSelf()

void vtkFunctionParser::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

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

◆ GetMTime()

vtkMTimeType vtkFunctionParser::GetMTime ( )
overridevirtual

Return parser's MTime.

Reimplemented from vtkObject.

◆ SetFunction()

void vtkFunctionParser::SetFunction ( const char *  function)

Set/Get input string to evaluate.

◆ GetFunction()

virtual char * vtkFunctionParser::GetFunction ( )
virtual

Set/Get input string to evaluate.

◆ IsScalarResult()

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.

◆ IsVectorResult()

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.

◆ GetScalarResult()

double vtkFunctionParser::GetScalarResult ( )

Get a scalar result from evaluating the input function.

◆ GetVectorResult() [1/2]

double * vtkFunctionParser::GetVectorResult ( )

Get a vector result from evaluating the input function.

◆ GetVectorResult() [2/2]

void vtkFunctionParser::GetVectorResult ( double  result[3])
inline

Get a vector result from evaluating the input function.

Definition at line 194 of file vtkFunctionParser.h.

◆ SetScalarVariableValue() [1/3]

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.

◆ SetScalarVariableValue() [2/3]

void vtkFunctionParser::SetScalarVariableValue ( const std::string &  variableName,
double  value 
)
inline

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.

Definition at line 211 of file vtkFunctionParser.h.

◆ SetScalarVariableValue() [3/3]

void vtkFunctionParser::SetScalarVariableValue ( int  i,
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.

◆ GetScalarVariableValue() [1/3]

double vtkFunctionParser::GetScalarVariableValue ( const char *  variableName)

Get the value of a scalar variable.

◆ GetScalarVariableValue() [2/3]

double vtkFunctionParser::GetScalarVariableValue ( const std::string &  variableName)
inline

Get the value of a scalar variable.

Definition at line 223 of file vtkFunctionParser.h.

◆ GetScalarVariableValue() [3/3]

double vtkFunctionParser::GetScalarVariableValue ( int  i)

Get the value of a scalar variable.

◆ SetVectorVariableValue() [1/6]

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.

◆ SetVectorVariableValue() [2/6]

void vtkFunctionParser::SetVectorVariableValue ( const std::string &  variableName,
double  xValue,
double  yValue,
double  zValue 
)
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 239 of file vtkFunctionParser.h.

◆ SetVectorVariableValue() [3/6]

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 244 of file vtkFunctionParser.h.

◆ SetVectorVariableValue() [4/6]

void vtkFunctionParser::SetVectorVariableValue ( const std::string &  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 248 of file vtkFunctionParser.h.

◆ SetVectorVariableValue() [5/6]

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.

◆ SetVectorVariableValue() [6/6]

void vtkFunctionParser::SetVectorVariableValue ( int  i,
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 253 of file vtkFunctionParser.h.

◆ GetVectorVariableValue() [1/6]

double * vtkFunctionParser::GetVectorVariableValue ( const char *  variableName)

Get the value of a vector variable.

◆ GetVectorVariableValue() [2/6]

double * vtkFunctionParser::GetVectorVariableValue ( const std::string &  variableName)
inline

Get the value of a vector variable.

Definition at line 264 of file vtkFunctionParser.h.

◆ GetVectorVariableValue() [3/6]

void vtkFunctionParser::GetVectorVariableValue ( const char *  variableName,
double  value[3] 
)
inline

Get the value of a vector variable.

Definition at line 268 of file vtkFunctionParser.h.

◆ GetVectorVariableValue() [4/6]

void vtkFunctionParser::GetVectorVariableValue ( const std::string &  variableName,
double  value[3] 
)
inline

Get the value of a vector variable.

Definition at line 275 of file vtkFunctionParser.h.

◆ GetVectorVariableValue() [5/6]

double * vtkFunctionParser::GetVectorVariableValue ( int  i)

Get the value of a vector variable.

◆ GetVectorVariableValue() [6/6]

void vtkFunctionParser::GetVectorVariableValue ( int  i,
double  value[3] 
)
inline

Get the value of a vector variable.

Definition at line 280 of file vtkFunctionParser.h.

◆ GetNumberOfScalarVariables()

int vtkFunctionParser::GetNumberOfScalarVariables ( )
inline

Get the number of scalar variables.

Definition at line 292 of file vtkFunctionParser.h.

◆ GetScalarVariableIndex() [1/2]

int vtkFunctionParser::GetScalarVariableIndex ( const char *  name)

Get scalar variable index or -1 if not found.

◆ GetScalarVariableIndex() [2/2]

int vtkFunctionParser::GetScalarVariableIndex ( const std::string &  name)
inline

Definition at line 298 of file vtkFunctionParser.h.

◆ GetNumberOfVectorVariables()

int vtkFunctionParser::GetNumberOfVectorVariables ( )
inline

Get the number of vector variables.

Definition at line 306 of file vtkFunctionParser.h.

◆ GetVectorVariableIndex() [1/2]

int vtkFunctionParser::GetVectorVariableIndex ( const char *  name)

Get scalar variable index or -1 if not found.

◆ GetVectorVariableIndex() [2/2]

int vtkFunctionParser::GetVectorVariableIndex ( const std::string &  name)
inline

Definition at line 312 of file vtkFunctionParser.h.

◆ GetScalarVariableName()

const char * vtkFunctionParser::GetScalarVariableName ( int  i)

Get the ith scalar variable name.

◆ GetVectorVariableName()

const char * vtkFunctionParser::GetVectorVariableName ( int  i)

Get the ith vector variable name.

◆ GetScalarVariableNeeded() [1/3]

bool vtkFunctionParser::GetScalarVariableNeeded ( int  i)

Returns whether a scalar variable is needed for the function evaluation.

This is only valid after a successful Parse(). Thus, call GetScalarResult() or IsScalarResult() or similar method before calling this.

◆ GetScalarVariableNeeded() [2/3]

bool vtkFunctionParser::GetScalarVariableNeeded ( const char *  variableName)

Returns whether a scalar variable is needed for the function evaluation.

This is only valid after a successful Parse(). Thus, call GetScalarResult() or IsScalarResult() or similar method before calling this.

◆ GetScalarVariableNeeded() [3/3]

bool vtkFunctionParser::GetScalarVariableNeeded ( const std::string &  variableName)
inline

Returns whether a scalar variable is needed for the function evaluation.

This is only valid after a successful Parse(). Thus, call GetScalarResult() or IsScalarResult() or similar method before calling this.

Definition at line 335 of file vtkFunctionParser.h.

◆ GetVectorVariableNeeded() [1/3]

bool vtkFunctionParser::GetVectorVariableNeeded ( int  i)

Returns whether a vector variable is needed for the function evaluation.

This is only valid after a successful Parse(). Thus, call GetVectorResult() or IsVectorResult() or similar method before calling this.

◆ GetVectorVariableNeeded() [2/3]

bool vtkFunctionParser::GetVectorVariableNeeded ( const char *  variableName)

Returns whether a vector variable is needed for the function evaluation.

This is only valid after a successful Parse(). Thus, call GetVectorResult() or IsVectorResult() or similar method before calling this.

◆ GetVectorVariableNeeded() [3/3]

bool vtkFunctionParser::GetVectorVariableNeeded ( const std::string &  variableName)
inline

Returns whether a vector variable is needed for the function evaluation.

This is only valid after a successful Parse(). Thus, call GetVectorResult() or IsVectorResult() or similar method before calling this.

Definition at line 349 of file vtkFunctionParser.h.

◆ RemoveAllVariables()

void vtkFunctionParser::RemoveAllVariables ( )

Remove all the current variables.

◆ RemoveScalarVariables()

void vtkFunctionParser::RemoveScalarVariables ( )

Remove all the scalar variables.

◆ RemoveVectorVariables()

void vtkFunctionParser::RemoveVectorVariables ( )

Remove all the vector variables.

◆ SetReplaceInvalidValues()

virtual void vtkFunctionParser::SetReplaceInvalidValues ( vtkTypeBool  )
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

◆ GetReplaceInvalidValues()

virtual vtkTypeBool 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

◆ ReplaceInvalidValuesOn()

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

◆ ReplaceInvalidValuesOff()

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

◆ SetReplacementValue()

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

◆ GetReplacementValue()

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

◆ CheckExpression()

void vtkFunctionParser::CheckExpression ( int &  pos,
char **  error 
)

Check the validity of the function expression.

◆ InvalidateFunction()

void vtkFunctionParser::InvalidateFunction ( )

Allow the user to force the function to be re-parsed.

◆ Parse()

int vtkFunctionParser::Parse ( )
protected

◆ Evaluate()

bool vtkFunctionParser::Evaluate ( )
protected

Evaluate the function, returning true on success, false on failure.

◆ CheckSyntax()

int vtkFunctionParser::CheckSyntax ( )
protected

◆ CopyParseError()

void vtkFunctionParser::CopyParseError ( int &  position,
char **  error 
)
protected

◆ RemoveSpaces()

void vtkFunctionParser::RemoveSpaces ( )
protected

◆ RemoveSpacesFrom()

char * vtkFunctionParser::RemoveSpacesFrom ( const char *  variableName)
protected

◆ OperatorWithinVariable()

int vtkFunctionParser::OperatorWithinVariable ( int  idx)
protected

◆ BuildInternalFunctionStructure()

int vtkFunctionParser::BuildInternalFunctionStructure ( )
protected

◆ BuildInternalSubstringStructure()

void vtkFunctionParser::BuildInternalSubstringStructure ( int  beginIndex,
int  endIndex 
)
protected

◆ AddInternalByte()

void vtkFunctionParser::AddInternalByte ( unsigned int  newByte)
protected

◆ IsSubstringCompletelyEnclosed()

int vtkFunctionParser::IsSubstringCompletelyEnclosed ( int  beginIndex,
int  endIndex 
)
protected

◆ FindEndOfMathFunction()

int vtkFunctionParser::FindEndOfMathFunction ( int  beginIndex)
protected

◆ FindEndOfMathConstant()

int vtkFunctionParser::FindEndOfMathConstant ( int  beginIndex)
protected

◆ IsVariableName()

int vtkFunctionParser::IsVariableName ( int  currentIndex)
protected

◆ IsElementaryOperator()

int vtkFunctionParser::IsElementaryOperator ( int  op)
protected

◆ GetMathFunctionNumber()

int vtkFunctionParser::GetMathFunctionNumber ( int  currentIndex)
protected

◆ GetMathFunctionNumberByCheckingParenthesis()

int vtkFunctionParser::GetMathFunctionNumberByCheckingParenthesis ( int  currentIndex)
protected

◆ GetMathFunctionStringLength()

int vtkFunctionParser::GetMathFunctionStringLength ( int  mathFunctionNumber)
protected

◆ GetMathConstantNumber()

int vtkFunctionParser::GetMathConstantNumber ( int  currentIndex)
protected

◆ GetMathConstantStringLength()

int vtkFunctionParser::GetMathConstantStringLength ( int  mathConstantNumber)
protected

◆ GetElementaryOperatorNumber()

unsigned char vtkFunctionParser::GetElementaryOperatorNumber ( char  op)
protected

◆ GetOperandNumber()

unsigned int vtkFunctionParser::GetOperandNumber ( int  currentIndex)
protected

◆ GetVariableNameLength()

int vtkFunctionParser::GetVariableNameLength ( int  variableNumber)
protected

◆ DisambiguateOperators()

int vtkFunctionParser::DisambiguateOperators ( )
protected

◆ UpdateNeededVariables()

void vtkFunctionParser::UpdateNeededVariables ( )
protected

Collects meta-data about which variables are needed by the current function.

This is called only after a successful call to this->Parse().

◆ SetParseError()

virtual void vtkFunctionParser::SetParseError ( const char *  )
protectedvirtual

◆ FindPositionInOriginalFunction()

int vtkFunctionParser::FindPositionInOriginalFunction ( const int &  pos)
protected

Member Data Documentation

◆ Function

char* vtkFunctionParser::Function
protected

Definition at line 445 of file vtkFunctionParser.h.

◆ FunctionWithSpaces

char* vtkFunctionParser::FunctionWithSpaces
protected

Definition at line 446 of file vtkFunctionParser.h.

◆ FunctionLength

int vtkFunctionParser::FunctionLength
protected

Definition at line 448 of file vtkFunctionParser.h.

◆ ScalarVariableNames

std::vector<std::string> vtkFunctionParser::ScalarVariableNames
protected

Definition at line 449 of file vtkFunctionParser.h.

◆ VectorVariableNames

std::vector<std::string> vtkFunctionParser::VectorVariableNames
protected

Definition at line 450 of file vtkFunctionParser.h.

◆ ScalarVariableValues

std::vector<double> vtkFunctionParser::ScalarVariableValues
protected

Definition at line 451 of file vtkFunctionParser.h.

◆ VectorVariableValues

std::vector<vtkTuple<double, 3> > vtkFunctionParser::VectorVariableValues
protected

Definition at line 452 of file vtkFunctionParser.h.

◆ ScalarVariableNeeded

std::vector<bool> vtkFunctionParser::ScalarVariableNeeded
protected

Definition at line 453 of file vtkFunctionParser.h.

◆ VectorVariableNeeded

std::vector<bool> vtkFunctionParser::VectorVariableNeeded
protected

Definition at line 454 of file vtkFunctionParser.h.

◆ ByteCode

std::vector<unsigned int> vtkFunctionParser::ByteCode
protected

Definition at line 456 of file vtkFunctionParser.h.

◆ ByteCodeSize

int vtkFunctionParser::ByteCodeSize
protected

Definition at line 457 of file vtkFunctionParser.h.

◆ Immediates

double* vtkFunctionParser::Immediates
protected

Definition at line 458 of file vtkFunctionParser.h.

◆ ImmediatesSize

int vtkFunctionParser::ImmediatesSize
protected

Definition at line 459 of file vtkFunctionParser.h.

◆ Stack

double* vtkFunctionParser::Stack
protected

Definition at line 460 of file vtkFunctionParser.h.

◆ StackSize

int vtkFunctionParser::StackSize
protected

Definition at line 461 of file vtkFunctionParser.h.

◆ StackPointer

int vtkFunctionParser::StackPointer
protected

Definition at line 462 of file vtkFunctionParser.h.

◆ FunctionMTime

vtkTimeStamp vtkFunctionParser::FunctionMTime
protected

Definition at line 464 of file vtkFunctionParser.h.

◆ ParseMTime

vtkTimeStamp vtkFunctionParser::ParseMTime
protected

Definition at line 465 of file vtkFunctionParser.h.

◆ VariableMTime

vtkTimeStamp vtkFunctionParser::VariableMTime
protected

Definition at line 466 of file vtkFunctionParser.h.

◆ EvaluateMTime

vtkTimeStamp vtkFunctionParser::EvaluateMTime
protected

Definition at line 467 of file vtkFunctionParser.h.

◆ CheckMTime

vtkTimeStamp vtkFunctionParser::CheckMTime
protected

Definition at line 468 of file vtkFunctionParser.h.

◆ ReplaceInvalidValues

vtkTypeBool vtkFunctionParser::ReplaceInvalidValues
protected

Definition at line 470 of file vtkFunctionParser.h.

◆ ReplacementValue

double vtkFunctionParser::ReplacementValue
protected

Definition at line 471 of file vtkFunctionParser.h.

◆ ParseErrorPositon

int vtkFunctionParser::ParseErrorPositon
protected

Definition at line 473 of file vtkFunctionParser.h.

◆ ParseError

char* vtkFunctionParser::ParseError
protected

Definition at line 474 of file vtkFunctionParser.h.


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