40#include "../expressions/logic/compileTimeTraversalLogic.hpp"
42#include "misc/enableIfHelpers.hpp"
47 template<
typename T_Real,
typename T_Impl>
48 struct ExpressionInterface;
50 template<
typename T_Real,
typename T_Gradient,
typename T_Tape,
typename T_Impl>
51 struct LhsExpressionInterface;
53 template<
typename T_Real,
template<
typename>
class T_ConversionOperator>
54 struct ConstantExpression;
56 template<
typename T_Tape>
57 struct StaticContextActiveType;
60 namespace ExpressionTraits {
68 template<
typename ResultA,
typename ResultB,
typename =
void>
71 static bool constexpr isAVoid = std::is_same<void, ResultA>::value;
72 static bool constexpr isBVoid = std::is_same<void, ResultB>::value;
73 static bool constexpr isBothVoid = isAVoid & isBVoid;
74 static bool constexpr isBothSame = std::is_same<ResultA, ResultB>::value;
77 CODI_STATIC_ASSERT((!isBothVoid) & (!isAVoid | !isBVoid | isBothSame),
"Result types need to be the same.");
82 using ActiveResult =
typename std::conditional<isBVoid, ResultA, ResultB>::type;
86 template<
typename ResultA,
typename ResultB>
95 template<
typename Expr,
typename =
void>
98#ifndef DOXYGEN_DISABLE
99 template<
typename Expr>
106 template<
typename Expr>
107 bool constexpr isExpression = IsExpression<Expr>::value;
111 template<
typename Expr,
typename T =
void>
115 template<
typename Expr,
typename =
void>
118#ifndef DOXYGEN_DISABLE
119 template<
typename Expr>
123 Expr>::type> : std::true_type {};
125 template<
typename Tape>
131 template<
typename Expr>
132 bool constexpr isLhsExpression = IsLhsExpression<Expr>::value;
136 template<
typename Expr,
typename T =
void>
140 template<
typename Expr>
143#ifndef DOXYGEN_DISABLE
144 template<
typename Real,
template<
typename>
class ConversionOperator>
149 template<
typename Expr>
151 bool constexpr isConstantExpression = IsConstantExpression<Expr>::value;
155 template<
typename Expr,
typename T =
void>
159 template<
typename Expr>
162#ifndef DOXYGEN_DISABLE
163 template<
typename Tape>
169 template<
typename Expr>
170 bool constexpr isStaticContextActiveType = IsStaticContextActiveType<Expr>::value;
174 template<
typename Expr,
typename T =
void>
183 template<
typename Expr>
191 template<
typename Node,
typename = ExpressionTraits::EnableIfLhsExpression<Node>>
203 template<
typename Expr>
208 template<
typename Expr>
217 template<
typename Node,
typename = EnableIfConstantExpression<Node>>
229 template<
typename Expr>
234 template<
typename Expr>
239 template<
typename Node>
250 template<
typename Expr>
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:457
#define CODI_STATIC_ASSERT(cond, message)
Static assert in CoDiPack.
Definition macros.hpp:123
typename std::enable_if< IsStaticContextActiveType< Expr >::value, T >::type EnableIfStaticContextActiveType
Enable if wrapper for IsStaticContextActiveType.
Definition expressionTraits.hpp:175
typename std::enable_if< IsExpression< Expr >::value, T >::type EnableIfExpression
Enable if wrapper for IsExpression.
Definition expressionTraits.hpp:112
typename std::enable_if< IsLhsExpression< Expr >::value, T >::type EnableIfLhsExpression
Enable if wrapper for IsLhsExpression.
Definition expressionTraits.hpp:137
typename std::enable_if< IsConstantExpression< Expr >::value, T >::type EnableIfConstantExpression
Enable if wrapper for IsConstantExpression.
Definition expressionTraits.hpp:156
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
std::enable_if< std::is_base_of< Base, Impl >::value, R > enable_if_base_of
Enable if abbreviation for std::is_base_of.
Definition enableIfHelpers.hpp:47
Represents a concrete lvalue in the CoDiPack expression tree.
Definition activeType.hpp:52
Traversal of CoDiPack expressions during compile time.
Definition compileTimeTraversalLogic.hpp:57
static ResultType constexpr link(Args &&... args)
Called for all links in the expression.
Definition compileTimeTraversalLogic.hpp:126
Represents constant values in the expression tree.
Definition constantExpression.hpp:78
Base class for all CoDiPack expressions.
Definition expressionInterface.hpp:59
If the expression inherits from ConstantExpression. Is either std::false_type or std::true_type.
Definition expressionTraits.hpp:141
If the expression inherits from ExpressionInterface. Is either std::false_type or std::true_type.
Definition expressionTraits.hpp:96
If the expression inherits from LhsExpressionInterface. Is either std::false_type or std::true_type.
Definition expressionTraits.hpp:116
If the expression inherits from StaticContextActiveType. Is either std::false_type or std::true_type.
Definition expressionTraits.hpp:160
Counts the number of nodes that inherit from LhsExpressionInterface in the expression.
Definition expressionTraits.hpp:184
static size_t constexpr value
See NumberOfActiveTypeArguments.
Definition expressionTraits.hpp:198
static size_t constexpr leaf()
Called for all leaf nodes in the expression.
Definition expressionTraits.hpp:192
Counts the number of types that inherit from ConstantExpression in the expression.
Definition expressionTraits.hpp:210
static size_t constexpr leaf()
Called for all leaf nodes in the expression.
Definition expressionTraits.hpp:218
static size_t constexpr value
See NumberOfConstantTypeArguments.
Definition expressionTraits.hpp:224
Counts the number of nodes in the expression.
Definition expressionTraits.hpp:235
static size_t constexpr node()
Called for each node in the expression.
Definition expressionTraits.hpp:240
static size_t constexpr value
See NumberOfOperations.
Definition expressionTraits.hpp:245
Definition expressionTraits.hpp:69
typename std::conditional< isBVoid, ResultA, ResultB >::type ActiveResult
The resulting active type of an expression.
Definition expressionTraits.hpp:82
Base class for all CoDiPack lvalue expression.
Definition lhsExpressionInterface.hpp:63
Replacement type of LhsExpressionInterface types in ConstructStaticContext.
Definition staticContextActiveType.hpp:56