rename EvalFuncImpl to EvalFuncScalar
This commit is contained in:
parent
38f7265dc1
commit
264146b22e
@ -201,7 +201,7 @@ int voigtIdx (int d1, int d2)
|
|||||||
|
|
||||||
|
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
EvalFuncImpl<Scalar>::EvalFuncImpl (const char* function, const char* x, Real eps)
|
EvalFuncScalar<Scalar>::EvalFuncScalar (const char* function, const char* x, Real eps)
|
||||||
: dx(eps)
|
: dx(eps)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -235,11 +235,11 @@ EvalFuncImpl<Scalar>::EvalFuncImpl (const char* function, const char* x, Real ep
|
|||||||
|
|
||||||
|
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
EvalFuncImpl<Scalar>::~EvalFuncImpl () = default;
|
EvalFuncScalar<Scalar>::~EvalFuncScalar () = default;
|
||||||
|
|
||||||
|
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
void EvalFuncImpl<Scalar>::addDerivative (const std::string& function, const char* x)
|
void EvalFuncScalar<Scalar>::addDerivative (const std::string& function, const char* x)
|
||||||
{
|
{
|
||||||
if (!gradient)
|
if (!gradient)
|
||||||
gradient = std::make_unique<FuncType>(function.c_str(),x);
|
gradient = std::make_unique<FuncType>(function.c_str(),x);
|
||||||
@ -247,7 +247,7 @@ void EvalFuncImpl<Scalar>::addDerivative (const std::string& function, const cha
|
|||||||
|
|
||||||
|
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
Real EvalFuncImpl<Scalar>::evaluate (const Real& x) const
|
Real EvalFuncScalar<Scalar>::evaluate (const Real& x) const
|
||||||
{
|
{
|
||||||
Real result = Real(0);
|
Real result = Real(0);
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@ -283,7 +283,7 @@ Real EvalFunc::deriv (Real x) const
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
Real EvalFuncImpl<autodiff::var>::deriv (Real x) const
|
Real EvalFuncScalar<autodiff::var>::deriv (Real x) const
|
||||||
{
|
{
|
||||||
if (gradient)
|
if (gradient)
|
||||||
return gradient->evaluate(x);
|
return gradient->evaluate(x);
|
||||||
@ -566,8 +566,8 @@ EvalMultiFunction<ParentFunc, Ret>::evalTimeDerivative (const Vec3& X) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template class EvalFuncImpl<Real>;
|
template class EvalFuncScalar<Real>;
|
||||||
template class EvalFuncImpl<autodiff::var>;
|
template class EvalFuncScalar<autodiff::var>;
|
||||||
template class EvalMultiFunction<VecFunc,Vec3>;
|
template class EvalMultiFunction<VecFunc,Vec3>;
|
||||||
template class EvalMultiFunction<TensorFunc,Tensor>;
|
template class EvalMultiFunction<TensorFunc,Tensor>;
|
||||||
template class EvalMultiFunction<STensorFunc,SymmTensor>;
|
template class EvalMultiFunction<STensorFunc,SymmTensor>;
|
||||||
|
@ -34,12 +34,12 @@ namespace ExprEval {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
class EvalFuncImpl : public ScalarFunc
|
class EvalFuncScalar : public ScalarFunc
|
||||||
{
|
{
|
||||||
using Expression = ExprEval::Expression<Scalar>; //!< Type alias for expression tree
|
using Expression = ExprEval::Expression<Scalar>; //!< Type alias for expression tree
|
||||||
using FunctionList = ExprEval::FunctionList<Scalar>; //!< Type alias for function list
|
using FunctionList = ExprEval::FunctionList<Scalar>; //!< Type alias for function list
|
||||||
using ValueList = ExprEval::ValueList<Scalar>; //!< Type alias for value list
|
using ValueList = ExprEval::ValueList<Scalar>; //!< Type alias for value list
|
||||||
using FuncType = EvalFuncImpl<Scalar>; //!< Type alias for function
|
using FuncType = EvalFuncScalar<Scalar>; //!< Type alias for function
|
||||||
std::vector<std::unique_ptr<Expression>> expr; //!< Roots of the expression tree
|
std::vector<std::unique_ptr<Expression>> expr; //!< Roots of the expression tree
|
||||||
std::vector<std::unique_ptr<FunctionList>> f; //!< Lists of functions
|
std::vector<std::unique_ptr<FunctionList>> f; //!< Lists of functions
|
||||||
std::vector<std::unique_ptr<ValueList>> v; //!< Lists of variables and constants
|
std::vector<std::unique_ptr<ValueList>> v; //!< Lists of variables and constants
|
||||||
@ -54,12 +54,12 @@ public:
|
|||||||
static int numError; //!< Error counter - set by the exception handler
|
static int numError; //!< Error counter - set by the exception handler
|
||||||
|
|
||||||
//! \brief The constructor parses the expression string.
|
//! \brief The constructor parses the expression string.
|
||||||
explicit EvalFuncImpl(const char* function, const char* x = "x",
|
explicit EvalFuncScalar(const char* function, const char* x = "x",
|
||||||
Real eps = Real(1.0e-8));
|
Real eps = Real(1.0e-8));
|
||||||
//! \brief Defaulted destructor.
|
//! \brief Defaulted destructor.
|
||||||
//! \details The implementation needs to be in compile unit so we have the
|
//! \details The implementation needs to be in compile unit so we have the
|
||||||
//! definition for the types of the unique_ptr's.
|
//! definition for the types of the unique_ptr's.
|
||||||
virtual ~EvalFuncImpl();
|
virtual ~EvalFuncScalar();
|
||||||
|
|
||||||
//! \brief Adds an expression function for a first derivative.
|
//! \brief Adds an expression function for a first derivative.
|
||||||
void addDerivative(const std::string& function, const char* x = "x");
|
void addDerivative(const std::string& function, const char* x = "x");
|
||||||
@ -233,7 +233,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Scalar-valued function expression
|
//! Scalar-valued function expression
|
||||||
using EvalFunc = EvalFuncImpl<Real>;
|
using EvalFunc = EvalFuncScalar<Real>;
|
||||||
//! Vector-valued function expression
|
//! Vector-valued function expression
|
||||||
using VecFuncExpr = EvalMultiFunction<VecFunc,Vec3>;
|
using VecFuncExpr = EvalMultiFunction<VecFunc,Vec3>;
|
||||||
//! Tensor-valued function expression
|
//! Tensor-valued function expression
|
||||||
|
@ -31,7 +31,7 @@ TEST(TestScalarFunc, ParseDerivative)
|
|||||||
ScalarFunc* f1 = utl::parseTimeFunc(func1,"expression");
|
ScalarFunc* f1 = utl::parseTimeFunc(func1,"expression");
|
||||||
ScalarFunc* f2 = utl::parseTimeFunc(func2,"expression");
|
ScalarFunc* f2 = utl::parseTimeFunc(func2,"expression");
|
||||||
|
|
||||||
EvalFuncImpl<autodiff::var> f3(func1,"t");
|
EvalFuncScalar<autodiff::var> f3(func1,"t");
|
||||||
|
|
||||||
ASSERT_TRUE(f1 != nullptr);
|
ASSERT_TRUE(f1 != nullptr);
|
||||||
ASSERT_TRUE(f2 != nullptr);
|
ASSERT_TRUE(f2 != nullptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user