Go to the documentation of this file.
12 #ifndef vtk_m_worklet_moments_ComputeMoments_h
13 #define vtk_m_worklet_moments_ComputeMoments_h
45 assert(_spacing[0] > 1e-10);
46 assert(_spacing[1] > 1e-10);
47 assert(_spacing[2] > 1e-10);
57 template <
typename NeighIn,
typename T>
86 if (vtkm::Dot(radius, radius) <= 1)
89 static_cast<T
>(vtkm::Pow(radius[0],
p) * vtkm::Pow(radius[1],
q) * image.Get(i, j, 0));
116 assert(_spacing[0] > 1e-10);
117 assert(_spacing[1] > 1e-10);
118 assert(_spacing[2] > 1e-10);
129 template <
typename NeighIn,
typename T>
166 if (vtkm::Dot(radius, radius) <= 1)
168 sum +=
static_cast<T
>(vtkm::Pow(radius[0],
p) * vtkm::Pow(radius[1],
q) *
169 vtkm::Pow(radius[2],
r) * image.Get(i, j, k));
198 template <
typename T,
typename S>
209 for (
int order = 0; order <= maxOrder; ++order)
211 for (
int p = 0; p <= order; ++p)
213 const int q = order - p;
217 DispatcherType dispatcher(WorkletType{ spacing, radius, p, q });
218 dispatcher.Invoke(input, pixels, moments);
220 std::string fieldName = std::string(
"index") + std::string(p,
'0') + std::string(q,
'1');
229 template <
typename T,
typename S>
240 for (
int order = 0; order <= maxOrder; ++order)
242 for (
int r = 0; r <= order; ++r)
244 const int qMax = order - r;
245 for (
int q = 0; q <= qMax; ++q)
247 const int p = order - r - q;
251 DispatcherType dispatcher(WorkletType{ spacing, radius, p, q, r });
252 dispatcher.Invoke(input, pixels, moments);
254 std::string fieldName = std::string(
"index") + std::string(p,
'0') +
255 std::string(q,
'1') + std::string(r,
'2');
266 template <
typename T,
typename S>
284 #endif // vtk_m_worklet_moments_ComputeMoments_h
void(_2, Boundary, _3) ExecutionSignature
Definition: worklet/ComputeMoments.h:127
Provides a neighborhood's placement with respect to the mesh's boundary.
Definition: BoundaryState.h:31
const int p
Definition: worklet/ComputeMoments.h:181
const vtkm::Float64 SpacingProduct
Definition: worklet/ComputeMoments.h:99
const vtkm::Vec3f Spacing
Definition: worklet/ComputeMoments.h:278
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
Definition: CastAndCall.h:32
A control signature tag for input connectivity.
Definition: WorkletNeighborhood.h:110
Definition: worklet/ComputeMoments.h:34
A control signature tag for output point fields.
Definition: WorkletNeighborhood.h:89
VTKM_CONT vtkm::cont::UncertainCellSet< CellSetList > ResetCellSetList(CellSetList) const
Assigns potential cell set types.
const int q
Definition: worklet/ComputeMoments.h:101
const int q
Definition: worklet/ComputeMoments.h:182
const int r
Definition: worklet/ComputeMoments.h:183
vtkm::Id3 IJK
Definition: BoundaryState.h:260
ComputeMoments3D(const vtkm::Vec3f &_spacing, vtkm::Float64 _radius, int _p, int _q, int _r)
Definition: worklet/ComputeMoments.h:107
A CellSet of an unknown type.
Definition: UnknownCellSet.h:48
void(_2, Boundary, _3) ExecutionSignature
Definition: worklet/ComputeMoments.h:55
VTKM_EXEC vtkm::IdComponent3 ClampNeighborIndex(const vtkm::IdComponent3 &neighbor) const
Definition: BoundaryState.h:204
void Run(const vtkm::cont::UnknownCellSet &input, const vtkm::cont::ArrayHandle< T, S > &pixels, int maxOrder, vtkm::cont::DataSet &output) const
Definition: worklet/ComputeMoments.h:267
Definition: worklet/ComputeMoments.h:186
void operator()(const vtkm::cont::CellSetStructured< 3 > &input, const vtkm::cont::ArrayHandle< T, S > &pixels, vtkm::Vec3f spacing, vtkm::Float64 radius, int maxOrder, vtkm::cont::DataSet &output) const
Definition: worklet/ComputeMoments.h:230
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: cont/Field.h:31
vtkm::Vec3i_32 RadiusDiscrete
Definition: worklet/ComputeMoments.h:98
void(CellSetIn, FieldInNeighborhood, FieldOut) ControlSignature
Definition: worklet/ComputeMoments.h:53
Definition: worklet/ComputeMoments.h:104
VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec< T, Size > &a)
Definition: Types.h:1567
The ExecutionSignature tag to query if the current iteration is inside the boundary.
Definition: WorkletNeighborhood.h:54
VTKM_CONT void AddField(const Field &field)
Adds a field to the DataSet.
const vtkm::Float64 SpacingProduct
Definition: worklet/ComputeMoments.h:180
Dispatcher for worklets that inherit from WorkletPointNeighborhood.
Definition: DispatcherPointNeighborhood.h:26
const int p
Definition: worklet/ComputeMoments.h:100
double Float64
Definition: Types.h:155
VTKM_EXEC void operator()(const NeighIn &image, const vtkm::exec::BoundaryState &boundary, T &moment) const
Definition: worklet/ComputeMoments.h:130
void operator()(const vtkm::cont::CellSetStructured< 2 > &input, const vtkm::cont::ArrayHandle< T, S > &pixels, vtkm::Vec3f spacing, vtkm::Float64 radius, int maxOrder, vtkm::cont::DataSet &output) const
Definition: worklet/ComputeMoments.h:199
ComputeMoments2D(const vtkm::Vec3f &_spacing, vtkm::Float64 _radius, int _p, int _q)
Definition: worklet/ComputeMoments.h:37
A control signature tag for neighborhood input values.
Definition: WorkletNeighborhood.h:129
Definition: WorkletPointNeighborhood.h:27
void(CellSetIn, FieldInNeighborhood, FieldOut) ControlSignature
Definition: worklet/ComputeMoments.h:125
ComputeMoments(double _radius, const vtkm::Vec3f &_spacing)
Definition: worklet/ComputeMoments.h:189
const vtkm::Float64 Radius
Definition: worklet/ComputeMoments.h:277
VTKM_EXEC void operator()(const NeighIn &image, const vtkm::exec::BoundaryState &boundary, T &moment) const
Definition: worklet/ComputeMoments.h:58
static VTKM_EXEC_CONT T ZeroInitialization()
Definition: TypeTraits.h:75
Definition: worklet/ComputeMoments.h:195
vtkm::Vec3i_32 RadiusDiscrete
Definition: worklet/ComputeMoments.h:179