36 #ifndef NEKTAR_LIBUTILITIES_EQUATION_HPP
37 #define NEKTAR_LIBUTILITIES_EQUATION_HPP
48 #include <boost/algorithm/string/trim.hpp>
52 namespace LibUtilities
70 boost::algorithm::trim(
m_expr);
79 catch (
const std::runtime_error& e)
82 std::string msg(std::string(
"Equation::Equation() fails on expression [") +
m_expr + std::string(
"]\n"));
87 catch (
const std::string& e)
90 std::string msg(std::string(
"Equation::Equation() fails on expression [") +
m_expr + std::string(
"]\n"));
111 catch (
const std::runtime_error& e)
113 std::string msg(std::string(
"Equation::Evaluate fails on expression [") +
m_expr + std::string(
"]\n"));
114 ASSERTL0(
false, msg + std::string(
"ERROR: ") + e.what());
116 catch (
const std::string& e)
118 std::string msg(std::string(
"Equation::Evaluate fails on expression [") +
m_expr + std::string(
"]\n"));
119 ASSERTL0(
false, msg + std::string(
"ERROR: ") + e);
133 catch (
const std::runtime_error& e)
135 std::string msg(std::string(
"Equation::Evaluate fails on expression [") +
m_expr + std::string(
"]\n"));
136 ASSERTL0(
false, msg + std::string(
"ERROR: ") + e.what());
138 catch (
const std::string& e)
140 std::string msg(std::string(
"Equation::Evaluate fails on expression [") +
m_expr + std::string(
"]\n"));
141 ASSERTL0(
false, msg + std::string(
"ERROR: ") + e);
182 catch (
const std::runtime_error& e)
184 std::string msg(std::string(
"Equation::Evaluate fails on expression [") +
m_expr + std::string(
"]\n"));
185 ASSERTL0(
false, msg + std::string(
"ERROR: ") + e.what());
188 catch (
const std::string& e)
190 std::string msg(std::string(
"Equation::Evaluate fails on expression [") +
m_expr + std::string(
"]\n"));
191 ASSERTL0(
false, msg + std::string(
"ERROR: ") + e);
226 #endif //NEKTAR_LIBUTILITIES_EQUATION_HPP
NekDouble GetTime() const
Returns the total time spent in evaluation procedures, seconds.
void AddConstants(std::map< std::string, NekDouble > const &constants)
Constants are evaluated and inserted into the function at the time it is parsed when calling the Defi...
#define ASSERTL0(condition, msg)
void SetParameter(std::string const &name, NekDouble value)
This function behaves in the same way as SetParameters, but it only adds one parameter and it does no...
std::string GetExpression(void) const
void SetParameter(const std::string &name, NekDouble value)
NekDouble Evaluate(const int AnalyticExpression_id)
Evaluation method for expressions depending on parameters only.
Equation & operator=(const Equation &src)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
NekDouble GetTime() const
Returns time spend on expression evaluation at points (it does not include parse/pre-processing time)...
#define LIB_UTILITIES_EXPORT
NekDouble Evaluate(NekDouble x, NekDouble y=0, NekDouble z=0, NekDouble t=0) const
void Evaluate(const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z, Array< OneD, NekDouble > &result)
NekDouble Evaluate() const
This class defines evaluator of analytic (symbolic) mathematical expressions. Expressions are allowed...
Equation(const SessionReaderSharedPtr &session, const std::string &expr="")
int DefineFunction(const std::string &vlist, const std::string &function)
This function allows one to define a function to evaluate. The first argument (vlist) is a list of va...
Equation(const Equation &src)
AnalyticExpressionEvaluator & m_evaluator
void Evaluate(const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z, const NekDouble t, Array< OneD, NekDouble > &result) const
void Evaluate(const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z, const Array< OneD, const NekDouble > &t, Array< OneD, NekDouble > &result) const
void SetConstants(const std::map< std::string, NekDouble > &constants)