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

Parse and evaluate a mathematical expression. More...

#include <vtkExprTkFunctionParser.h>

Inheritance diagram for vtkExprTkFunctionParser:
[legend]
Collaboration diagram for vtkExprTkFunctionParser:
[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...
 
vtkExprTkFunctionParserNewInstance () 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 std::string &name)
 Get scalar variable index or -1 if not found. More...
 
int GetNumberOfVectorVariables ()
 Get the number of vector variables. More...
 
int GetVectorVariableIndex (const std::string &name)
 Get scalar variable index or -1 if not found. More...
 
std::string GetScalarVariableName (int i)
 Get the ith scalar variable name. More...
 
std::string 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 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...
 
const 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 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 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 std::string &variableName, double xValue, double yValue, double zValue)
 Set the value of a vector variable. More...
 
void SetVectorVariableValue (const std::string &variableName, 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, double values[3])
 Set the value of a vector variable. More...
 
double * GetVectorVariableValue (const std::string &variableName)
 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 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 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 vtkExprTkFunctionParserNew ()
 
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkExprTkFunctionParserSafeDownCast (vtkObjectBase *o)
 
static std::string SanitizeName (const char *name)
 Sanitize a label/name to remove spaces, delimiters etc. More...
 
- 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 Types

enum  ParseMode { DetectReturnType , SaveResultInVariable }
 The first mode parses the function and uses a return statement to identify the ReturnType. More...
 
enum  VectorReturningFunction { Cross , Norm }
 Enum that defines the vector returning functions that are not supported by ExprTk. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkExprTkFunctionParser ()
 
 ~vtkExprTkFunctionParser () override
 
int Parse (ParseMode mode)
 Parses the given function, returning true on success, false on failure. More...
 
std::string FixVectorReturningFunctionOccurrences (VectorReturningFunction vectorReturningFunction)
 ExprTk does not support functions which return a vector. More...
 
bool CheckOldFormatOfDotProductUsage ()
 Check possible usage of old format of dot product, e.g. More...
 
bool Evaluate ()
 Evaluate the function, returning true on success, false on failure. More...
 
void UpdateNeededVariables ()
 Collects meta-data about which variables are needed by the current function. More...
 
- 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

std::string Function
 
std::string FunctionWithUsedVariableNames
 
std::string ExpressionString
 
std::vector< std::string > OriginalScalarVariableNames
 
std::vector< std::string > UsedScalarVariableNames
 
std::vector< std::string > OriginalVectorVariableNames
 
std::vector< std::string > UsedVectorVariableNames
 
std::vector< double * > ScalarVariableValues
 
std::vector< vtkTuple< double, 3 > * > VectorVariableValues
 
std::vector< bool > ScalarVariableNeeded
 
std::vector< bool > VectorVariableNeeded
 
vtkTimeStamp FunctionMTime
 
vtkTimeStamp ParseMTime
 
vtkTimeStamp VariableMTime
 
vtkTimeStamp EvaluateMTime
 
vtkTypeBool ReplaceInvalidValues
 
double ReplacementValue
 
vtkExprTkTools * ExprTkTools
 
int ResultType
 
vtkTuple< double, 3 > Result
 
- 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.

vtkExprTkFunctionParser is a wrapper class of the ExprTK library 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.

The detailed documentation of the supported functionality is described in https://github.com/ArashPartow/exprtk. In addition to the documented functionality, the following vector operations have been implemented: 1) cross(v1, v2), cross product of two vectors, 2) mag(v), magnitude of a vector, 3) norm(v), the normalized version of a vector.

Thanks:
Arash Partow for implementing the ExprTk library.

Definition at line 46 of file vtkExprTkFunctionParser.h.

Member Typedef Documentation

◆ Superclass

Definition at line 50 of file vtkExprTkFunctionParser.h.

Member Enumeration Documentation

◆ ParseMode

The first mode parses the function and uses a return statement to identify the ReturnType.

The second mode parses the function and uses a result vector to store the results of the function knowing its return type. The second mode is used because it's a lot faster than the first.

Enumerator
DetectReturnType 
SaveResultInVariable 

Definition at line 281 of file vtkExprTkFunctionParser.h.

◆ VectorReturningFunction

Enum that defines the vector returning functions that are not supported by ExprTk.

Enumerator
Cross 
Norm 

Definition at line 297 of file vtkExprTkFunctionParser.h.

Constructor & Destructor Documentation

◆ vtkExprTkFunctionParser()

vtkExprTkFunctionParser::vtkExprTkFunctionParser ( )
protected

◆ ~vtkExprTkFunctionParser()

vtkExprTkFunctionParser::~vtkExprTkFunctionParser ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkExprTkFunctionParser * vtkExprTkFunctionParser::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

virtual vtkTypeBool vtkExprTkFunctionParser::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 vtkExprTkFunctionParser * vtkExprTkFunctionParser::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkExprTkFunctionParser::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkExprTkFunctionParser * vtkExprTkFunctionParser::NewInstance ( ) const

◆ PrintSelf()

void vtkExprTkFunctionParser::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 vtkExprTkFunctionParser::GetMTime ( )
overridevirtual

Return parser's MTime.

Reimplemented from vtkObject.

◆ SetFunction()

void vtkExprTkFunctionParser::SetFunction ( const char *  function)

Set/Get input string to evaluate.

◆ GetFunction()

const char * vtkExprTkFunctionParser::GetFunction ( )
inline

Set/Get input string to evaluate.

Definition at line 63 of file vtkExprTkFunctionParser.h.

◆ IsScalarResult()

int vtkExprTkFunctionParser::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 vtkExprTkFunctionParser::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 vtkExprTkFunctionParser::GetScalarResult ( )

Get a scalar result from evaluating the input function.

If ReplaceInvalidValues is not set, then the error value that will be return is NaN.

◆ GetVectorResult() [1/2]

double * vtkExprTkFunctionParser::GetVectorResult ( )

Get a vector result from evaluating the input function.

If ReplaceInvalidValues is not set, then the error value that will be return is [NaN, NaN, NaN].

◆ GetVectorResult() [2/2]

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

Get a vector result from evaluating the input function.

If ReplaceInvalidValues is not set, then the error value that will be return is [NaN, NaN, NaN].

Definition at line 94 of file vtkExprTkFunctionParser.h.

◆ SetScalarVariableValue() [1/2]

void vtkExprTkFunctionParser::SetScalarVariableValue ( const std::string &  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. If the variable name is not sanitized, it should be provided in quotes, and a valid unique string will be used as a replacement by the parser.

Note
A sanitized variable name is accepted by the following regex: ^[a-zA-Z][a-zA-Z_0-9]*.

◆ SetScalarVariableValue() [2/2]

void vtkExprTkFunctionParser::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. If the variable name is not sanitized, it should be provided in quotes, and a valid unique string will be used as a replacement by the parser.

Note
A sanitized variable name is accepted by the following regex: ^[a-zA-Z][a-zA-Z_0-9]*.

◆ GetScalarVariableValue() [1/2]

double vtkExprTkFunctionParser::GetScalarVariableValue ( const std::string &  variableName)

Get the value of a scalar variable.

◆ GetScalarVariableValue() [2/2]

double vtkExprTkFunctionParser::GetScalarVariableValue ( int  i)

Get the value of a scalar variable.

◆ SetVectorVariableValue() [1/4]

void vtkExprTkFunctionParser::SetVectorVariableValue ( const std::string &  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. If the variable name is not sanitized, it should be provided in quotes, and a valid unique string will be used as a replacement by the parser.

Note
A sanitized variable name is accepted by the following regex: ^[a-zA-Z][a-zA-Z_0-9]*.

◆ SetVectorVariableValue() [2/4]

void vtkExprTkFunctionParser::SetVectorVariableValue ( const std::string &  variableName,
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. If the variable name is not sanitized, it should be provided in quotes, and a valid unique string will be used as a replacement by the parser.

Note
A sanitized variable name is accepted by the following regex: ^[a-zA-Z][a-zA-Z_0-9]*.

Definition at line 139 of file vtkExprTkFunctionParser.h.

◆ SetVectorVariableValue() [3/4]

void vtkExprTkFunctionParser::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. If the variable name is not sanitized, it should be provided in quotes, and a valid unique string will be used as a replacement by the parser.

Note
A sanitized variable name is accepted by the following regex: ^[a-zA-Z][a-zA-Z_0-9]*.

◆ SetVectorVariableValue() [4/4]

void vtkExprTkFunctionParser::SetVectorVariableValue ( int  i,
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. If the variable name is not sanitized, it should be provided in quotes, and a valid unique string will be used as a replacement by the parser.

Note
A sanitized variable name is accepted by the following regex: ^[a-zA-Z][a-zA-Z_0-9]*.

Definition at line 144 of file vtkExprTkFunctionParser.h.

◆ GetVectorVariableValue() [1/4]

double * vtkExprTkFunctionParser::GetVectorVariableValue ( const std::string &  variableName)

Get the value of a vector variable.

◆ GetVectorVariableValue() [2/4]

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

Get the value of a vector variable.

Definition at line 155 of file vtkExprTkFunctionParser.h.

◆ GetVectorVariableValue() [3/4]

double * vtkExprTkFunctionParser::GetVectorVariableValue ( int  i)

Get the value of a vector variable.

◆ GetVectorVariableValue() [4/4]

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

Get the value of a vector variable.

Definition at line 163 of file vtkExprTkFunctionParser.h.

◆ GetNumberOfScalarVariables()

int vtkExprTkFunctionParser::GetNumberOfScalarVariables ( )
inline

Get the number of scalar variables.

Definition at line 175 of file vtkExprTkFunctionParser.h.

◆ GetScalarVariableIndex()

int vtkExprTkFunctionParser::GetScalarVariableIndex ( const std::string &  name)

Get scalar variable index or -1 if not found.

◆ GetNumberOfVectorVariables()

int vtkExprTkFunctionParser::GetNumberOfVectorVariables ( )
inline

Get the number of vector variables.

Definition at line 188 of file vtkExprTkFunctionParser.h.

◆ GetVectorVariableIndex()

int vtkExprTkFunctionParser::GetVectorVariableIndex ( const std::string &  name)

Get scalar variable index or -1 if not found.

◆ GetScalarVariableName()

std::string vtkExprTkFunctionParser::GetScalarVariableName ( int  i)

Get the ith scalar variable name.

◆ GetVectorVariableName()

std::string vtkExprTkFunctionParser::GetVectorVariableName ( int  i)

Get the ith vector variable name.

◆ GetScalarVariableNeeded() [1/2]

bool vtkExprTkFunctionParser::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/2]

bool vtkExprTkFunctionParser::GetScalarVariableNeeded ( const std::string &  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.

◆ GetVectorVariableNeeded() [1/2]

bool vtkExprTkFunctionParser::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/2]

bool vtkExprTkFunctionParser::GetVectorVariableNeeded ( const std::string &  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.

◆ RemoveAllVariables()

void vtkExprTkFunctionParser::RemoveAllVariables ( )

Remove all the current variables.

◆ RemoveScalarVariables()

void vtkExprTkFunctionParser::RemoveScalarVariables ( )

Remove all the scalar variables.

◆ RemoveVectorVariables()

void vtkExprTkFunctionParser::RemoveVectorVariables ( )

Remove all the vector variables.

◆ SetReplaceInvalidValues()

virtual void vtkExprTkFunctionParser::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 vtkExprTkFunctionParser::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 vtkExprTkFunctionParser::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 vtkExprTkFunctionParser::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 vtkExprTkFunctionParser::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 vtkExprTkFunctionParser::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

◆ InvalidateFunction()

void vtkExprTkFunctionParser::InvalidateFunction ( )

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

◆ SanitizeName()

static std::string vtkExprTkFunctionParser::SanitizeName ( const char *  name)
static

Sanitize a label/name to remove spaces, delimiters etc.

Once the label/name is sanitized is can be accepted by the following regex: ^[a-zA-Z][a-zA-Z_0-9]*.

Note
taken from vtkSMCoreUtilities

◆ Parse()

int vtkExprTkFunctionParser::Parse ( ParseMode  mode)
protected

Parses the given function, returning true on success, false on failure.

It has 2 modes (see ParseMode). Both modes need to be utilized to extract results of a function.

◆ FixVectorReturningFunctionOccurrences()

std::string vtkExprTkFunctionParser::FixVectorReturningFunctionOccurrences ( VectorReturningFunction  vectorReturningFunction)
protected

ExprTk does not support functions which return a vector.

All the cross(v1,v2) occurrences will be replaced with (iHat*crossX(v1,v2)+jHat*crossY(v1,v2)+kHat*crossZ(v1,v2)).

All the norm(v) occurrences will be replaced with ((v)/mag(v)).

◆ CheckOldFormatOfDotProductUsage()

bool vtkExprTkFunctionParser::CheckOldFormatOfDotProductUsage ( )
protected

Check possible usage of old format of dot product, e.g.

v1.v2

◆ Evaluate()

bool vtkExprTkFunctionParser::Evaluate ( )
protected

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

◆ UpdateNeededVariables()

void vtkExprTkFunctionParser::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().

Member Data Documentation

◆ Function

std::string vtkExprTkFunctionParser::Function
protected

Definition at line 330 of file vtkExprTkFunctionParser.h.

◆ FunctionWithUsedVariableNames

std::string vtkExprTkFunctionParser::FunctionWithUsedVariableNames
protected

Definition at line 331 of file vtkExprTkFunctionParser.h.

◆ ExpressionString

std::string vtkExprTkFunctionParser::ExpressionString
protected

Definition at line 332 of file vtkExprTkFunctionParser.h.

◆ OriginalScalarVariableNames

std::vector<std::string> vtkExprTkFunctionParser::OriginalScalarVariableNames
protected

Definition at line 336 of file vtkExprTkFunctionParser.h.

◆ UsedScalarVariableNames

std::vector<std::string> vtkExprTkFunctionParser::UsedScalarVariableNames
protected

Definition at line 337 of file vtkExprTkFunctionParser.h.

◆ OriginalVectorVariableNames

std::vector<std::string> vtkExprTkFunctionParser::OriginalVectorVariableNames
protected

Definition at line 338 of file vtkExprTkFunctionParser.h.

◆ UsedVectorVariableNames

std::vector<std::string> vtkExprTkFunctionParser::UsedVectorVariableNames
protected

Definition at line 339 of file vtkExprTkFunctionParser.h.

◆ ScalarVariableValues

std::vector<double*> vtkExprTkFunctionParser::ScalarVariableValues
protected

Definition at line 344 of file vtkExprTkFunctionParser.h.

◆ VectorVariableValues

std::vector<vtkTuple<double, 3>*> vtkExprTkFunctionParser::VectorVariableValues
protected

Definition at line 345 of file vtkExprTkFunctionParser.h.

◆ ScalarVariableNeeded

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

Definition at line 346 of file vtkExprTkFunctionParser.h.

◆ VectorVariableNeeded

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

Definition at line 347 of file vtkExprTkFunctionParser.h.

◆ FunctionMTime

vtkTimeStamp vtkExprTkFunctionParser::FunctionMTime
protected

Definition at line 349 of file vtkExprTkFunctionParser.h.

◆ ParseMTime

vtkTimeStamp vtkExprTkFunctionParser::ParseMTime
protected

Definition at line 350 of file vtkExprTkFunctionParser.h.

◆ VariableMTime

vtkTimeStamp vtkExprTkFunctionParser::VariableMTime
protected

Definition at line 351 of file vtkExprTkFunctionParser.h.

◆ EvaluateMTime

vtkTimeStamp vtkExprTkFunctionParser::EvaluateMTime
protected

Definition at line 352 of file vtkExprTkFunctionParser.h.

◆ ReplaceInvalidValues

vtkTypeBool vtkExprTkFunctionParser::ReplaceInvalidValues
protected

Definition at line 354 of file vtkExprTkFunctionParser.h.

◆ ReplacementValue

double vtkExprTkFunctionParser::ReplacementValue
protected

Definition at line 355 of file vtkExprTkFunctionParser.h.

◆ ExprTkTools

vtkExprTkTools* vtkExprTkFunctionParser::ExprTkTools
protected

Definition at line 357 of file vtkExprTkFunctionParser.h.

◆ ResultType

int vtkExprTkFunctionParser::ResultType
protected

Definition at line 359 of file vtkExprTkFunctionParser.h.

◆ Result

vtkTuple<double, 3> vtkExprTkFunctionParser::Result
protected

Definition at line 360 of file vtkExprTkFunctionParser.h.


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