Go to the documentation of this file.
10 #ifndef vtk_m_worklet_Keys_h
11 #define vtk_m_worklet_Keys_h
51 KeysBase(
const KeysBase&) =
default;
52 KeysBase& operator=(
const KeysBase&) =
default;
53 ~KeysBase() =
default;
56 vtkm::Id GetInputRange()
const {
return this->Offsets.GetNumberOfValues() - 1; }
64 VTKM_DEPRECATED(2.2,
"Use the `GetOffsets()` array in an `ArrayHandleOffsetsToNumComponents`.")
69 vtkm::
Id GetNumberOfValues()
const {
return this->SortedValuesMap.GetNumberOfValues(); }
71 using ExecLookup = vtkm::exec::internal::ReduceByKeyLookupBase<
78 return ExecLookup(this->SortedValuesMap.PrepareForInput(device, token),
79 this->Offsets.PrepareForInput(device, token));
83 bool operator==(
const vtkm::worklet::internal::KeysBase& other)
const
85 return ((this->SortedValuesMap == other.SortedValuesMap) && (this->Offsets == other.Offsets) &&
86 (this->Offsets == other.Offsets));
90 bool operator!=(
const vtkm::worklet::internal::KeysBase& other)
const
92 return !(*
this == other);
129 template <
typename T>
148 template <
typename KeyStorage>
158 template <
typename KeyArrayType>
160 const KeyArrayType& keys,
167 template <
typename KeyArrayType>
178 #ifdef VTKM_DOXYGEN_ONLY
208 using ExecLookup = vtkm::exec::internal::ReduceByKeyLookup<
209 typename KeyArrayHandleType::ReadPortalType,
216 return ExecLookup(this->UniqueKeys.PrepareForInput(device, token),
217 this->SortedValuesMap.PrepareForInput(device, token),
218 this->Offsets.PrepareForInput(device, token));
224 return ((this->UniqueKeys == other.UniqueKeys) &&
225 (this->SortedValuesMap == other.SortedValuesMap) && (this->Offsets == other.Offsets));
233 KeyArrayHandleType UniqueKeys;
235 template <
typename KeyArrayType>
238 template <
typename KeyArrayType>
239 VTKM_CONT void BuildArraysInternalStable(
const KeyArrayType& keys,
244 template <
typename T>
250 template <
typename KeyType>
252 -> decltype(inputDomain.GetInputRange())
254 return inputDomain.GetInputRange();
257 template <
typename KeyType>
259 -> decltype(inputDomain->GetInputRange())
261 return inputDomain->GetInputRange();
264 inline auto SchedulingRange(
const vtkm::worklet::internal::KeysBase& inputDomain)
265 -> decltype(inputDomain.GetInputRange())
267 return inputDomain.GetInputRange();
270 inline auto SchedulingRange(
const vtkm::worklet::internal::KeysBase*
const inputDomain)
271 -> decltype(inputDomain->GetInputRange())
273 return inputDomain->GetInputRange();
291 template <
typename KeyType>
295 std::is_base_of<vtkm::worklet::internal::KeysBase, typename std::decay<KeyType>::type>
::value;
298 template <
typename KeyType,
typename Device>
311 if (
object != inputDomain)
316 return object.PrepareForInput(Device(), token);
321 template <
typename InputDomainType>
326 template <
typename ArrayHandleType,
typename Device>
340 const vtkm::worklet::internal::KeysBase& keys,
345 if (
object.GetNumberOfValues() != keys.GetNumberOfValues())
361 template <
typename ArrayHandleType,
typename Device>
375 const vtkm::worklet::internal::KeysBase& keys,
380 if (
object.GetNumberOfValues() != keys.GetNumberOfValues())
396 template <
typename ArrayHandleType,
typename Device>
410 const vtkm::worklet::internal::KeysBase& keys,
418 object.PrepareForOutput(keys.GetNumberOfValues(), Device(), token);
427 return groupedArray.
PrepareForOutput(keys.GetInputRange(), Device(), token);
434 #ifndef vtk_m_worklet_Keys_cxx
436 #define VTK_M_KEYS_EXPORT(T) \
437 extern template class VTKM_WORKLET_TEMPLATE_EXPORT vtkm::worklet::Keys<T>; \
438 extern template VTKM_WORKLET_TEMPLATE_EXPORT VTKM_CONT void vtkm::worklet::Keys<T>::BuildArrays( \
439 const vtkm::cont::ArrayHandle<T>& keys, \
440 vtkm::worklet::KeysSortType sort, \
441 vtkm::cont::DeviceAdapterId device)
450 #ifdef VTKM_USE_64BIT_IDS
454 #undef VTK_M_KEYS_EXPORT
456 #endif // !vtk_m_worklet_Keys_cxx
458 #endif //vtk_m_worklet_Keys_h
typename ContObjectType::ReadPortalType ExecObjectType
The type used in the execution environment.
Definition: Transport.h:48
bool operator!=(const vtkm::Matrix< T, NumRow, NumCol > &a, const vtkm::Matrix< T, NumRow, NumCol > &b)
Definition: Matrix.h:631
#define VTKM_WORKLET_EXPORT
Definition: vtkm_worklet_export.h:44
ArrayHandleType ContObjectType
Definition: Keys.h:366
typename Superclass::ReadPortalType ReadPortalType
Definition: ArrayHandleGroupVecVariable.h:291
ArrayHandleType ContObjectType
Definition: Keys.h:401
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
Fancy array handle that groups values into vectors of different sizes.
Definition: ArrayHandleGroupVecVariable.h:271
typename GroupedArrayType::WritePortalType ExecObjectType
Definition: Keys.h:372
KeyType ContObjectType
Definition: Keys.h:301
ExecObjectType operator()(const ContObjectType &object, const ContObjectType &inputDomain, vtkm::Id, vtkm::Id, vtkm::cont::Token &token) const
Definition: Keys.h:305
typename StorageType::ReadPortalType ReadPortalType
The type of portal used when accessing data in a read-only mode.
Definition: ArrayHandle.h:312
vtkm::UInt32 HashType
Definition: Hash.h:20
typename ContObjectType::ExecLookup ExecObjectType
Definition: Keys.h:302
bool operator==(const vtkm::Matrix< T, NumRow, NumCol > &a, const vtkm::Matrix< T, NumRow, NumCol > &b)
Definition: Matrix.h:617
ExecObjectType operator()(const ContObjectType &object, const vtkm::worklet::internal::KeysBase &keys, vtkm::Id, vtkm::Id, vtkm::cont::Token &token) const
Definition: Keys.h:339
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
Transport tag for input values in a reduce by key.
Definition: TransportTagKeyedValuesIn.h:28
bool operator==(const vtkm::worklet::Keys< KeyType > &other) const
Definition: Keys.h:222
WritePortalType PrepareForInPlace(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
Prepares this array to be used in an in-place operation (both as input and output) in the execution e...
Definition: ArrayHandle.h:618
#define VTKM_IS_ARRAY_HANDLE(T)
Checks that the given type is a vtkm::cont::ArrayHandle.
Definition: ArrayHandle.h:137
Transport tag for keys in a reduce by key.
Definition: TransportTagKeysIn.h:28
Implicitly permutes the values in an array.
Definition: ArrayHandlePermutation.h:233
Class for checking that a type matches the semantics for an argument.
Definition: TypeCheck.h:34
ArrayHandleType ContObjectType
Definition: Keys.h:331
WritePortalType PrepareForOutput(vtkm::Id numberOfValues, vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
Prepares (allocates) this array to be used as an output from an operation in the execution environmen...
Definition: ArrayHandle.h:638
#define VTKM_CONT
Definition: ExportMacros.h:57
KeysSortType
Select the type of sort for BuildArrays calls.
Definition: Keys.h:107
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
Tag for a device adapter used to specify that any device may be used for an operation.
Definition: DeviceAdapterTag.h:180
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:169
typename Superclass::WritePortalType WritePortalType
Definition: ArrayHandleGroupVecVariable.h:291
ExecObjectType operator()(ContObjectType object, const vtkm::worklet::internal::KeysBase &keys, vtkm::Id, vtkm::Id, vtkm::cont::Token &token) const
Definition: Keys.h:409
Transport tag for input values in a reduce by key.
Definition: TransportTagKeyedValuesOut.h:28
typename GroupedArrayType::ReadPortalType ExecObjectType
Definition: Keys.h:337
An object used to specify a device.
Definition: DeviceAdapterTag.h:58
ExecLookup PrepareForInput(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
Definition: Keys.h:213
This class is thrown when a VTKm function or method encounters an invalid value that inhibits progres...
Definition: ErrorBadValue.h:25
static constexpr bool value
The static constant boolean value is set to true if the type is valid for the given check tag and fal...
Definition: TypeCheck.h:39
typename GroupedArrayType::WritePortalType ExecObjectType
Definition: Keys.h:407
KeyArrayHandleType GetUniqueKeys() const
Returns an array of unique keys.
Definition: Keys.h:176
bool operator!=(const vtkm::worklet::Keys< KeyType > &other) const
Definition: Keys.h:229
Manage keys for a vtkm::worklet::WorkletReduceByKey.
Definition: Keys.h:130
T KeyType
Definition: Keys.h:133
Class for transporting from the control to the execution environment.
Definition: Transport.h:38
ReadPortalType PrepareForInput(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
Prepares this array to be used as an input to an operation in the execution environment.
Definition: ArrayHandle.h:599
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:89
Check for a Keys object.
Definition: TypeCheckTagKeys.h:24
A vtkm::Pair is essentially the same as an STL pair object except that the methods (constructors and ...
Definition: Pair.h:29
#define VTKM_DEPRECATED(...)
Definition: Deprecated.h:145
VTKM_CONT ExecObjectType operator()(const ContObjectType contData, const InputDomainType &inputDomain vtkm::Id outputSize) const
Send data to the execution environment.
Transport tag for input values in a reduce by key.
Definition: TransportTagKeyedValuesInOut.h:28
ExecObjectType operator()(ContObjectType object, const vtkm::worklet::internal::KeysBase &keys, vtkm::Id, vtkm::Id, vtkm::cont::Token &token) const
Definition: Keys.h:374
Keys(const vtkm::cont::ArrayHandle< KeyType, KeyStorage > &keys, vtkm::cont::DeviceAdapterId device=vtkm::cont::DeviceAdapterTagAny())
Construct a Keys class from an array of keys.
Definition: Keys.h:149