Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_Fad_Expr_MP_Vector.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 // The forward-mode AD classes in Sacado are a derivative work of the
10 // expression template classes in the Fad package by Nicolas Di Cesare.
11 // The following banner is included in the original Fad source code:
12 //
13 // ************ DO NOT REMOVE THIS BANNER ****************
14 //
15 // Nicolas Di Cesare <Nicolas.Dicesare@ann.jussieu.fr>
16 // http://www.ann.jussieu.fr/~dicesare
17 //
18 // CEMRACS 98 : C++ courses,
19 // templates : new C++ techniques
20 // for scientific computing
21 //
22 //********************************************************
23 //
24 // A short implementation ( not all operators and
25 // functions are overloaded ) of 1st order Automatic
26 // Differentiation in forward mode (FAD) using
27 // EXPRESSION TEMPLATES.
28 //
29 //********************************************************
30 // @HEADER
31 
32 #ifndef SACADO_FAD_EXPR_MP_VECTOR_HPP
33 #define SACADO_FAD_EXPR_MP_VECTOR_HPP
34 
35 #include "Sacado_Fad_Expression.hpp"
36 
37 namespace Stokhos {
38  template <typename Ord, typename Val, int Num, typename Dev>
39  class StaticFixedStorage;
40 }
41 
42 namespace Sacado {
43 
44  namespace MP {
45  template <typename S> class Vector;
46  }
47 
48  namespace Fad {
49 
51 
54  template <typename Ord, typename Val, int VecNum, typename Dev>
55  class ConstExpr< Sacado::MP::Vector< Stokhos::StaticFixedStorage<Ord,Val,VecNum,Dev> > > {
56 
57  public:
58 
60  typedef typename ConstT::value_type val_type;
61 
63  typedef ConstT value_type;
64 
66  typedef typename ScalarType<value_type>::type scalar_type;
67 
70 
72  KOKKOS_INLINE_FUNCTION
73  ConstExpr(const ConstT& constant) : constant_(constant) {}
74 
76  KOKKOS_INLINE_FUNCTION
77  const ConstT& val() const { return constant_; }
78 
80  KOKKOS_INLINE_FUNCTION
81  const val_type& val(int j) const { return constant_.fastAccessCoeff(j); }
82 
83  protected:
84 
86  const ConstT& constant_;
87 
88  }; // class ConstExpr
89 
90  } // namespace Fad
91 
92 } // namespace Sacado
93 
94 #endif // SACADO_FAD_EXPR_MP_VECTOR_HPP
KOKKOS_INLINE_FUNCTION const val_type & val(int j) const
Return value of operation.
ScalarType< value_type >::type scalar_type
Typename of scalar&#39;s (which may be different from ConstT)