Viskores  1.0
TransportTagArrayInOut.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_TransportTagArrayInOut_h
19 #define viskores_cont_arg_TransportTagArrayInOut_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 
42 {
43 };
44 
45 template <typename ContObjectType, typename Device>
46 struct Transport<viskores::cont::arg::TransportTagArrayInOut, ContObjectType, Device>
47 {
48  // MSVC will issue deprecation warnings here if this template is instantiated with
49  // a deprecated class even if the template is used from a section of code where
50  // deprecation warnings are suppressed. This is annoying behavior since this template
51  // has no control over what class it is used with. To get around it, we have to
52  // suppress all deprecation warnings here.
53 #ifdef VISKORES_MSVC
55 #endif
56 
57  // If you get a compile error here, it means you tried to use an object that
58  // is not an array handle as an argument that is expected to be one.
59  VISKORES_IS_ARRAY_HANDLE(ContObjectType);
60 
61  using ExecObjectType = decltype(std::declval<ContObjectType>().PrepareForInPlace(
62  Device(),
63  std::declval<viskores::cont::Token&>()));
64 
65  template <typename InputDomainType>
66  VISKORES_CONT ExecObjectType operator()(ContObjectType& object,
67  const InputDomainType& viskoresNotUsed(inputDomain),
68  viskores::Id viskoresNotUsed(inputRange),
69  viskores::Id outputRange,
70  viskores::cont::Token& token) const
71  {
72  if (object.GetNumberOfValues() != outputRange)
73  {
75  "Input/output array to worklet invocation the wrong size.");
76  }
77 
78  return object.PrepareForInPlace(Device(), token);
79  }
80 
81 #ifdef VISKORES_MSVC
83 #endif
84 };
85 }
86 }
87 } // namespace viskores::cont::arg
88 
89 #endif //viskores_cont_arg_TransportTagArrayInOut_h
viskores::cont::arg::TransportTagArrayInOut
Transport tag for in-place arrays.
Definition: TransportTagArrayInOut.h:41
ArrayHandle.h
Types.h
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
viskoresNotUsed
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
viskores::cont::arg::Transport< viskores::cont::arg::TransportTagArrayInOut, ContObjectType, Device >::operator()
ExecObjectType operator()(ContObjectType &object, const InputDomainType &, viskores::Id, viskores::Id outputRange, viskores::cont::Token &token) const
Definition: TransportTagArrayInOut.h:66
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::cont::arg::Transport< viskores::cont::arg::TransportTagArrayInOut, ContObjectType, Device >::ExecObjectType
decltype(std::declval< ContObjectType >().PrepareForInPlace(Device(), std::declval< viskores::cont::Token & >())) ExecObjectType
Definition: TransportTagArrayInOut.h:63
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::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