Go to the documentation of this file.
11 #ifndef vtk_m_worklet_FieldStatistics_h
12 #define vtk_m_worklet_FieldStatistics_h
31 template <
typename FieldType>
52 FieldType rawMoment[4];
53 FieldType centralMoment[4];
80 FieldType& pow4)
const
100 : constant(constant0)
105 FieldType
operator()(
const FieldType& value)
const {
return (value - constant); }
108 template <
typename Storage>
115 DeviceAlgorithms::Copy(fieldArray, tempArray);
116 DeviceAlgorithms::Sort(tempArray);
119 FieldType numValues =
static_cast<FieldType
>(dataSize);
123 statinfo.
median = firstAndMedian[1];
133 FieldType sum = DeviceAlgorithms::ScanInclusive(fieldArray, tempArray);
134 statinfo.
mean = sum / numValues;
135 statinfo.
rawMoment[FIRST] = sum / numValues;
147 calculatePowersDispatcher.Invoke(fieldArray, pow1Array, pow2Array, pow3Array, pow4Array);
150 statinfo.
rawMoment[FIRST] = DeviceAlgorithms::ScanInclusive(pow1Array, pow1Array) / numValues;
151 statinfo.
rawMoment[SECOND] = DeviceAlgorithms::ScanInclusive(pow2Array, pow2Array) / numValues;
152 statinfo.
rawMoment[THIRD] = DeviceAlgorithms::ScanInclusive(pow3Array, pow3Array) / numValues;
153 statinfo.
rawMoment[FOURTH] = DeviceAlgorithms::ScanInclusive(pow4Array, pow4Array) / numValues;
158 subtractConstDispatcher.Invoke(fieldArray, tempArray);
161 calculatePowersDispatcher.Invoke(tempArray, pow1Array, pow2Array, pow3Array, pow4Array);
165 DeviceAlgorithms::ScanInclusive(pow1Array, pow1Array) / numValues;
167 DeviceAlgorithms::ScanInclusive(pow2Array, pow2Array) / numValues;
169 DeviceAlgorithms::ScanInclusive(pow3Array, pow3Array) / numValues;
171 DeviceAlgorithms::ScanInclusive(pow4Array, pow4Array) / numValues;
185 #endif // vtk_m_worklet_FieldStatistics_h
Manages an array-worth of data.
Definition: ArrayHandle.h:300
FieldType median
Definition: FieldStatistics.h:46
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
SubtractConst(const FieldType &constant0)
Definition: FieldStatistics.h:99
vtkm::Float32 Sqrt(vtkm::Float32 x)
Definition: Math.h:943
Binary Predicate that takes two arguments argument x, and y and returns a vtkm::Vec<T,...
Definition: BinaryOperators.h:112
A control signature tag for output fields.
Definition: WorkletMapField.h:80
CalculatePowers(vtkm::Id num)
Definition: FieldStatistics.h:70
FieldType constant
Definition: FieldStatistics.h:96
Definition: FieldStatistics.h:89
Definition: FieldStatistics.h:32
void(_1, _2, _3, _4, _5) ExecutionSignature
Definition: FieldStatistics.h:64
FieldType stddev
Definition: FieldStatistics.h:49
_1 InputDomain
Definition: FieldStatistics.h:65
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:468
FieldType minimum
Definition: FieldStatistics.h:44
FieldType centralMoment[4]
Definition: FieldStatistics.h:53
Definition: FieldStatistics.h:42
FieldType kurtosis
Definition: FieldStatistics.h:51
FieldType variance
Definition: FieldStatistics.h:48
void(FieldIn value, FieldOut pow1Array, FieldOut pow2Array, FieldOut pow3Array, FieldOut pow4Array) ControlSignature
Definition: FieldStatistics.h:63
void Run(vtkm::cont::ArrayHandle< FieldType, Storage > fieldArray, StatInfo &statinfo)
Definition: FieldStatistics.h:109
Dispatcher for worklets that inherit from WorkletMapField.
Definition: DispatcherMapField.h:25
FieldType rawMoment[4]
Definition: FieldStatistics.h:52
A control signature tag for input fields.
Definition: WorkletMapField.h:60
_2(_1) ExecutionSignature
Definition: FieldStatistics.h:93
Definition: FieldStatistics.h:56
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
_1 InputDomain
Definition: FieldStatistics.h:94
FieldType skewness
Definition: FieldStatistics.h:50
Definition: Algorithm.h:386
void ArrayGetValues(const vtkm::cont::ArrayHandle< vtkm::Id, SIds > &ids, const vtkm::cont::ArrayHandle< T, SData > &data, vtkm::cont::ArrayHandle< T, SOut > &output)
Obtain a small set of values from an ArrayHandle with minimal device transfers.
Definition: ArrayGetValues.h:119
A short fixed-length array.
Definition: Types.h:357
FieldType operator()(const FieldType &value) const
Definition: FieldStatistics.h:105
FieldType maximum
Definition: FieldStatistics.h:45
vtkm::Id numPowers
Definition: FieldStatistics.h:67
Definition: DescriptiveStatistics.h:22
void operator()(const FieldType &value, FieldType &pow1, FieldType &pow2, FieldType &pow3, FieldType &pow4) const
Definition: FieldStatistics.h:76
void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:490
void(FieldIn value, FieldOut diff) ControlSignature
Definition: FieldStatistics.h:92
FieldType mean
Definition: FieldStatistics.h:47
#define VTKM_DEPRECATED(...)
Definition: Deprecated.h:145
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:39