Viskores  1.0
TransportTagArrayIn.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_cont_arg_TransportTagArrayIn_h
19 #define viskores_cont_arg_TransportTagArrayIn_h
20 
21 #include <viskores/Deprecated.h>
22 #include <viskores/Types.h>
23 
25 
27 
28 namespace viskores
29 {
30 namespace cont
31 {
32 namespace arg
33 {
34 
41 {
42 };
43 
44 template <typename ContObjectType, typename Device>
45 struct Transport<viskores::cont::arg::TransportTagArrayIn, ContObjectType, Device>
46 {
47  // MSVC will issue deprecation warnings here if this template is instantiated with
48  // a deprecated class even if the template is used from a section of code where
49  // deprecation warnings are suppressed. This is annoying behavior since this template
50  // has no control over what class it is used with. To get around it, we have to
51  // suppress all deprecation warnings here.
52 #ifdef VISKORES_MSVC
54 #endif
55 
56  VISKORES_IS_ARRAY_HANDLE(ContObjectType);
57 
58  using ExecObjectType = decltype(std::declval<ContObjectType>().PrepareForInput(
59  Device(),
60  std::declval<viskores::cont::Token&>()));
61 
62  template <typename InputDomainType>
63  VISKORES_CONT ExecObjectType operator()(const ContObjectType& object,
64  const InputDomainType& viskoresNotUsed(inputDomain),
65  viskores::Id inputRange,
66  viskores::Id viskoresNotUsed(outputRange),
67  viskores::cont::Token& token) const
68  {
69  if (object.GetNumberOfValues() != inputRange)
70  {
71  throw viskores::cont::ErrorBadValue("Input array to worklet invocation the wrong size.");
72  }
73 
74  return object.PrepareForInput(Device(), token);
75  }
76 
77 #ifdef VISKORES_MSVC
79 #endif
80 };
81 }
82 }
83 } // namespace viskores::cont::arg
84 
85 #endif //viskores_cont_arg_TransportTagArrayIn_h
ArrayHandle.h
Types.h
viskores::cont::arg::TransportTagArrayIn
Transport tag for input arrays.
Definition: TransportTagArrayIn.h:40
viskores::cont::arg::Transport
Class for transporting from the control to the execution environment.
Definition: Transport.h:46
VISKORES_IS_ARRAY_HANDLE
#define VISKORES_IS_ARRAY_HANDLE(T)
Checks that the given type is a viskores::cont::ArrayHandle.
Definition: ArrayHandle.h:145
viskores::cont::arg::Transport< viskores::cont::arg::TransportTagArrayIn, ContObjectType, Device >::operator()
ExecObjectType operator()(const ContObjectType &object, const InputDomainType &, viskores::Id inputRange, viskores::Id, viskores::cont::Token &token) const
Definition: TransportTagArrayIn.h:63
viskoresNotUsed
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
VISKORES_DEPRECATED_SUPPRESS_END
#define VISKORES_DEPRECATED_SUPPRESS_END
Definition: Deprecated.h:132
Transport.h
viskores::cont::ErrorBadValue
This class is thrown when a Viskores function or method encounters an invalid value that inhibits pro...
Definition: ErrorBadValue.h:33
Deprecated.h
viskores::cont::arg::Transport< viskores::cont::arg::TransportTagArrayIn, ContObjectType, Device >::ExecObjectType
decltype(std::declval< ContObjectType >().PrepareForInput(Device(), std::declval< viskores::cont::Token & >())) ExecObjectType
Definition: TransportTagArrayIn.h:60
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
VISKORES_DEPRECATED_SUPPRESS_BEGIN
#define VISKORES_DEPRECATED_SUPPRESS_BEGIN
Definition: Deprecated.h:131