Go to the documentation of this file.
18 #ifndef viskores_worklet_AverageByKey_h
19 #define viskores_worklet_AverageByKey_h
41 template <
typename ValuesVecType,
typename OutType>
47 sum += valuesIn[index];
56 using ComponentType =
typename VTraits::ComponentType;
57 ComponentType divisor =
static_cast<ComponentType
>(valuesIn.GetNumberOfComponents());
60 VTraits::SetComponent(sum, cIndex, VTraits::GetComponent(sum, cIndex) / divisor);
70 template <
typename InArrayType,
typename OutArrayType>
72 const InArrayType& inValues,
73 const OutArrayType& outAverages)
78 dispatcher.Invoke(keys, inValues, outAverages);
86 template <
typename ValueType,
typename InValuesStorage>
88 const viskores::worklet::internal::KeysBase& keys,
93 Run(keys, inValues, outAverages);
99 template <
typename ValueType>
118 template <
class KeyType,
122 class ValueInStorage,
123 class ValueOutStorage>
134 outputKeyArray = results.GetFirstArray();
147 #endif //viskores_worklet_AverageByKey_h
static void Run(const viskores::cont::ArrayHandle< KeyType, KeyInStorage > &keyArray, const viskores::cont::ArrayHandle< ValueType, ValueInStorage > &valueArray, viskores::cont::ArrayHandle< KeyType, KeyOutStorage > &outputKeyArray, viskores::cont::ArrayHandle< ValueType, ValueOutStorage > &outputValueArray)
Compute average values based on an array of keys.
Definition: AverageByKey.h:124
#define VISKORES_LOG_SCOPE(level,...)
Definition: Logging.h:219
_1 InputDomain
Definition: AverageByKey.h:39
void operator()(const ValuesVecType &valuesIn, OutType &sum) const
Definition: AverageByKey.h:42
static void Run(const viskores::worklet::internal::KeysBase &keys, const InArrayType &inValues, const OutArrayType &outAverages)
Compute average values based on a set of Keys.
Definition: AverageByKey.h:71
Definition: DescriptiveStatistics.h:34
Definition: AverageByKey.h:35
A control signature tag for input keys.
Definition: WorkletReduceByKey.h:81
T Mean() const
Definition: DescriptiveStatistics.h:141
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
A control signature tag for reduced output values.
Definition: WorkletReduceByKey.h:147
A control signature tag for input values associated with the keys.
Definition: WorkletReduceByKey.h:96
Dispatcher for worklets that inherit from WorkletReduceByKey.
Definition: DispatcherReduceByKey.h:35
void(_2, _3) ExecutionSignature
Definition: AverageByKey.h:38
#define VISKORES_CONT
Definition: ExportMacros.h:65
Definition: AverageByKey.h:33
Groups connected points that have the same field value.
Definition: Atomic.h:27
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:69
static StatState< FieldType > Run(const viskores::cont::ArrayHandle< FieldType, Storage > &field)
Calculate various summary statistics for the input ArrayHandle.
Definition: DescriptiveStatistics.h:234
static viskores::cont::ArrayHandle< ValueType > Run(const viskores::worklet::internal::KeysBase &keys, const viskores::cont::ArrayHandle< ValueType, InValuesStorage > &inValues)
Compute average values based on a set of Keys.
Definition: AverageByKey.h:87
void ArrayCopyDevice(const viskores::cont::ArrayHandle< InValueType, InStorage > &source, viskores::cont::ArrayHandle< OutValueType, OutStorage > &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopyDevice.h:83
@ Perf
General timing data and algorithm flow information, such as filter execution, worklet dispatches,...
viskores::cont::ArrayHandleTransform< HandleType, FunctorType > make_ArrayHandleTransform(HandleType handle, FunctorType functor)
make_ArrayHandleTransform is convenience function to generate an ArrayHandleTransform.
Definition: ArrayHandleTransform.h:495
Base class for worklets that group elements by keys.
Definition: WorkletReduceByKey.h:62
#define VISKORES_EXEC
Definition: ExportMacros.h:59
void(KeysIn keys, ValuesIn valuesIn, ReducedValuesOut averages) ControlSignature
Definition: AverageByKey.h:37