VTK-m  2.0
Portals.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 #ifndef vtk_m_worklet_colorconversion_Portals_h
11 #define vtk_m_worklet_colorconversion_Portals_h
12 
13 #include <vtkm/VectorAnalysis.h>
14 
15 namespace vtkm
16 {
17 namespace worklet
18 {
19 namespace colorconversion
20 {
21 
23 {
24  template <typename T, int N>
25  VTKM_EXEC auto operator()(const vtkm::Vec<T, N>& values) const
26  -> decltype(vtkm::Magnitude(values))
27  { //Should we be using RMag?
28  return vtkm::Magnitude(values);
29  }
30 };
31 
33 {
35 
37  : Component(0)
38  {
39  }
40 
42  : Component(comp)
43  {
44  }
45 
46  template <typename T>
47  VTKM_EXEC auto operator()(T&& value) const ->
48  typename std::remove_reference<decltype(value[vtkm::IdComponent{}])>::type
49  {
50  return value[this->Component];
51  }
52 };
53 }
54 }
55 }
56 #endif
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::worklet::colorconversion::ComponentPortal::ComponentPortal
ComponentPortal(vtkm::IdComponent comp)
Definition: Portals.h:41
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::Magnitude
VTKM_EXEC_CONT detail::FloatingPointReturnType< T >::Type Magnitude(const T &x)
Returns the magnitude of a vector.
Definition: VectorAnalysis.h:100
vtkm::worklet::colorconversion::MagnitudePortal::operator()
VTKM_EXEC auto operator()(const vtkm::Vec< T, N > &values) const -> decltype(vtkm::Magnitude(values))
Definition: Portals.h:25
vtkm::worklet::colorconversion::ComponentPortal::Component
vtkm::IdComponent Component
Definition: Portals.h:34
VectorAnalysis.h
vtkm::worklet::colorconversion::ComponentPortal::ComponentPortal
ComponentPortal()
Definition: Portals.h:36
vtkm::worklet::colorconversion::ComponentPortal
Definition: Portals.h:32
vtkm::Vec< T, N >
vtkm::worklet::colorconversion::ComponentPortal::operator()
VTKM_EXEC auto operator()(T &&value) const -> typename std::remove_reference< decltype(value[vtkm::IdComponent
Definition: Portals.h:47
vtkm::worklet::colorconversion::MagnitudePortal
Definition: Portals.h:22