VTK-m  2.0
worklet/WarpVector.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_WarpVector_h
12 #define vtk_m_worklet_WarpVector_h
13 
15 
16 namespace vtkm
17 {
18 namespace worklet
19 {
20 // A functor that modify points by moving points along a vector
21 // then timing a scale factor. It's a VTK-m version of the vtkWarpVector in VTK.
22 // Useful for showing flow profiles or mechanical deformation.
23 // This worklet does not modify the input points but generate new point coordinate
24 // instance that has been warped.
26 {
27 public:
29  using ExecutionSignature = _3(_1, _2);
30  VTKM_CONT
32  : Scale(scale)
33  {
34  }
35 
36  VTKM_EXEC
37  vtkm::Vec3f operator()(const vtkm::Vec3f& point, const vtkm::Vec3f& vector) const
38  {
39  return point + this->Scale * vector;
40  }
41 
42  template <typename T>
44  const vtkm::Vec<T, 3>& vector) const
45  {
46  return point + static_cast<T>(this->Scale) * vector;
47  }
48 
49 
50 private:
52 };
53 }
54 } // namespace vtkm::worklet
55 
56 #endif // vtk_m_worklet_WarpVector_h
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::WarpVector
Definition: worklet/WarpVector.h:25
vtkm::worklet::WorkletMapField::FieldOut
A control signature tag for output fields.
Definition: WorkletMapField.h:60
vtkm::worklet::WarpVector::Scale
vtkm::FloatDefault Scale
Definition: worklet/WarpVector.h:51
vtkm::worklet::WarpVector::ExecutionSignature
_3(_1, _2) ExecutionSignature
Definition: worklet/WarpVector.h:29
vtkm::worklet::WarpVector::WarpVector
VTKM_CONT WarpVector(vtkm::FloatDefault scale)
Definition: worklet/WarpVector.h:31
vtkm::worklet::WorkletMapField::FieldIn
A control signature tag for input fields.
Definition: WorkletMapField.h:49
vtkm::worklet::WarpVector::operator()
VTKM_EXEC vtkm::Vec3f operator()(const vtkm::Vec3f &point, const vtkm::Vec3f &vector) const
Definition: worklet/WarpVector.h:37
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::WarpVector::ControlSignature
void(FieldIn, FieldIn, FieldOut) ControlSignature
Definition: worklet/WarpVector.h:28
vtkm::Vec< T, 3 >
Definition: Types.h:975
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::WarpVector::operator()
VTKM_EXEC vtkm::Vec< T, 3 > operator()(const vtkm::Vec< T, 3 > &point, const vtkm::Vec< T, 3 > &vector) const
Definition: worklet/WarpVector.h:43
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38