Viskores  1.0
MakeThrustIterator.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_cont_cuda_internal_MakeThrustIterator_h
19 #define viskores_cont_cuda_internal_MakeThrustIterator_h
20 
23 
25 
26 namespace viskores
27 {
28 namespace cont
29 {
30 namespace cuda
31 {
32 namespace internal
33 {
34 template <typename PortalType>
35 inline viskores::exec::cuda::internal::IteratorFromArrayPortal<PortalType> IteratorBegin(
36  const PortalType& portal)
37 {
38  viskores::exec::cuda::internal::IteratorFromArrayPortal<PortalType> iterator(portal);
39  return iterator;
40 }
41 
42 template <typename PortalType>
43 inline viskores::exec::cuda::internal::IteratorFromArrayPortal<PortalType> IteratorEnd(
44  const PortalType& portal)
45 {
46  viskores::exec::cuda::internal::IteratorFromArrayPortal<PortalType> iterator(portal);
47  iterator += static_cast<std::ptrdiff_t>(portal.GetNumberOfValues());
48  return iterator;
49 }
50 
51 template <typename T>
52 inline T* IteratorBegin(const viskores::exec::cuda::internal::ArrayPortalFromThrust<T>& portal)
53 {
54  return portal.GetIteratorBegin();
55 }
56 
57 template <typename T>
58 inline T* IteratorEnd(const viskores::exec::cuda::internal::ArrayPortalFromThrust<T>& portal)
59 {
60  return portal.GetIteratorEnd();
61 }
62 
63 template <typename T>
64 inline const T* IteratorBegin(
65  const viskores::exec::cuda::internal::ConstArrayPortalFromThrust<T>& portal)
66 {
67  return portal.GetIteratorBegin();
68 }
69 
70 template <typename T>
71 inline const T* IteratorEnd(
72  const viskores::exec::cuda::internal::ConstArrayPortalFromThrust<T>& portal)
73 {
74  return portal.GetIteratorEnd();
75 }
76 
77 template <typename T>
78 inline T* IteratorBegin(const viskores::internal::ArrayPortalBasicWrite<T>& portal)
79 {
80  return portal.GetIteratorBegin();
81 }
82 
83 template <typename T>
84 inline T* IteratorEnd(const viskores::internal::ArrayPortalBasicWrite<T>& portal)
85 {
86  return portal.GetIteratorEnd();
87 }
88 
89 template <typename T>
90 inline const T* IteratorBegin(const viskores::internal::ArrayPortalBasicRead<T>& portal)
91 {
92  return portal.GetIteratorBegin();
93 }
94 
95 template <typename T>
96 inline const T* IteratorEnd(const viskores::internal::ArrayPortalBasicRead<T>& portal)
97 {
98  return portal.GetIteratorEnd();
99 }
100 }
101 }
102 }
103 
104 } //namespace viskores::cont::cuda::internal
105 
106 #endif
ArrayPortalBasic.h
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
IteratorFromArrayPortal.h
ArrayPortalFromThrust.h