Viskores  1.0
ReduceByKeyLookup.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_exec_internal_ReduceByKeyLookup_h
19 #define viskores_exec_internal_ReduceByKeyLookup_h
20 
22 
23 #include <viskores/StaticAssert.h>
24 #include <viskores/Types.h>
25 
26 #include <type_traits>
27 
28 namespace viskores
29 {
30 namespace exec
31 {
32 namespace internal
33 {
34 
37 template <typename IdPortalType, typename IdComponentPortalType>
38 struct ReduceByKeyLookupBase
39 {
40  VISKORES_STATIC_ASSERT((std::is_same<typename IdPortalType::ValueType, viskores::Id>::value));
42  (std::is_same<typename IdComponentPortalType::ValueType, viskores::IdComponent>::value));
43 
44  IdPortalType SortedValuesMap;
45  IdPortalType Offsets;
46 
48  ReduceByKeyLookupBase(const IdPortalType& sortedValuesMap, const IdPortalType& offsets)
49  : SortedValuesMap(sortedValuesMap)
50  , Offsets(offsets)
51  {
52  }
53 
56  ReduceByKeyLookupBase() {}
57 };
58 
65 template <typename KeyPortalType, typename IdPortalType, typename IdComponentPortalType>
66 struct ReduceByKeyLookup : ReduceByKeyLookupBase<IdPortalType, IdComponentPortalType>
67 {
68  using KeyType = typename KeyPortalType::ValueType;
69 
70  KeyPortalType UniqueKeys;
71 
73  ReduceByKeyLookup(const KeyPortalType& uniqueKeys,
74  const IdPortalType& sortedValuesMap,
75  const IdPortalType& offsets)
76  : ReduceByKeyLookupBase<IdPortalType, IdComponentPortalType>(sortedValuesMap, offsets)
77  , UniqueKeys(uniqueKeys)
78  {
79  }
80 
83  ReduceByKeyLookup() {}
84 };
85 }
86 }
87 } // namespace viskores::exec::internal
88 
89 #endif //viskores_exec_internal_ReduceByKeyLookup_h
Types.h
VISKORES_SUPPRESS_EXEC_WARNINGS
#define VISKORES_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:61
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
StaticAssert.h
ExecutionObjectBase.h
VISKORES_STATIC_ASSERT
#define VISKORES_STATIC_ASSERT(condition)
Definition: StaticAssert.h:24