VTK-m  2.2
FetchTagArrayDirectIn.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_exec_arg_FetchTagArrayDirectIn_h
11 #define vtk_m_exec_arg_FetchTagArrayDirectIn_h
12 
14 #include <vtkm/exec/arg/Fetch.h>
15 
16 namespace vtkm
17 {
18 namespace exec
19 {
20 namespace arg
21 {
22 
30 {
31 };
32 
33 
35 template <typename T, typename U>
36 inline VTKM_EXEC T load(const U& u, vtkm::Id v)
37 {
38  return u.Get(v);
39 }
40 
42 template <typename T, typename U>
43 inline VTKM_EXEC T load(const U* u, vtkm::Id v)
44 {
45  return u->Get(v);
46 }
47 
48 template <typename ExecObjectType>
51  ExecObjectType>
52 {
53  //need to remove pointer type from ThreadIdicesType
54  using ET = typename std::remove_const<typename std::remove_pointer<ExecObjectType>::type>::type;
55  using PortalType =
56  typename std::conditional<std::is_pointer<ExecObjectType>::value, const ET*, const ET&>::type;
57 
58  using ValueType = typename ET::ValueType;
59 
61  template <typename ThreadIndicesType>
62  VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, PortalType arrayPortal) const
63  {
64  return load<ValueType>(arrayPortal, indices.GetInputIndex());
65  }
66 
67  template <typename ThreadIndicesType>
68  VTKM_EXEC void Store(const ThreadIndicesType&, PortalType, const ValueType&) const
69  {
70  // Store is a no-op for this fetch.
71  }
72 };
73 }
74 }
75 } // namespace vtkm::exec::arg
76 
77 #endif //vtk_m_exec_arg_FetchTagArrayDirectIn_h
vtkm::exec::arg::load
T load(const U &u, vtkm::Id v)
Definition: FetchTagArrayDirectIn.h:36
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::exec::arg::Fetch
Class for loading and storing values in thread instance.
Definition: Fetch.h:49
vtkm::exec::arg::Fetch< vtkm::exec::arg::FetchTagArrayDirectIn, vtkm::exec::arg::AspectTagDefault, ExecObjectType >::PortalType
typename std::conditional< std::is_pointer< ExecObjectType >::value, const ET *, const ET & >::type PortalType
Definition: FetchTagArrayDirectIn.h:56
vtkm::exec::arg::FetchTagArrayDirectIn
Fetch tag for getting array values with direct indexing.
Definition: FetchTagArrayDirectIn.h:29
Fetch.h
AspectTagDefault.h
vtkm::exec::arg::Fetch< vtkm::exec::arg::FetchTagArrayDirectIn, vtkm::exec::arg::AspectTagDefault, ExecObjectType >::Load
ValueType Load(const ThreadIndicesType &indices, PortalType arrayPortal) const
Definition: FetchTagArrayDirectIn.h:62
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::exec::arg::Fetch< vtkm::exec::arg::FetchTagArrayDirectIn, vtkm::exec::arg::AspectTagDefault, ExecObjectType >::ValueType
typename ET::ValueType ValueType
Definition: FetchTagArrayDirectIn.h:58
vtkm::exec::arg::Fetch< vtkm::exec::arg::FetchTagArrayDirectIn, vtkm::exec::arg::AspectTagDefault, ExecObjectType >::Store
void Store(const ThreadIndicesType &, PortalType, const ValueType &) const
Definition: FetchTagArrayDirectIn.h:68
vtkm::exec::arg::AspectTagDefault
Aspect tag to use for default load/store of data.
Definition: AspectTagDefault.h:22
vtkm::exec::arg::Fetch< vtkm::exec::arg::FetchTagArrayDirectIn, vtkm::exec::arg::AspectTagDefault, ExecObjectType >::ET
typename std::remove_const< typename std::remove_pointer< ExecObjectType >::type >::type ET
Definition: FetchTagArrayDirectIn.h:54
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53