Viskores  1.0
FetchTagArrayDirectIn.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_exec_arg_FetchTagArrayDirectIn_h
19 #define viskores_exec_arg_FetchTagArrayDirectIn_h
20 
23 
24 namespace viskores
25 {
26 namespace exec
27 {
28 namespace arg
29 {
30 
38 {
39 };
40 
41 
43 template <typename T, typename U>
44 inline VISKORES_EXEC T load(const U& u, viskores::Id v)
45 {
46  return u.Get(v);
47 }
48 
50 template <typename T, typename U>
51 inline VISKORES_EXEC T load(const U* u, viskores::Id v)
52 {
53  return u->Get(v);
54 }
55 
56 template <typename ExecObjectType>
59  ExecObjectType>
60 {
61  //need to remove pointer type from ThreadIdicesType
62  using ET = typename std::remove_const<typename std::remove_pointer<ExecObjectType>::type>::type;
63  using PortalType =
64  typename std::conditional<std::is_pointer<ExecObjectType>::value, const ET*, const ET&>::type;
65 
66  using ValueType = typename ET::ValueType;
67 
69  template <typename ThreadIndicesType>
70  VISKORES_EXEC ValueType Load(const ThreadIndicesType& indices, PortalType arrayPortal) const
71  {
72  return load<ValueType>(arrayPortal, indices.GetInputIndex());
73  }
74 
75  template <typename ThreadIndicesType>
76  VISKORES_EXEC void Store(const ThreadIndicesType&, PortalType, const ValueType&) const
77  {
78  // Store is a no-op for this fetch.
79  }
80 };
81 }
82 }
83 } // namespace viskores::exec::arg
84 
85 #endif //viskores_exec_arg_FetchTagArrayDirectIn_h
viskores::exec::arg::load
T load(const U &u, viskores::Id v)
Definition: FetchTagArrayDirectIn.h:44
VISKORES_SUPPRESS_EXEC_WARNINGS
#define VISKORES_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:61
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::exec::arg::Fetch< viskores::exec::arg::FetchTagArrayDirectIn, viskores::exec::arg::AspectTagDefault, ExecObjectType >::Load
ValueType Load(const ThreadIndicesType &indices, PortalType arrayPortal) const
Definition: FetchTagArrayDirectIn.h:70
viskores::exec::arg::Fetch
Class for loading and storing values in thread instance.
Definition: Fetch.h:57
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
Fetch.h
AspectTagDefault.h
viskores::exec::arg::Fetch< viskores::exec::arg::FetchTagArrayDirectIn, viskores::exec::arg::AspectTagDefault, ExecObjectType >::ValueType
typename ET::ValueType ValueType
Definition: FetchTagArrayDirectIn.h:66
viskores::exec::arg::AspectTagDefault
Aspect tag to use for default load/store of data.
Definition: AspectTagDefault.h:30
viskores::exec::arg::FetchTagArrayDirectIn
Fetch tag for getting array values with direct indexing.
Definition: FetchTagArrayDirectIn.h:37
viskores::exec::arg::Fetch< viskores::exec::arg::FetchTagArrayDirectIn, viskores::exec::arg::AspectTagDefault, ExecObjectType >::ET
typename std::remove_const< typename std::remove_pointer< ExecObjectType >::type >::type ET
Definition: FetchTagArrayDirectIn.h:62
viskores::exec::arg::Fetch< viskores::exec::arg::FetchTagArrayDirectIn, viskores::exec::arg::AspectTagDefault, ExecObjectType >::PortalType
typename std::conditional< std::is_pointer< ExecObjectType >::value, const ET *, const ET & >::type PortalType
Definition: FetchTagArrayDirectIn.h:64
viskores::exec::arg::Fetch< viskores::exec::arg::FetchTagArrayDirectIn, viskores::exec::arg::AspectTagDefault, ExecObjectType >::Store
void Store(const ThreadIndicesType &, PortalType, const ValueType &) const
Definition: FetchTagArrayDirectIn.h:76
VISKORES_EXEC
#define VISKORES_EXEC
Definition: ExportMacros.h:59