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