34#ifndef vtkExprTkFunctionParser_h
35#define vtkExprTkFunctionParser_h
37#include "vtkCommonMiscModule.h"
94 void GetVectorResult(
double result[3])
96 double* r = this->GetVectorResult();
138 const std::string& variableName,
double xValue,
double yValue,
double zValue);
141 this->SetVectorVariableValue(variableName, values[0], values[1], values[2]);
146 this->SetVectorVariableValue(i, values[0], values[1], values[2]);
157 double* r = this->GetVectorVariableValue(variableName);
165 double* r = this->GetVectorVariableValue(i);
177 return static_cast<int>(this->UsedScalarVariableNames.size());
190 return static_cast<int>(this->UsedVectorVariableNames.size());
253 vtkSetMacro(ReplacementValue,
double);
254 vtkGetMacro(ReplacementValue,
double);
Parse and evaluate a mathematical expression.
bool CheckOldFormatOfDotProductUsage()
Check possible usage of old format of dot product, e.g.
vtkTimeStamp FunctionMTime
const char * GetFunction()
Set/Get input string to evaluate.
void GetVectorVariableValue(int i, double value[3])
Get the value of a vector variable.
void RemoveScalarVariables()
Remove all the scalar variables.
int GetNumberOfScalarVariables()
Get the number of scalar variables.
vtkExprTkTools * ExprTkTools
std::vector< vtkTuple< double, 3 > * > VectorVariableValues
double * GetVectorVariableValue(const std::string &variableName)
Get the value of a vector variable.
vtkTypeBool ReplaceInvalidValues
void UpdateNeededVariables()
Collects meta-data about which variables are needed by the current function.
void GetVectorVariableValue(const std::string &variableName, double value[3])
Get the value of a vector variable.
int GetNumberOfVectorVariables()
Get the number of vector variables.
std::vector< std::string > OriginalScalarVariableNames
std::vector< bool > ScalarVariableNeeded
std::vector< std::string > OriginalVectorVariableNames
void SetScalarVariableValue(const std::string &variableName, double value)
Set the value of a scalar variable.
void RemoveVectorVariables()
Remove all the vector variables.
std::string ExpressionString
void SetVectorVariableValue(int i, double values[3])
Set the value of a vector variable.
void RemoveAllVariables()
Remove all the current variables.
double GetScalarVariableValue(const std::string &variableName)
Get the value of a scalar variable.
int GetVectorVariableIndex(const std::string &name)
Get scalar variable index or -1 if not found.
double * GetVectorVariableValue(int i)
Get the value of a vector variable.
void InvalidateFunction()
Allow the user to force the function to be re-parsed.
int GetScalarVariableIndex(const std::string &name)
Get scalar variable index or -1 if not found.
void SetVectorVariableValue(const std::string &variableName, double values[3])
Set the value of a vector variable.
std::vector< std::string > UsedVectorVariableNames
double GetScalarResult()
Get a scalar result from evaluating the input function.
ParseMode
The first mode parses the function and uses a return statement to identify the ReturnType.
int Parse(ParseMode mode)
Parses the given function, returning true on success, false on failure.
std::string FixVectorReturningFunctionOccurrences(VectorReturningFunction vectorReturningFunction)
ExprTk does not support functions which return a vector.
bool GetScalarVariableNeeded(const std::string &variableName)
Returns whether a scalar variable is needed for the function evaluation.
void SetVectorVariableValue(const std::string &variableName, double xValue, double yValue, double zValue)
Set the value of a vector variable.
vtkTimeStamp VariableMTime
vtkTuple< double, 3 > Result
void SetFunction(const char *function)
Set/Get input string to evaluate.
void SetVectorVariableValue(int i, double xValue, double yValue, double zValue)
Set the value of a vector variable.
double * GetVectorResult()
Get a vector result from evaluating the input function.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int IsScalarResult()
Check whether the result is a scalar result.
std::string GetScalarVariableName(int i)
Get the ith scalar variable name.
std::vector< std::string > UsedScalarVariableNames
bool GetVectorVariableNeeded(int i)
Returns whether a vector variable is needed for the function evaluation.
bool GetScalarVariableNeeded(int i)
Returns whether a scalar variable is needed for the function evaluation.
double GetScalarVariableValue(int i)
Get the value of a scalar variable.
static std::string SanitizeName(const char *name)
Sanitize a label/name to remove spaces, delimiters etc.
std::vector< bool > VectorVariableNeeded
vtkMTimeType GetMTime() override
Return parser's MTime.
~vtkExprTkFunctionParser() override
std::string FunctionWithUsedVariableNames
bool Evaluate()
Evaluate the function, returning true on success, false on failure.
vtkExprTkFunctionParser()
std::string GetVectorVariableName(int i)
Get the ith vector variable name.
VectorReturningFunction
Enum that defines the vector returning functions that are not supported by ExprTk.
bool GetVectorVariableNeeded(const std::string &variableName)
Returns whether a vector variable is needed for the function evaluation.
static vtkExprTkFunctionParser * New()
vtkTimeStamp EvaluateMTime
std::vector< double * > ScalarVariableValues
int IsVectorResult()
Check whether the result is a vector result.
void SetScalarVariableValue(int i, double value)
Set the value of a scalar variable.
a simple class to control print indentation
abstract base class for most VTK objects
record modification and/or execution time
templated base type for containers of constant size.
vtkTypeUInt32 vtkMTimeType
#define VTK_SIZEHINT(...)