23#ifndef __GLOBAL_FUNCTIONS_H__
24#define __GLOBAL_FUNCTIONS_H__
29#include "boost/tuple/tuple.hpp"
30#include "boost/variant/get.hpp"
31#include "boost/variant/variant.hpp"
85 if (args.size() != 1) {
87 "sqrt expects 1 arguments, " + std::to_string(args.size()) +
" given");
90 double value = boost::get<double>(args[0]);
91 return boost::make_tuple(
sqrt(value),
true);
97 if (args.size() != 1) {
99 "sq expects 1 arguments, " + std::to_string(args.size()) +
" given");
102 double value = boost::get<double>(args[0]);
103 return boost::make_tuple(value * value,
true);
109 if (args.size() != 2) {
111 "pow expects 2 arguments, " + std::to_string(args.size()) +
" given");
114 double value = boost::get<double>(args[0]);
115 double exp = boost::get<double>(args[1]);
116 return boost::make_tuple(
pow(value,
exp),
true);
122 if (args.size() != 1) {
124 "exp expects 1 arguments, " + std::to_string(args.size()) +
" given");
127 double value = boost::get<double>(args[0]);
128 return boost::make_tuple(
exp(value),
true);
134 if (args.size() != 1) {
136 "log expects 1 arguments, " + std::to_string(args.size()) +
" given");
139 double value = boost::get<double>(args[0]);
140 return boost::make_tuple(
log(value),
true);
148 if (args.size() != 1) {
150 "ceil expects 1 arguments, " + std::to_string(args.size()) +
" given");
153 double value = boost::get<double>(args[0]);
154 return boost::make_tuple(
ceil(value),
true);
160 if (args.size() != 1) {
162 "fabs expects 1 arguments, " + std::to_string(args.size()) +
" given");
165 double value = boost::get<double>(args[0]);
166 return boost::make_tuple(
fabs(value),
true);
172 if (args.size() != 1) {
174 "floor expects 1 arguments, " + std::to_string(args.size()) +
" given");
177 double value = boost::get<double>(args[0]);
178 return boost::make_tuple(
floor(value),
true);
184 if (args.size() != 2) {
186 "fmod expects 2 arguments, " + std::to_string(args.size()) +
" given");
189 double value = boost::get<double>(args[0]);
190 double val2 = boost::get<double>(args[1]);
191 return boost::make_tuple(
fmod(value, val2),
true);
199 if (args.size() != 1) {
201 "sin expects 1 arguments, " + std::to_string(args.size()) +
" given");
204 double value = boost::get<double>(args[0]);
205 return boost::make_tuple(
sin(value),
true);
211 if (args.size() != 1) {
213 "asin expects 1 arguments, " + std::to_string(args.size()) +
" given");
216 double value = boost::get<double>(args[0]);
217 return boost::make_tuple(
asin(value),
true);
223 if (args.size() != 1) {
225 "cos expects 1 arguments, " + std::to_string(args.size()) +
" given");
228 double value = boost::get<double>(args[0]);
229 return boost::make_tuple(
cos(value),
true);
235 if (args.size() != 1) {
237 "acos expects 1 arguments, " + std::to_string(args.size()) +
" given");
240 double value = boost::get<double>(args[0]);
241 return boost::make_tuple(
acos(value),
true);
247 if (args.size() != 1) {
249 "tan expects 1 arguments, " + std::to_string(args.size()) +
" given");
252 double value = boost::get<double>(args[0]);
253 return boost::make_tuple(
tan(value),
true);
259 if (args.size() != 1) {
261 "atan expects 1 arguments, " + std::to_string(args.size()) +
" given");
264 double value = boost::get<double>(args[0]);
265 return boost::make_tuple(
atan(value),
true);
272 typedef std::pair<std::string, client::function::type> funcEntry_t;
276 funcs.insert(funcEntry_t(
"sqrt", sqrt_));
278 funcs.insert(funcEntry_t(
"sq", sq_));
280 funcs.insert(funcEntry_t(
"pow", pow_));
282 funcs.insert(funcEntry_t(
"exp", exp_));
284 funcs.insert(funcEntry_t(
"log", log_));
288 funcs.insert(funcEntry_t(
"ceil", ceil_));
290 funcs.insert(funcEntry_t(
"fabs", fabs_));
292 funcs.insert(funcEntry_t(
"floor", floor_));
294 funcs.insert(funcEntry_t(
"fmod", fmod_));
298 funcs.insert(funcEntry_t(
"sin", sin_));
300 funcs.insert(funcEntry_t(
"asin", asin_));
302 funcs.insert(funcEntry_t(
"cos", cos_));
304 funcs.insert(funcEntry_t(
"acos", acos_));
306 funcs.insert(funcEntry_t(
"tan", tan_));
308 funcs.insert(funcEntry_t(
"atan", atan_));
Tps< T > log(const Tps< T > &x)
Natural logarithm.
Tps< T > cos(const Tps< T > &x)
Cosine.
Tps< T > pow(const Tps< T > &x, int y)
Integer power.
Tps< T > tan(const Tps< T > &x)
Tangent.
Tps< T > exp(const Tps< T > &x)
Exponential.
Tps< T > sin(const Tps< T > &x)
Sine.
Tps< T > sqrt(const Tps< T > &x)
Square root.
PETE_TUTree< FnCeil, typename T::PETE_Expr_t > ceil(const PETE_Expr< T > &l)
PETE_TUTree< FnArcCos, typename T::PETE_Expr_t > acos(const PETE_Expr< T > &l)
PETE_TUTree< FnFabs, typename T::PETE_Expr_t > fabs(const PETE_Expr< T > &l)
PETE_TUTree< FnArcSin, typename T::PETE_Expr_t > asin(const PETE_Expr< T > &l)
PETE_TUTree< FnArcTan, typename T::PETE_Expr_t > atan(const PETE_Expr< T > &l)
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
PETE_TBTree< FnFmod, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > fmod(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
std::map< std::string, client::function::type > functionDictionary_t
boost::tuple< double, bool > Result_t
std::vector< argument_t > arguments_t
boost::function< boost::tuple< double, bool >(arguments_t)> type
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)
Expressions::Result_t operator()(client::function::arguments_t args)