Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Kokkos_View_UQ_PCE_Utils.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef KOKKOS_VIEW_UQ_PCE_UTILS_HPP
11 #define KOKKOS_VIEW_UQ_PCE_UTILS_HPP
12 
13 #include "Kokkos_View_Utils.hpp"
14 
15 namespace Sacado {
16  namespace UQ {
17  template <typename Storage >
18  class PCE;
19  }
20 }
21 
22 namespace Kokkos {
23 
24 // Type name for a local, unmanaged view with possibly a different static size
25 template <typename ViewType,
26  unsigned LocalSize,
27  unsigned Rank = ViewType::rank,
28  bool isStatic = ViewType::is_static>
29 struct LocalUQPCEView {};
30 
31 template <typename ViewType,
32  unsigned LocalSize>
33 struct LocalUQPCEView< ViewType, LocalSize, 1, true > {
35  typedef typename ViewType::array_layout array_layout;
37  typedef typename ViewType::device_type device_type;
39  typedef typename storage_type::template apply_N<LocalSize> StorageApply;
40  typedef typename StorageApply::type local_storage_type;
42 
43  typedef Kokkos::View< local_value_type*,
46  Kokkos::MemoryUnmanaged > type;
47 };
48 
49 template <typename ViewType,
50  unsigned LocalSize>
51 struct LocalUQPCEView<ViewType, LocalSize, 1, false> {
53  typedef typename ViewType::array_layout array_layout;
55  typedef typename ViewType::device_type device_type;
56 
57  typedef Kokkos::View< vector_type*,
60  Kokkos::MemoryUnmanaged > type;
61 };
62 
63 namespace Impl {
64 
65 template< class OldStorageType , class Device >
66 struct RebindStokhosStorageDevice< Sacado::UQ::PCE< OldStorageType > , Device >
67 {
68  typedef typename
69  OldStorageType::template apply<
72  Device >
74 
75  typedef typename NewStorageApply::type NewStorageType ;
76  typedef typename Sacado::UQ::PCE< OldStorageType >::template apply< NewStorageType > NewVectorApply ;
77 
78  typedef typename NewVectorApply::type type ;
79 };
80 
81 template< class OldStorageType , class Device >
82 struct RebindStokhosStorageDevice< const Sacado::UQ::PCE< OldStorageType > , Device >
83 {
84  typedef typename
85  OldStorageType::template apply<
88  Device >
90 
91  typedef typename NewStorageApply::type NewStorageType ;
92  typedef typename Sacado::UQ::PCE< OldStorageType >::template apply< NewStorageType > NewVectorApply ;
93 
94  typedef const typename NewVectorApply::type type ;
95 };
96 
97 } // namespace Impl
98 
99 // Whether a given type is a view with scalar type Sacado::UQ::PCE
100 template <typename view_type>
101 struct is_view_uq_pce { static const bool value = false; };
102 
103 // Typename of the Cijk tensor in a view
104 template <typename view_type, typename Enabled = void>
105 struct CijkType {};
106 
107 } // namespace Kokkos
108 
109 #endif // KOKKOS_UQ_PCE_UTILS_HPP
Stokhos::StandardStorage< int, double > storage_type
Kokkos::DefaultExecutionSpace execution_space
Sacado::UQ::PCE< OldStorageType >::template apply< NewStorageType > NewVectorApply
Kokkos::View< vector_type *, array_layout, device_type, Kokkos::MemoryUnmanaged > type
storage_type::template apply_N< LocalSize > StorageApply
Kokkos::View< local_value_type *, array_layout, device_type, Kokkos::MemoryUnmanaged > type
OldStorageType::template apply< typename OldStorageType::ordinal_type, typename OldStorageType::value_type, Device > NewStorageApply
OldStorageType::template apply< typename OldStorageType::ordinal_type, typename OldStorageType::value_type, Device > NewStorageApply
Sacado::UQ::PCE< OldStorageType >::template apply< NewStorageType > NewVectorApply