Geant4-11
|
#include <G4tgrEvaluator.hh>
Public Member Functions | |
void | clear () |
std::string | error_name () const |
int | error_position () const |
double | evaluate (const char *expression) |
bool | findFunction (const char *name, int npar) const |
bool | findVariable (const char *name) const |
G4tgrEvaluator () | |
void | print_error () const |
void | print_error (G4int status) const |
void | removeFunction (const char *name, int npar) |
void | removeVariable (const char *name) |
void | setFunction (const char *name, double(*fun)()) |
void | setFunction (const char *name, double(*fun)(double)) |
void | setFunction (const char *name, double(*fun)(double, double)) |
void | setFunction (const char *name, double(*fun)(double, double, double)) |
void | setFunction (const char *name, double(*fun)(double, double, double, double)) |
void | setFunction (const char *name, double(*fun)(double, double, double, double, double)) |
void | setStdMath () |
void | setSystemOfUnits (double meter=1.0, double kilogram=1.0, double second=1.0, double ampere=1.0, double kelvin=1.0, double mole=1.0, double candela=1.0) |
void | setVariable (const char *name, const char *expression) |
void | setVariable (const char *name, double value) |
int | status () const |
~G4tgrEvaluator () | |
Private Member Functions | |
void | AddCommonFunctions () |
Private Attributes | |
void * | p |
Definition at line 40 of file G4tgrEvaluator.hh.
|
inherited |
List of possible statuses. Status of the last operation can be obtained with status(). In case if status() is an ERROR the corresponding error message can be printed with print_error().
Definition at line 38 of file Evaluator.h.
G4tgrEvaluator::G4tgrEvaluator | ( | ) |
Definition at line 36 of file G4tgrEvaluator.cc.
References AddCommonFunctions().
G4tgrEvaluator::~G4tgrEvaluator | ( | ) |
Definition at line 42 of file G4tgrEvaluator.cc.
|
private |
Definition at line 80 of file G4tgrEvaluator.cc.
References fltacos(), fltasin(), fltatan(), fltatan2(), fltcos(), fltcosh(), fltexp(), fltlog(), fltlog10(), fltpow(), fltsin(), fltsinh(), fltsqrt(), flttan(), flttanh(), and HepTool::Evaluator::setFunction().
Referenced by G4tgrEvaluator().
|
inherited |
Clear all settings.
Definition at line 764 of file Evaluator.cc.
References HepTool::Evaluator::OK, HepTool::Evaluator::p, and s.
Referenced by G4GDMLEvaluator::Clear(), and G4GDMLEvaluator::G4GDMLEvaluator().
|
inherited |
get a string defining the error name
Definition at line 652 of file Evaluator.cc.
References HepTool::Evaluator::ERROR_CALCULATION_ERROR, HepTool::Evaluator::ERROR_EMPTY_PARAMETER, HepTool::Evaluator::ERROR_NOT_A_NAME, HepTool::Evaluator::ERROR_SYNTAX_ERROR, HepTool::Evaluator::ERROR_UNEXPECTED_SYMBOL, HepTool::Evaluator::ERROR_UNKNOWN_FUNCTION, HepTool::Evaluator::ERROR_UNKNOWN_VARIABLE, HepTool::Evaluator::ERROR_UNPAIRED_PARENTHESIS, HepTool::Evaluator::p, and s.
Referenced by HepTool::Evaluator::print_error().
|
inherited |
Returns position in the input string where the problem occured.
Definition at line 638 of file Evaluator.cc.
References HepTool::Evaluator::p.
|
inherited |
Evaluates the arithmetic expression given as character string. The expression may consist of numbers, variables and functions separated by arithmetic (+, - , /, *, ^, **) and logical operators (==, !=, >, >=, <, <=, &&, ||).
expression | input expression. |
Definition at line 613 of file Evaluator.cc.
References engine(), HepTool::Evaluator::p, s, and HepTool::Evaluator::WARNING_BLANK_STRING.
Referenced by G4GDMLEvaluator::Evaluate(), and G4tgrUtils::GetDouble().
|
inherited |
Finds the function in the dictionary.
name | name of the function to be unset. |
npar | number of parameters of the function. |
Definition at line 734 of file Evaluator.cc.
References MAX_N_PAR, CLHEP::detail::n, G4InuclParticleNames::name(), HepTool::Evaluator::p, REMOVE_BLANKS, s, and sss.
|
inherited |
Finds the variable in the dictionary.
name | name of the variable. |
Definition at line 723 of file Evaluator.cc.
References CLHEP::detail::n, G4InuclParticleNames::name(), HepTool::Evaluator::p, REMOVE_BLANKS, and s.
Referenced by G4GDMLEvaluator::DefineConstant(), G4GDMLEvaluator::DefineVariable(), and G4GDMLEvaluator::GetConstant().
|
inherited |
Prints error message if status() is an ERROR.
Definition at line 643 of file Evaluator.cc.
References HepTool::Evaluator::error_name(), HepTool::Evaluator::OK, HepTool::Evaluator::p, and s.
Referenced by G4GDMLEvaluator::Evaluate(), and print_error().
void G4tgrEvaluator::print_error | ( | G4int | status | ) | const |
Definition at line 47 of file G4tgrEvaluator.cc.
References HepTool::Evaluator::ERROR_SYNTAX_ERROR, G4cerr, G4endl, and HepTool::Evaluator::print_error().
Referenced by G4tgrUtils::GetDouble().
|
inherited |
Removes the function from the dictionary.
name | name of the function to be unset. |
npar | number of parameters of the function. |
Definition at line 754 of file Evaluator.cc.
References MAX_N_PAR, CLHEP::detail::n, G4InuclParticleNames::name(), HepTool::Evaluator::p, REMOVE_BLANKS, s, and sss.
|
inherited |
Removes the variable from the dictionary.
name | name of the variable. |
Definition at line 745 of file Evaluator.cc.
References CLHEP::detail::n, G4InuclParticleNames::name(), HepTool::Evaluator::p, REMOVE_BLANKS, and s.
|
inherited |
Adds to the dictionary a function without parameters. If such a function already exist in the dictionary, then status will be set to WARNING_EXISTING_FUNCTION.
name | function name. |
fun | pointer to the real function in the user code. |
Definition at line 698 of file Evaluator.cc.
References G4InuclParticleNames::name(), HepTool::Evaluator::p, and setItem().
Referenced by AddCommonFunctions(), and HepTool::Evaluator::setStdMath().
|
inherited |
Adds to the dictionary a function with one parameter. If such a function already exist in the dictionary, then status will be set to WARNING_EXISTING_FUNCTION.
name | function name. |
fun | pointer to the real function in the user code. |
Definition at line 702 of file Evaluator.cc.
References G4InuclParticleNames::name(), HepTool::Evaluator::p, and setItem().
|
inherited |
Adds to the dictionary a function with two parameters. If such a function already exist in the dictionary, then status will be set to WARNING_EXISTING_FUNCTION.
name | function name. |
fun | pointer to the real function in the user code. |
Definition at line 706 of file Evaluator.cc.
References G4InuclParticleNames::name(), HepTool::Evaluator::p, and setItem().
|
inherited |
Adds to the dictionary a function with three parameters. If such a function already exist in the dictionary, then status will be set to WARNING_EXISTING_FUNCTION.
name | function name. |
fun | pointer to the real function in the user code. |
Definition at line 710 of file Evaluator.cc.
References G4InuclParticleNames::name(), HepTool::Evaluator::p, and setItem().
|
inherited |
Adds to the dictionary a function with four parameters. If such a function already exist in the dictionary, then status will be set to WARNING_EXISTING_FUNCTION.
name | function name. |
fun | pointer to the real function in the user code. |
Definition at line 714 of file Evaluator.cc.
References G4InuclParticleNames::name(), HepTool::Evaluator::p, and setItem().
|
inherited |
Adds to the dictionary a function with five parameters. If such a function already exist in the dictionary, then status will be set to WARNING_EXISTING_FUNCTION.
name | function name. |
fun | pointer to the real function in the user code. |
Definition at line 718 of file Evaluator.cc.
References G4InuclParticleNames::name(), HepTool::Evaluator::p, and setItem().
|
inherited |
Sets standard mathematical functions and constants.
Definition at line 29 of file setStdMath.cc.
References eval_abs(), eval_acos(), eval_asin(), eval_atan(), eval_atan2(), eval_cos(), eval_cosh(), eval_exp(), eval_log(), eval_log10(), eval_max(), eval_min(), eval_pow(), eval_sin(), eval_sinh(), eval_sqrt(), eval_tan(), eval_tanh(), HepTool::Evaluator::setFunction(), and HepTool::Evaluator::setVariable().
Referenced by G4GDMLEvaluator::Clear(), and G4GDMLEvaluator::G4GDMLEvaluator().
|
inherited |
Sets system of units. Default is the SI system of units. To set the CGS (Centimeter-Gram-Second) system of units one should call: setSystemOfUnits(100., 1000., 1.0, 1.0, 1.0, 1.0, 1.0);
To set system of units accepted in the GEANT4 simulation toolkit one should call:
The basic units in GEANT4 are:
Definition at line 8 of file setSystemOfUnits.cc.
References A, ampere, bar, barn, Bq, C(), candela, cd, cm, deg, e_SI, eV, g, kelvin, kg, kilogram, km, L, m, meter, mm, mole, ohm, pi, rad, s, S(), second, HepTool::Evaluator::setVariable(), and sr.
Referenced by G4GDMLEvaluator::Clear(), and G4GDMLEvaluator::G4GDMLEvaluator().
|
inherited |
Adds to the dictionary a variable with an arithmetic expression assigned to it. If a variable with such a name already exist in the dictionary, then status will be set to WARNING_EXISTING_VARIABLE.
name | name of the variable. |
expression | arithmetic expression. |
Definition at line 692 of file Evaluator.cc.
References G4InuclParticleNames::name(), HepTool::Evaluator::p, and setItem().
|
inherited |
Adds to the dictionary a variable with given value. If a variable with such a name already exist in the dictionary, then status will be set to WARNING_EXISTING_VARIABLE.
name | name of the variable. |
value | value assigned to the variable. |
Definition at line 689 of file Evaluator.cc.
References G4InuclParticleNames::name(), HepTool::Evaluator::p, and setItem().
Referenced by G4GDMLEvaluator::DefineConstant(), G4GDMLEvaluator::DefineVariable(), HepTool::Evaluator::setStdMath(), HepTool::Evaluator::setSystemOfUnits(), and G4GDMLEvaluator::SetVariable().
|
inherited |
Returns status of the last operation with the evaluator.
Definition at line 633 of file Evaluator.cc.
References HepTool::Evaluator::p.
Referenced by G4GDMLEvaluator::Evaluate(), and G4tgrUtils::GetDouble().
|
privateinherited |
Definition at line 256 of file Evaluator.h.
Referenced by HepTool::Evaluator::clear(), HepTool::Evaluator::error_name(), HepTool::Evaluator::error_position(), HepTool::Evaluator::evaluate(), HepTool::Evaluator::Evaluator(), HepTool::Evaluator::findFunction(), HepTool::Evaluator::findVariable(), HepTool::Evaluator::print_error(), HepTool::Evaluator::removeFunction(), HepTool::Evaluator::removeVariable(), HepTool::Evaluator::setFunction(), HepTool::Evaluator::setVariable(), HepTool::Evaluator::status(), and HepTool::Evaluator::~Evaluator().