Go to the documentation of this file.
11 #ifndef vtk_m_worklet_FieldStatistics_h
12 #define vtk_m_worklet_FieldStatistics_h
32 template <
typename FieldType>
81 FieldType& pow4)
const
109 template <
typename Storage>
116 DeviceAlgorithms::Copy(fieldArray, tempArray);
117 DeviceAlgorithms::Sort(tempArray);
120 FieldType numValues =
static_cast<FieldType
>(dataSize);
124 statinfo.
median = firstAndMedian[1];
134 FieldType sum = DeviceAlgorithms::ScanInclusive(fieldArray, tempArray);
135 statinfo.
mean = sum / numValues;
148 calculatePowersDispatcher.Invoke(fieldArray, pow1Array, pow2Array, pow3Array, pow4Array);
151 statinfo.
rawMoment[
FIRST] = DeviceAlgorithms::ScanInclusive(pow1Array, pow1Array) / numValues;
152 statinfo.
rawMoment[
SECOND] = DeviceAlgorithms::ScanInclusive(pow2Array, pow2Array) / numValues;
153 statinfo.
rawMoment[
THIRD] = DeviceAlgorithms::ScanInclusive(pow3Array, pow3Array) / numValues;
154 statinfo.
rawMoment[
FOURTH] = DeviceAlgorithms::ScanInclusive(pow4Array, pow4Array) / numValues;
159 subtractConstDispatcher.Invoke(fieldArray, tempArray);
162 calculatePowersDispatcher.Invoke(tempArray, pow1Array, pow2Array, pow3Array, pow4Array);
166 DeviceAlgorithms::ScanInclusive(pow1Array, pow1Array) / numValues;
168 DeviceAlgorithms::ScanInclusive(pow2Array, pow2Array) / numValues;
170 DeviceAlgorithms::ScanInclusive(pow3Array, pow3Array) / numValues;
172 DeviceAlgorithms::ScanInclusive(pow4Array, pow4Array) / numValues;
186 #endif // vtk_m_worklet_FieldStatistics_h
static constexpr vtkm::Id FOURTH
Definition: FieldStatistics.h:40
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
VTKM_EXEC_CONT vtkm::Float32 Sqrt(vtkm::Float32 x)
Compute the square root of x.
Definition: Math.h:958
Manages an array-worth of data.
Definition: ArrayHandle.h:283
FieldType median
Definition: FieldStatistics.h:47
VTKM_CONT CalculatePowers(vtkm::Id num)
Definition: FieldStatistics.h:71
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_EXEC void operator()(const FieldType &value, FieldType &pow1, FieldType &pow2, FieldType &pow3, FieldType &pow4) const
Definition: FieldStatistics.h:77
Binary Predicate that takes two arguments argument x, and y and returns a vtkm::Vec<T,...
Definition: BinaryOperators.h:112
VTKM_CONT 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:465
A control signature tag for output fields.
Definition: WorkletMapField.h:60
FieldType constant
Definition: FieldStatistics.h:97
static constexpr vtkm::Id NUM_POWERS
Definition: FieldStatistics.h:41
Definition: FieldStatistics.h:90
Definition: FieldStatistics.h:33
static constexpr vtkm::Id THIRD
Definition: FieldStatistics.h:39
void(_1, _2, _3, _4, _5) ExecutionSignature
Definition: FieldStatistics.h:65
FieldType stddev
Definition: FieldStatistics.h:50
_1 InputDomain
Definition: FieldStatistics.h:66
VTKM_CONT 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
FieldType minimum
Definition: FieldStatistics.h:45
FieldType centralMoment[4]
Definition: FieldStatistics.h:54
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
Definition: FieldStatistics.h:43
FieldType kurtosis
Definition: FieldStatistics.h:52
FieldType variance
Definition: FieldStatistics.h:49
void(FieldIn value, FieldOut pow1Array, FieldOut pow2Array, FieldOut pow3Array, FieldOut pow4Array) ControlSignature
Definition: FieldStatistics.h:64
void Run(vtkm::cont::ArrayHandle< FieldType, Storage > fieldArray, StatInfo &statinfo)
Definition: FieldStatistics.h:110
Dispatcher for worklets that inherit from WorkletMapField.
Definition: DispatcherMapField.h:25
FieldType rawMoment[4]
Definition: FieldStatistics.h:53
A control signature tag for input fields.
Definition: WorkletMapField.h:49
_2(_1) ExecutionSignature
Definition: FieldStatistics.h:94
Definition: FieldStatistics.h:57
#define VTKM_CONT
Definition: ExportMacros.h:57
_1 InputDomain
Definition: FieldStatistics.h:95
FieldType skewness
Definition: FieldStatistics.h:51
Definition: Algorithm.h:385
A short fixed-length array.
Definition: Types.h:767
static constexpr vtkm::Id FIRST
Definition: FieldStatistics.h:37
FieldType maximum
Definition: FieldStatistics.h:46
vtkm::Id numPowers
Definition: FieldStatistics.h:68
VTKM_CONT SubtractConst(const FieldType &constant0)
Definition: FieldStatistics.h:100
void(FieldIn value, FieldOut diff) ControlSignature
Definition: FieldStatistics.h:93
FieldType mean
Definition: FieldStatistics.h:48
VTKM_EXEC FieldType operator()(const FieldType &value) const
Definition: FieldStatistics.h:106
static constexpr vtkm::Id SECOND
Definition: FieldStatistics.h:38
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38