From: Timo Heister Date: Mon, 24 Feb 2014 16:19:55 +0000 (+0000) Subject: muparser: compatibility work X-Git-Tag: v8.2.0-rc1~771^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d05265f5b38090ead4ab4a20bdd96f9e96f20593;p=dealii.git muparser: compatibility work git-svn-id: https://svn.dealii.org/branches/branch_muparser@32535 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/base/function_parser.cc b/deal.II/source/base/function_parser.cc index ecb3a9bcc6..fd3d083105 100644 --- a/deal.II/source/base/function_parser.cc +++ b/deal.II/source/base/function_parser.cc @@ -73,7 +73,64 @@ void FunctionParser::initialize (const std::string &vars, initialize(vars, expressions, constants, time_dependent, false); } +namespace internal +{ + // convert double into int + int mu_round(double val) + { + return static_cast(val + ((val>=0.0) ? 0.5 : -0.5) ); + } + + double mu_if(double condition, double thenvalue, double elsevalue) + { + if (mu_round(condition)) + return thenvalue; + else + return elsevalue; + } + + double mu_or(double left, double right) + { + return (mu_round(left)) || (mu_round(right)); + } + + double mu_and(double left, double right) + { + return (mu_round(left)) && (mu_round(right)); + } + + double mu_int(double value) + { + return static_cast(mu_round(value)); + } + double mu_ceil(double value) + { + return ceil(value); + } + double mu_floor(double value) + { + return floor(value); + } + double mu_cot(double value) + { + return 1.0/tan(value); + } + double mu_csc(double value) + { + return 1.0/sin(value); + } + double mu_sec(double value) + { + return 1.0/cos(value); + } + double mu_log(double value) + { + return log(value); + } + + +} template void FunctionParser:: init_muparser() const @@ -97,6 +154,18 @@ void FunctionParser:: init_muparser() const for (unsigned int iv=0;iv