VTK-m  2.0
worklet/WarpScalar.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_worklet_WarpScalar_h
12 #define vtk_m_worklet_WarpScalar_h
13 
15 
16 namespace vtkm
17 {
18 namespace worklet
19 {
20 // A functor that modify points by moving points along point normals by the scalar
21 // amount times the scalar factor. It's a VTK-m version of the vtkWarpScalar in VTK.
22 // Useful for creating carpet or x-y-z plots.
23 // It doesn't modify the point coordinates, but creates a new point coordinates
24 // that have been warped.
26 {
27 public:
29  using ExecutionSignature = void(_1, _2, _3, _4);
30  VTKM_CONT
31  explicit WarpScalar(vtkm::FloatDefault scaleAmount)
32  : ScaleAmount(scaleAmount)
33  {
34  }
35 
36  VTKM_EXEC
37  void operator()(const vtkm::Vec3f& point,
38  const vtkm::Vec3f& normal,
39  const vtkm::FloatDefault& scaleFactor,
40  vtkm::Vec3f& result) const
41  {
42  result = point + this->ScaleAmount * scaleFactor * normal;
43  }
44 
45  template <typename T1, typename T2, typename T3>
47  const vtkm::Vec<T2, 3>& normal,
48  const T3& scaleFactor,
49  vtkm::Vec<T1, 3>& result) const
50  {
51  result = point + static_cast<T1>(this->ScaleAmount * scaleFactor) * normal;
52  }
53 
54 private:
56 };
57 }
58 } // namespace vtkm::worklet
59 
60 #endif // vtk_m_worklet_WarpScalar_h
vtkm::worklet::WarpScalar::ExecutionSignature
void(_1, _2, _3, _4) ExecutionSignature
Definition: worklet/WarpScalar.h:29
vtkm::worklet::WarpScalar
Definition: worklet/WarpScalar.h:25
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
WorkletMapField.h
vtkm::worklet::WorkletMapField::FieldOut
A control signature tag for output fields.
Definition: WorkletMapField.h:60
vtkm::worklet::WarpScalar::WarpScalar
VTKM_CONT WarpScalar(vtkm::FloatDefault scaleAmount)
Definition: worklet/WarpScalar.h:31
vtkm::worklet::WorkletMapField::FieldIn
A control signature tag for input fields.
Definition: WorkletMapField.h:49
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Vec< vtkm::FloatDefault, 3 >
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::worklet::WarpScalar::operator()
VTKM_EXEC void operator()(const vtkm::Vec3f &point, const vtkm::Vec3f &normal, const vtkm::FloatDefault &scaleFactor, vtkm::Vec3f &result) const
Definition: worklet/WarpScalar.h:37
vtkm::worklet::WarpScalar::ControlSignature
void(FieldIn, FieldIn, FieldIn, FieldOut) ControlSignature
Definition: worklet/WarpScalar.h:28
vtkm::worklet::WarpScalar::operator()
VTKM_EXEC void operator()(const vtkm::Vec< T1, 3 > &point, const vtkm::Vec< T2, 3 > &normal, const T3 &scaleFactor, vtkm::Vec< T1, 3 > &result) const
Definition: worklet/WarpScalar.h:46
vtkm::worklet::WarpScalar::ScaleAmount
vtkm::FloatDefault ScaleAmount
Definition: worklet/WarpScalar.h:55
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38