Go to the documentation of this file.
11 #ifndef vtk_m_worklet_CellAverage_h
12 #define vtk_m_worklet_CellAverage_h
31 template <
typename Po
intValueVecType,
typename OutType>
33 const PointValueVecType& pointValues,
34 OutType& average)
const
36 using PointValueType =
typename PointValueVecType::ComponentType;
39 std::integral_constant<vtkm::IdComponent, vtkm::VecTraits<PointValueType>::NUM_COMPONENTS>;
41 std::integral_constant<vtkm::IdComponent, vtkm::VecTraits<OutType>::NUM_COMPONENTS>;
42 using SameLengthVectors =
typename std::is_same<InVecSize, OutVecSize>::type;
44 this->
DoAverage(numPoints, pointValues, average, SameLengthVectors());
48 template <
typename Po
intValueVecType,
typename OutType>
50 const PointValueVecType& pointValues,
55 OutType sum = OutType(pointValues[0]);
60 sum =
static_cast<OutType
>(sum + OutType(pointValues[pointIndex]));
65 average =
static_cast<OutType
>(sum / OutType(
static_cast<OutComponentType
>(numPoints)));
68 template <
typename Po
intValueVecType,
typename OutType>
72 std::false_type)
const
74 this->
RaiseError(
"CellAverage called with mismatched Vec sizes for CellAverage.");
80 #endif // vtk_m_worklet_CellAverage_h
VTKM_EXEC void DoAverage(const vtkm::IdComponent &numPoints, const PointValueVecType &pointValues, OutType &average, std::true_type) const
Definition: worklet/CellAverage.h:49
void(CellSetIn cellset, FieldInPoint inPoints, FieldOutCell outCells) ControlSignature
Definition: worklet/CellAverage.h:27
VTKM_EXEC void DoAverage(const vtkm::IdComponent &vtkmNotUsed(numPoints), const PointValueVecType &vtkmNotUsed(pointValues), OutType &vtkmNotUsed(average), std::false_type) const
Definition: worklet/CellAverage.h:69
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
IncidentElementCount PointCount
Definition: WorkletMapTopology.h:267
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
VTKM_EXEC void operator()(const vtkm::IdComponent &numPoints, const PointValueVecType &pointValues, OutType &average) const
Definition: worklet/CellAverage.h:32
_1 InputDomain
Definition: worklet/CellAverage.h:29
Definition: worklet/CellAverage.h:24
Base class for worklets that map from Points to Cells.
Definition: WorkletMapTopology.h:255
FieldInIncident FieldInPoint
Definition: WorkletMapTopology.h:259
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:73
void(PointCount, _2, _3) ExecutionSignature
Definition: worklet/CellAverage.h:28
VTKM_EXEC void RaiseError(const char *message) const
Definition: FunctorBase.h:40
FieldOut FieldOutCell
Definition: WorkletMapTopology.h:263