00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "G4tgrEvaluator.hh"
00037
00038 #include <cmath>
00039
00040
00041 G4tgrEvaluator::G4tgrEvaluator()
00042 {
00043 AddCommonFunctions();
00044 }
00045
00046
00047
00048 G4tgrEvaluator::~G4tgrEvaluator()
00049 {
00050 }
00051
00052
00053
00054 void G4tgrEvaluator::print_error( G4int estatus ) const
00055 {
00056 switch (estatus)
00057 {
00058 case ERROR_SYNTAX_ERROR:
00059 G4cerr << "G4tgrEvaluator: syntax error!" << G4endl;
00060 return;
00061 default:
00062 G4Evaluator::print_error();
00063 return;
00064 }
00065 }
00066
00067 G4double fsin( G4double arg ){ return std::sin(arg); }
00068 G4double fcos( G4double arg ){ return std::cos(arg); }
00069 G4double ftan( G4double arg ){ return std::tan(arg); }
00070 G4double fasin( G4double arg ){ return std::asin(arg); }
00071 G4double facos( G4double arg ){ return std::acos(arg); }
00072 G4double fatan( G4double arg ){ return std::atan(arg); }
00073 G4double fatan2( G4double arg1, G4double arg2 ){ return std::atan2(arg1,arg2); }
00074 G4double fsinh( G4double arg ){ return std::sinh(arg); }
00075 G4double fcosh( G4double arg ){ return std::cosh(arg); }
00076 G4double ftanh( G4double arg ){ return std::tanh(arg); }
00077
00078
00079
00080 G4double fsqrt( G4double arg ){ return std::sqrt(arg); }
00081 G4double fexp( G4double arg ){ return std::exp(arg); }
00082 G4double flog( G4double arg ){ return std::log(arg); }
00083 G4double flog10( G4double arg ){ return std::log10(arg); }
00084 G4double fpow( G4double arg1, G4double arg2 ){ return std::pow(arg1,arg2); }
00085
00086
00087
00088 void G4tgrEvaluator::AddCommonFunctions()
00089 {
00090 setFunction("sin", (*fsin));
00091 setFunction("cos", (*fcos));
00092 setFunction("tan", (*ftan));
00093 setFunction("asin", (*fasin));
00094 setFunction("acos", (*facos));
00095 setFunction("atan", (*fatan));
00096 setFunction("atan2", (*fatan2));
00097 setFunction("sinh", (*fsinh));
00098 setFunction("cosh", (*fcosh));
00099 setFunction("tanh", (*ftanh));
00100
00101
00102
00103 setFunction("sqrt", (*fsqrt));
00104 setFunction("exp", (*fexp));
00105 setFunction("log", (*flog));
00106 setFunction("log10", (*flog10));
00107 setFunction("pow", (*fpow));
00108 }