Viskores  1.0
TransportTagWholeArrayOut.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_TransportTagWholeArrayOut_h
19 #define viskores_cont_arg_TransportTagWholeArrayOut_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 
46 {
47 };
48 
49 template <typename ContObjectType, typename Device>
51 {
52  // MSVC will issue deprecation warnings here if this template is instantiated with
53  // a deprecated class even if the template is used from a section of code where
54  // deprecation warnings are suppressed. This is annoying behavior since this template
55  // has no control over what class it is used with. To get around it, we have to
56  // suppress all deprecation warnings here.
57 #ifdef VISKORES_MSVC
59 #endif
60 
61  // If you get a compile error here, it means you tried to use an object that
62  // is not an array handle as an argument that is expected to be one.
63  VISKORES_IS_ARRAY_HANDLE(ContObjectType);
64 
65  using ValueType = typename ContObjectType::ValueType;
66  using StorageTag = typename ContObjectType::StorageTag;
67 
68  using ExecObjectType = typename ContObjectType::WritePortalType;
69 
70  template <typename InputDomainType>
71  VISKORES_CONT ExecObjectType operator()(ContObjectType& array,
72  const InputDomainType&,
75  viskores::cont::Token& token) const
76  {
77  // Note: we ignore the size of the domain because the randomly accessed
78  // array might not have the same size depending on how the user is using
79  // the array.
80 
81  return array.PrepareForOutput(array.GetNumberOfValues(), Device{}, token);
82  }
83 
84 #ifdef VISKORES_MSVC
86 #endif
87 };
88 }
89 }
90 } // namespace viskores::cont::arg
91 
92 #endif //viskores_cont_arg_TransportTagWholeArrayOut_h
ArrayHandle.h
Types.h
viskores::cont::arg::TransportTagWholeArrayOut
Transport tag for in-place arrays with random access.
Definition: TransportTagWholeArrayOut.h:45
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::TransportTagWholeArrayOut, ContObjectType, Device >::StorageTag
typename ContObjectType::StorageTag StorageTag
Definition: TransportTagWholeArrayOut.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::TransportTagWholeArrayOut, ContObjectType, Device >::ExecObjectType
typename ContObjectType::WritePortalType ExecObjectType
Definition: TransportTagWholeArrayOut.h:68
VISKORES_DEPRECATED_SUPPRESS_END
#define VISKORES_DEPRECATED_SUPPRESS_END
Definition: Deprecated.h:132
Transport.h
viskores::cont::arg::Transport< viskores::cont::arg::TransportTagWholeArrayOut, ContObjectType, Device >::operator()
ExecObjectType operator()(ContObjectType &array, const InputDomainType &, viskores::Id, viskores::Id, viskores::cont::Token &token) const
Definition: TransportTagWholeArrayOut.h:71
Deprecated.h
viskores::cont::arg::Transport< viskores::cont::arg::TransportTagWholeArrayOut, ContObjectType, Device >::ValueType
typename ContObjectType::ValueType ValueType
Definition: TransportTagWholeArrayOut.h:65
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