VTK-m  2.0
TransportTagArrayIn.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_cont_arg_TransportTagArrayIn_h
11 #define vtk_m_cont_arg_TransportTagArrayIn_h
12 
13 #include <vtkm/Deprecated.h>
14 #include <vtkm/Types.h>
15 
16 #include <vtkm/cont/ArrayHandle.h>
17 
19 
20 namespace vtkm
21 {
22 namespace cont
23 {
24 namespace arg
25 {
26 
33 {
34 };
35 
36 template <typename ContObjectType, typename Device>
37 struct Transport<vtkm::cont::arg::TransportTagArrayIn, ContObjectType, Device>
38 {
39  // MSVC will issue deprecation warnings here if this template is instantiated with
40  // a deprecated class even if the template is used from a section of code where
41  // deprecation warnings are suppressed. This is annoying behavior since this template
42  // has no control over what class it is used with. To get around it, we have to
43  // suppress all deprecation warnings here.
44 #ifdef VTKM_MSVC
46 #endif
47 
48  VTKM_IS_ARRAY_HANDLE(ContObjectType);
49 
50  using ExecObjectType = decltype(
51  std::declval<ContObjectType>().PrepareForInput(Device(), std::declval<vtkm::cont::Token&>()));
52 
53  template <typename InputDomainType>
54  VTKM_CONT ExecObjectType operator()(const ContObjectType& object,
55  const InputDomainType& vtkmNotUsed(inputDomain),
56  vtkm::Id inputRange,
57  vtkm::Id vtkmNotUsed(outputRange),
58  vtkm::cont::Token& token) const
59  {
60  if (object.GetNumberOfValues() != inputRange)
61  {
62  throw vtkm::cont::ErrorBadValue("Input array to worklet invocation the wrong size.");
63  }
64 
65  return object.PrepareForInput(Device(), token);
66  }
67 
68 #ifdef VTKM_MSVC
70 #endif
71 };
72 }
73 }
74 } // namespace vtkm::cont::arg
75 
76 #endif //vtk_m_cont_arg_TransportTagArrayIn_h
ArrayHandle.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
Types.h
vtkm::cont::arg::Transport< vtkm::cont::arg::TransportTagArrayIn, ContObjectType, Device >::ExecObjectType
decltype(std::declval< ContObjectType >().PrepareForInput(Device(), std::declval< vtkm::cont::Token & >())) ExecObjectType
Definition: TransportTagArrayIn.h:51
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
VTKM_DEPRECATED_SUPPRESS_END
#define VTKM_DEPRECATED_SUPPRESS_END
Definition: Deprecated.h:123
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
VTKM_IS_ARRAY_HANDLE
#define VTKM_IS_ARRAY_HANDLE(T)
Definition: ArrayHandle.h:132
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::arg::TransportTagArrayIn
Transport tag for input arrays.
Definition: TransportTagArrayIn.h:32
vtkmNotUsed
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
Transport.h
VTKM_DEPRECATED_SUPPRESS_BEGIN
#define VTKM_DEPRECATED_SUPPRESS_BEGIN
Definition: Deprecated.h:122
vtkm::cont::ErrorBadValue
This class is thrown when a VTKm function or method encounters an invalid value that inhibits progres...
Definition: ErrorBadValue.h:25
Deprecated.h
vtkm::cont::arg::Transport
Class for transporting from the control to the execution environment.
Definition: Transport.h:38
vtkm::cont::arg::Transport< vtkm::cont::arg::TransportTagArrayIn, ContObjectType, Device >::operator()
VTKM_CONT ExecObjectType operator()(const ContObjectType &object, const InputDomainType &vtkmNotUsed(inputDomain), vtkm::Id inputRange, vtkm::Id vtkmNotUsed(outputRange), vtkm::cont::Token &token) const
Definition: TransportTagArrayIn.h:54