Go to the documentation of this file.
11 #ifndef vtk_m_worklet_PointAverage_h
12 #define vtk_m_worklet_PointAverage_h
34 template <
typename CellValueVecType,
typename OutType>
36 const CellValueVecType& cellValues,
37 OutType& average)
const
39 using CellValueType =
typename CellValueVecType::ComponentType;
41 std::integral_constant<vtkm::IdComponent, vtkm::VecTraits<CellValueType>::NUM_COMPONENTS>;
43 std::integral_constant<vtkm::IdComponent, vtkm::VecTraits<OutType>::NUM_COMPONENTS>;
44 using SameLengthVectors =
typename std::is_same<InVecSize, OutVecSize>::type;
50 this->
DoAverage(numCells, cellValues, average, SameLengthVectors());
55 template <
typename CellValueVecType,
typename OutType>
57 const CellValueVecType& cellValues,
62 OutType sum = OutType(cellValues[0]);
67 sum =
static_cast<OutType
>(sum + OutType(cellValues[cellIndex]));
72 average =
static_cast<OutType
>(sum / OutType(
static_cast<OutComponentType
>(numCells)));
75 template <
typename CellValueVecType,
typename OutType>
79 std::false_type)
const
81 this->
RaiseError(
"PointAverage called with mismatched Vec sizes for PointAverage.");
87 #endif // vtk_m_worklet_PointAverage_h
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
FieldInIncident FieldInCell
Definition: WorkletMapTopology.h:278
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
_1 InputDomain
Definition: worklet/PointAverage.h:32
VTKM_EXEC void DoAverage(const vtkm::IdComponent &vtkmNotUsed(numCells), const CellValueVecType &vtkmNotUsed(cellValues), OutType &vtkmNotUsed(average), std::false_type) const
Definition: worklet/PointAverage.h:76
Definition: worklet/PointAverage.h:25
IncidentElementCount CellCount
Definition: WorkletMapTopology.h:286
Base class for worklets that map from Cells to Points.
Definition: WorkletMapTopology.h:274
void(CellCount, _2, _3) ExecutionSignature
Definition: worklet/PointAverage.h:31
void(CellSetIn cellset, FieldInCell inCellField, FieldOutPoint outPointField) ControlSignature
Definition: worklet/PointAverage.h:30
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
FieldOut FieldOutPoint
Definition: WorkletMapTopology.h:282
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:73
VTKM_EXEC void DoAverage(const vtkm::IdComponent &numCells, const CellValueVecType &cellValues, OutType &average, std::true_type) const
Definition: worklet/PointAverage.h:56
VTKM_EXEC void operator()(const vtkm::IdComponent &numCells, const CellValueVecType &cellValues, OutType &average) const
Definition: worklet/PointAverage.h:35
static VTKM_EXEC_CONT T ZeroInitialization()
Definition: TypeTraits.h:75
VTKM_EXEC void RaiseError(const char *message) const
Definition: FunctorBase.h:40