From e26249b05ed6d6cc5d67e49c6e1921af2167a7bf Mon Sep 17 00:00:00 2001 From: heister Date: Mon, 24 Feb 2014 16:19:55 +0000 Subject: [PATCH] muparser: compatibility work git-svn-id: https://svn.dealii.org/branches/branch_muparser@32535 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/base/function_parser.cc | 69 ++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) 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