VTK-m  2.2
ReduceByKeyLookup.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_internal_ReduceByKeyLookup_h
11 #define vtk_m_exec_internal_ReduceByKeyLookup_h
12 
14 
15 #include <vtkm/StaticAssert.h>
16 #include <vtkm/Types.h>
17 
18 #include <type_traits>
19 
20 namespace vtkm
21 {
22 namespace exec
23 {
24 namespace internal
25 {
26 
29 template <typename IdPortalType, typename IdComponentPortalType>
30 struct ReduceByKeyLookupBase
31 {
32  VTKM_STATIC_ASSERT((std::is_same<typename IdPortalType::ValueType, vtkm::Id>::value));
34  (std::is_same<typename IdComponentPortalType::ValueType, vtkm::IdComponent>::value));
35 
36  IdPortalType SortedValuesMap;
37  IdPortalType Offsets;
38 
40  ReduceByKeyLookupBase(const IdPortalType& sortedValuesMap, const IdPortalType& offsets)
41  : SortedValuesMap(sortedValuesMap)
42  , Offsets(offsets)
43  {
44  }
45 
48  ReduceByKeyLookupBase() {}
49 };
50 
57 template <typename KeyPortalType, typename IdPortalType, typename IdComponentPortalType>
58 struct ReduceByKeyLookup : ReduceByKeyLookupBase<IdPortalType, IdComponentPortalType>
59 {
60  using KeyType = typename KeyPortalType::ValueType;
61 
62  KeyPortalType UniqueKeys;
63 
65  ReduceByKeyLookup(const KeyPortalType& uniqueKeys,
66  const IdPortalType& sortedValuesMap,
67  const IdPortalType& offsets)
68  : ReduceByKeyLookupBase<IdPortalType, IdComponentPortalType>(sortedValuesMap, offsets)
69  , UniqueKeys(uniqueKeys)
70  {
71  }
72 
75  ReduceByKeyLookup() {}
76 };
77 }
78 }
79 } // namespace vtkm::exec::internal
80 
81 #endif //vtk_m_exec_internal_ReduceByKeyLookup_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
Types.h
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
VTKM_STATIC_ASSERT
#define VTKM_STATIC_ASSERT(condition)
Definition: StaticAssert.h:16
StaticAssert.h
ExecutionObjectBase.h
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53