Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_Fad_Ops_Fwd.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Sacado Package
4 //
5 // Copyright 2006 NTESS and the Sacado contributors.
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 //
8 // ***********************************************************************
9 //
10 // The forward-mode AD classes in Sacado are a derivative work of the
11 // expression template classes in the Fad package by Nicolas Di Cesare.
12 // The following banner is included in the original Fad source code:
13 //
14 // ************ DO NOT REMOVE THIS BANNER ****************
15 //
16 // Nicolas Di Cesare <Nicolas.Dicesare@ann.jussieu.fr>
17 // http://www.ann.jussieu.fr/~dicesare
18 //
19 // CEMRACS 98 : C++ courses,
20 // templates : new C++ techniques
21 // for scientific computing
22 //
23 //********************************************************
24 //
25 // A short implementation ( not all operators and
26 // functions are overloaded ) of 1st order Automatic
27 // Differentiation in forward mode (FAD) using
28 // EXPRESSION TEMPLATES.
29 //
30 //********************************************************
31 // @HEADER
32 
33 #ifndef SACADO_FAD_OPS_FWD_HPP
34 #define SACADO_FAD_OPS_FWD_HPP
35 
36 #include <type_traits>
37 
38 namespace Sacado {
39 
40  template <typename T> struct IsSimdType;
41  template <typename T> struct IsFad;
42  template <typename T> struct ValueType;
43 
44  namespace Fad {
45 
46  template <typename ExprT> class UnaryPlusOp;
47  template <typename ExprT> class UnaryMinusOp;
48  template <typename ExprT> class ExpOp;
49  template <typename ExprT> class LogOp;
50  template <typename ExprT> class Log10Op;
51  template <typename ExprT> class SqrtOp;
52  template <typename ExprT> class CosOp;
53  template <typename ExprT> class SinOp;
54  template <typename ExprT> class TanOp;
55  template <typename ExprT> class ACosOp;
56  template <typename ExprT> class ASinOp;
57  template <typename ExprT> class ATanOp;
58  template <typename ExprT> class CoshOp;
59  template <typename ExprT> class SinhOp;
60  template <typename ExprT> class TanhOp;
61  template <typename ExprT> class ACoshOp;
62  template <typename ExprT> class ASinhOp;
63  template <typename ExprT> class ATanhOp;
64  template <typename ExprT> class AbsOp;
65  template <typename ExprT> class FAbsOp;
66  template <typename ExprT> class CbrtOp;
68  class SafeSqrtOp;
69 
70  template <typename ExprT1, typename ExprT2> class AdditionOp;
71  template <typename ExprT1, typename ExprT2> class SubtractionOp;
72  template <typename ExprT1, typename ExprT2> class Multiplicationp;
73  template <typename ExprT1, typename ExprT2> class DivisionOp;
74  template <typename ExprT1, typename ExprT2> class Atan2Op;
75  template <typename ExprT1, typename ExprT2> class MaxOp;
76  template <typename ExprT1, typename ExprT2> class MinOp;
77 
78  namespace PowerImpl {
79  struct Simd {};
80  struct Nested {};
81  struct NestedSimd {};
82  struct Scalar {};
83 
84  template <typename T1, typename T2>
85  struct Selector {
86  static constexpr bool is_simd =
88  static constexpr bool is_fad =
91  typedef typename std::conditional<
92  is_simd && is_fad,
93  NestedSimd,
94  typename std::conditional<
95  is_simd,
96  Simd,
97  typename std::conditional<
98  is_fad,
99  Nested,
100  Scalar>::type
101  >::type
103  };
104  }
105  template <typename ExprT1, typename ExprT2,
106  typename Impl = typename PowerImpl::Selector<ExprT1,ExprT2>::type>
107  class PowerOp;
108 
109  } // namespace Fad
110 
111 } // namespace Sacado
112 
113 #endif // SACADO_FAD_EXPRESSION_HPP
Base template specification for whether a type is a Fad type.
Base template specification for IsSimdType.
int value
std::conditional< is_simd &&is_fad, NestedSimd, typename std::conditional< is_simd, Simd, typename std::conditional< is_fad, Nested, Scalar >::type >::type >::type type