VTK-m  2.0
worklet/LogValues.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_LogValues_h
12 #define vtk_m_worklet_LogValues_h
13 
16 
17 namespace vtkm
18 {
19 namespace worklet
20 {
21 namespace detail
22 {
23 template <vtkm::FloatDefault LogFunc(vtkm::FloatDefault)>
24 class LogFunWorklet : public vtkm::worklet::WorkletMapField
25 {
26  const vtkm::FloatDefault MinValue;
27 
28 public:
29  VTKM_CONT
30  LogFunWorklet(const vtkm::FloatDefault minValue)
31  : MinValue(minValue)
32  {
33  }
34 
35  typedef void ControlSignature(FieldIn, FieldOut);
36  typedef void ExecutionSignature(_1, _2);
37 
38  template <typename T>
39  VTKM_EXEC void operator()(const T& value, vtkm::FloatDefault& log_value) const
40  {
41  vtkm::FloatDefault f_value = static_cast<vtkm::FloatDefault>(value);
42  f_value = vtkm::Max(MinValue, f_value);
43  log_value = LogFunc(f_value);
44  }
45 }; //class LogFunWorklet
46 }
47 }
48 } // namespace vtkm::worklet
49 
50 #endif // vtk_m_worklet_LogValues_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
DispatcherMapField.h
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38