50 likes | 325 Views
CLHEP / Evaluator Class. Evgueni Tcherniaev IT / API LHC++ meeting CERN, 2 November 2000. New class in CLHEP 1.6. CLHEP 1.6: Alist, String, Combination have been disabled as obsolete;
E N D
CLHEP / Evaluator Class Evgueni Tcherniaev IT / API LHC++ meeting CERN, 2 November 2000
New class in CLHEP 1.6 • CLHEP 1.6: • Alist, String, Combination have been disabled as obsolete; • Added Evaluator of arithmetic expressions with an extendable dictionary. • Expression may contain numbers, variables, functions separated by arithmetic (+, -, /, *, ^, **) and logical operators (==, !=, >, >=, <, <=, &&, ||). • User can add new variables and functions to the dictionary.
Evaluator: Member functions I • Constructor: • HepTool::Evaluator() • Main functions: • double evaluate(const char* expression) • void setVariable(const char* name, double value) void setVariable(const char* name, const char* expression) • void setFunction(const char* name, double (*fun)()) void setFunction(const char* name, double (*fun)(double)) void setFunction(const char* name, double (*fun)(double, double)) ...
Evaluator: Member functions II • Other functions: • int status() • int error_position() • void print_error() • bool findVariable(const char* name) • bool findFunction(const char* name, int npar) • void removeVariable(const char* name) • void removeFunction(const char* name, int npar) • void clear()
Evaluator: Member functions III • Special functions: • void setStdMath() • void setSystemOfUnits(double meter = 1, double kilogram = 1, double second = 1, double ampere = 1, double kelvin = 1, double mole = 1, double candela = 1)