vtk-m/vtkm/worklet/DotProduct.h

46 lines
1.2 KiB
C
Raw Normal View History

2017-12-22 20:20:20 +00:00
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
2019-04-15 23:24:21 +00:00
//
2017-12-22 20:20:20 +00:00
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_DotProduct_h
#define vtk_m_worklet_DotProduct_h
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/Math.h>
2017-12-22 20:20:20 +00:00
#include <vtkm/VectorAnalysis.h>
namespace vtkm
{
namespace worklet
{
class DotProduct : public vtkm::worklet::WorkletMapField
{
public:
using ControlSignature = void(FieldIn, FieldIn, FieldOut);
2017-12-22 20:20:20 +00:00
2017-12-29 11:48:39 +00:00
template <typename T, vtkm::IdComponent Size>
VTKM_EXEC void operator()(const vtkm::Vec<T, Size>& v1,
const vtkm::Vec<T, Size>& v2,
T& outValue) const
2017-12-22 20:20:20 +00:00
{
outValue = static_cast<T>(vtkm::Dot(v1, v2));
}
template <typename T>
VTKM_EXEC void operator()(T s1, T s2, T& outValue) const
{
outValue = static_cast<T>(s1 * s2);
2017-12-22 20:20:20 +00:00
}
};
}
} // namespace vtkm::worklet
#endif // vtk_m_worklet_Normalize_h