namespace FunctionParser
{
int
- mu_round(double val)
+ mu_round(const double val)
{
return static_cast<int>(val + ((val >= 0.0) ? 0.5 : -0.5));
}
+
+
double
- mu_if(double condition, double thenvalue, double elsevalue)
+ mu_if(const double condition,
+ const double thenvalue,
+ const double elsevalue)
{
if (mu_round(condition) != 0)
return thenvalue;
return elsevalue;
}
+
+
double
- mu_or(double left, double right)
+ mu_or(const double left, const double right)
{
return static_cast<double>((mu_round(left) != 0) ||
(mu_round(right) != 0));
}
+
+
double
- mu_and(double left, double right)
+ mu_and(const double left, const double right)
{
return static_cast<double>((mu_round(left) != 0) &&
(mu_round(right) != 0));
}
+
+
double
- mu_int(double value)
+ mu_int(const double value)
{
return static_cast<double>(mu_round(value));
}
+
+
double
- mu_ceil(double value)
+ mu_ceil(const double value)
{
return std::ceil(value);
}
+
+
double
- mu_floor(double value)
+ mu_floor(const double value)
{
return std::floor(value);
}
+
+
double
- mu_cot(double value)
+ mu_cot(const double value)
{
return 1.0 / std::tan(value);
}
+
+
double
- mu_csc(double value)
+ mu_csc(const double value)
{
return 1.0 / std::sin(value);
}
+
+
double
- mu_sec(double value)
+ mu_sec(const double value)
{
return 1.0 / std::cos(value);
}
+
+
double
- mu_log(double value)
+ mu_log(const double value)
{
return std::log(value);
}
+
+
double
- mu_pow(double a, double b)
+ mu_pow(const double a, const double b)
{
return std::pow(a, b);
}
+
+
double
- mu_erf(double value)
+ mu_erf(const double value)
{
return std::erf(value);
}
+
+
double
- mu_erfc(double value)
+ mu_erfc(const double value)
{
return std::erfc(value);
}
- // returns a random value in the range [0,1] initializing the generator
- // with the given seed
+
+
+ // Returns a random value in the range [0,1], after initializing the
+ // generator with the given seed
double
- mu_rand_seed(double seed)
+ mu_rand_seed(const double seed)
{
static std::mutex rand_mutex;
std::lock_guard<std::mutex> lock(rand_mutex);
return uniform_distribution(rng_map[seed]);
}
- // returns a random value in the range [0,1]
+
+ // Returns a random value in the range [0,1]
double
mu_rand()
{
return uniform_distribution(rng);
}
+
+
std::vector<std::string>
get_function_names()
{
};
#endif
+
+
template <int dim, typename Number>
ParserImplementation<dim, Number>::ParserImplementation()
: initialized(false)