VTK-m  2.0
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  IdComponentPortalType Counts;
39 
41  ReduceByKeyLookupBase(const IdPortalType& sortedValuesMap,
42  const IdPortalType& offsets,
43  const IdComponentPortalType& counts)
44  : SortedValuesMap(sortedValuesMap)
45  , Offsets(offsets)
46  , Counts(counts)
47  {
48  }
49 
52  ReduceByKeyLookupBase() {}
53 };
54 
61 template <typename KeyPortalType, typename IdPortalType, typename IdComponentPortalType>
62 struct ReduceByKeyLookup : ReduceByKeyLookupBase<IdPortalType, IdComponentPortalType>
63 {
64  using KeyType = typename KeyPortalType::ValueType;
65 
66  KeyPortalType UniqueKeys;
67 
69  ReduceByKeyLookup(const KeyPortalType& uniqueKeys,
70  const IdPortalType& sortedValuesMap,
71  const IdPortalType& offsets,
72  const IdComponentPortalType& counts)
73  : ReduceByKeyLookupBase<IdPortalType, IdComponentPortalType>(sortedValuesMap, offsets, counts)
74  , UniqueKeys(uniqueKeys)
75  {
76  }
77 
80  ReduceByKeyLookup() {}
81 };
82 }
83 }
84 } // namespace vtkm::exec::internal
85 
86 #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