VTK-m  2.0
TransportTagWholeArrayOut.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_TransportTagWholeArrayOut_h
11 #define vtk_m_cont_arg_TransportTagWholeArrayOut_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 
38 {
39 };
40 
41 template <typename ContObjectType, typename Device>
42 struct Transport<vtkm::cont::arg::TransportTagWholeArrayOut, ContObjectType, Device>
43 {
44  // MSVC will issue deprecation warnings here if this template is instantiated with
45  // a deprecated class even if the template is used from a section of code where
46  // deprecation warnings are suppressed. This is annoying behavior since this template
47  // has no control over what class it is used with. To get around it, we have to
48  // suppress all deprecation warnings here.
49 #ifdef VTKM_MSVC
51 #endif
52 
53  // If you get a compile error here, it means you tried to use an object that
54  // is not an array handle as an argument that is expected to be one.
55  VTKM_IS_ARRAY_HANDLE(ContObjectType);
56 
57  using ValueType = typename ContObjectType::ValueType;
58  using StorageTag = typename ContObjectType::StorageTag;
59 
60  using ExecObjectType = typename ContObjectType::WritePortalType;
61 
62  template <typename InputDomainType>
63  VTKM_CONT ExecObjectType operator()(ContObjectType& array,
64  const InputDomainType&,
65  vtkm::Id,
66  vtkm::Id,
67  vtkm::cont::Token& token) const
68  {
69  // Note: we ignore the size of the domain because the randomly accessed
70  // array might not have the same size depending on how the user is using
71  // the array.
72 
73  return array.PrepareForOutput(array.GetNumberOfValues(), Device{}, token);
74  }
75 
76 #ifdef VTKM_MSVC
78 #endif
79 };
80 }
81 }
82 } // namespace vtkm::cont::arg
83 
84 #endif //vtk_m_cont_arg_TransportTagWholeArrayOut_h
vtkm::cont::arg::Transport< vtkm::cont::arg::TransportTagWholeArrayOut, ContObjectType, Device >::ExecObjectType
typename ContObjectType::WritePortalType ExecObjectType
Definition: TransportTagWholeArrayOut.h:60
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::TransportTagWholeArrayOut, ContObjectType, Device >::StorageTag
typename ContObjectType::StorageTag StorageTag
Definition: TransportTagWholeArrayOut.h:58
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::cont::arg::TransportTagWholeArrayOut
Transport tag for in-place arrays with random access.
Definition: TransportTagWholeArrayOut.h:37
VTKM_IS_ARRAY_HANDLE
#define VTKM_IS_ARRAY_HANDLE(T)
Definition: ArrayHandle.h:132
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
Transport.h
VTKM_DEPRECATED_SUPPRESS_BEGIN
#define VTKM_DEPRECATED_SUPPRESS_BEGIN
Definition: Deprecated.h:122
Deprecated.h
vtkm::cont::arg::Transport< vtkm::cont::arg::TransportTagWholeArrayOut, ContObjectType, Device >::operator()
VTKM_CONT ExecObjectType operator()(ContObjectType &array, const InputDomainType &, vtkm::Id, vtkm::Id, vtkm::cont::Token &token) const
Definition: TransportTagWholeArrayOut.h:63
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::TransportTagWholeArrayOut, ContObjectType, Device >::ValueType
typename ContObjectType::ValueType ValueType
Definition: TransportTagWholeArrayOut.h:57