pinocchio  3.7.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
 
Loading...
Searching...
No Matches
static-if.hpp
1//
2// Copyright (c) 2019-2020 INRIA
3//
4
5#ifndef __pinocchio_autodiff_cppad_utils_static_if_hpp__
6#define __pinocchio_autodiff_cppad_utils_static_if_hpp__
7
8#include "pinocchio/utils/static-if.hpp"
9
10namespace pinocchio
11{
12 namespace internal
13 {
14 template<typename Scalar, typename ThenType, typename ElseType>
15 struct if_then_else_impl<CppAD::AD<Scalar>, CppAD::AD<Scalar>, ThenType, ElseType>
16 {
17 typedef typename internal::traits<if_then_else_impl>::ReturnType ReturnType;
18
19 static inline ReturnType run(
20 const ComparisonOperators op,
21 const CppAD::AD<Scalar> & lhs_value,
22 const CppAD::AD<Scalar> & rhs_value,
23 const ThenType & then_value,
24 const ElseType & else_value)
25 {
26 switch (op)
27 {
28 case LT:
29 return ::CppAD::CondExpLt<Scalar>(lhs_value, rhs_value, then_value, else_value);
30 case LE:
31 return ::CppAD::CondExpLe<Scalar>(lhs_value, rhs_value, then_value, else_value);
32 case EQ:
33 return ::CppAD::CondExpEq<Scalar>(lhs_value, rhs_value, then_value, else_value);
34 case GE:
35 return ::CppAD::CondExpGe<Scalar>(lhs_value, rhs_value, then_value, else_value);
36 case GT:
37 return ::CppAD::CondExpGt<Scalar>(lhs_value, rhs_value, then_value, else_value);
38 }
39 }
40 };
41 } // namespace internal
42} // namespace pinocchio
43
44#endif // ifndef __pinocchio_autodiff_cppad_utils_static_if_hpp__
Main pinocchio namespace.
Definition treeview.dox:11