49
49
_interface_version = 0
51
51
# A list of supported math builtins
52
_cpp_math_builtins = [
53
# <cmath> functions: from http://www.cplusplus.com/reference/cmath/
54
54
"cos", "sin", "tan", "acos", "asin", "atan", "atan2",
55
"cosh", "sinh", "tanh",
56
"exp", "frexp", "ldexp", "log", "log10", "modf",
55
"cosh", "sinh", "tanh", "exp", "frexp", "ldexp", "log", "log10", "modf",
57
56
"pow", "sqrt", "ceil", "fabs", "floor", "fmod",
60
# math.h functions: http://en.wikibooks.org/wiki/C_Programming/C_Reference/math.h
61
"acos", "asin", "atan", "atan2", "ceil", "cos", "cosh", "exp",
62
"fabs", "floor", "fmod", "frexp", "ldexp", "log", "log10", "modf",
63
"pow", "sin", "sinh", "sqrt", "tan", "tanh", "acosh", "asinh", "atanh",
64
"cbrt", "copysign", "erf", "erfc", "exp2", "expm1", "fdim", "fma", "fmax",
65
"fmin", "hypot", "ilogb", "lgamma", "llrint", "lrint", "llround", "lround",
66
"log1p", "log2", "logb", "nan", "nearbyint", "nextafter", "nexttoward",
67
"remainder", "remquo", "rint", "round", "scalbln", "scalbn", "tgamma", "trunc"]
61
70
# functions from dolfin::math:
62
71
"sqr", "ipow", "rand", "near", "DOLFIN_EPS", "DOLFIN_PI", "pi"]
73
_all_math = list(set(_math_builtins).difference(_cpp_math_builtins)) + \
74
_math_dolfin + _cpp_math_builtins
68
80
const double pi = DOLFIN_PI;
69
""" % "\n".join("using std::%s;" % mf for mf in _math_builtins)
81
""" % "\n".join("using std::%s;" % mf for mf in _cpp_math_builtins)
72
84
_cpp_keywords = ["auto","const","double","float","int","short","struct","unsigned",