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_Exp_ViewFad.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 // @HEADER
9 
10 #ifndef SACADO_FAD_EXP_VIEWFAD_HPP
11 #define SACADO_FAD_EXP_VIEWFAD_HPP
12 
15 
16 #if defined(HAVE_SACADO_KOKKOS)
17 #include "Kokkos_Atomic.hpp"
18 #include "impl/Kokkos_Error.hpp"
19 #endif
20 
21 namespace Sacado {
22 
23  namespace Fad {
24  namespace Exp {
25 
26  template <typename T, unsigned static_length, unsigned static_stride, typename U>
28 
29  // Class representing a pointer to ViewFad so that &ViewFad is supported
30  template <typename T, unsigned sl, unsigned ss, typename U>
31  class ViewFadPtr : public ViewFad<T,sl,ss,U> {
32  public:
33 
34  // Storage type base class
36 
37  // Bring in constructors
38  using view_fad_type::view_fad_type;
39 
40  // Add overload of dereference operator
42  view_fad_type* operator->() { return this; }
43 
44  // Add overload of dereference operator
46  view_fad_type& operator*() { return *this; }
47  };
48 
49  } // namespace Exp
50  } // namespace Fad
51 
52  template <typename,unsigned,unsigned> struct ViewFadType;
53 
55  template< class S, unsigned length, unsigned stride >
56  struct ViewFadType< Fad::Exp::GeneralFad<S>, length, stride > {
58  };
59 
61 
64  template< class S, unsigned length, unsigned stride >
65  struct ViewFadType< const Fad::Exp::GeneralFad<S>, length, stride > {
67  };
68 
69  // Specialization of BaseExprType for ViewFad, to use the base fad type
70  template <typename T, unsigned static_length, unsigned static_stride, typename U>
71  struct BaseExprType< Fad::Exp::GeneralFad< Fad::Exp::ViewStorage<T,static_length,static_stride,U> > > {
72  typedef U type;
73  };
74 
76 
80  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
81  struct ScalarType< Fad::Exp::ViewFad<ValueT,Size,Stride,Base> > {
82  typedef typename ScalarType<ValueT>::type type;
83  };
84 
89  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
90  struct ValueType< Fad::Exp::ViewFad<ValueT,Size,Stride,Base> > {
91  typedef ValueT type;
92  };
93 
94 } // namespace Sacado
95 
96 #endif // SACADO_FAD_EXP_VIEWFAD_HPP
SACADO_INLINE_FUNCTION view_fad_type & operator*()
Base template specification for ScalarType.
Forward-mode AD class templated on the storage for the derivative array.
Get the base Fad type from a view/expression.
SACADO_INLINE_FUNCTION view_fad_type * operator->()
ViewFad< T, sl, ss, U > view_fad_type
Fad::Exp::ViewFad< const typename S::value_type, length, stride, Fad::Exp::GeneralFad< S > > type
Fad::Exp::ViewFad< typename S::value_type, length, stride, Fad::Exp::GeneralFad< S > > type
GeneralFad< ViewStorage< T, static_length, static_stride, U > > ViewFad
#define SACADO_INLINE_FUNCTION
Base template specification for ValueType.
Get view type for any Fad type.