VTK-m  2.0
FetchTagArrayDirectOutArrayHandleGroupVecVariable.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_exec_arg_FetchTagArrayDirectOutArrayHandleGroupVecVariable_h
11 #define vtk_m_exec_arg_FetchTagArrayDirectOutArrayHandleGroupVecVariable_h
12 
14 
15 // We need to override the fetch for output fields using
16 // ArrayPortalGroupVecVariable because this portal does not behave like most
17 // ArrayPortals. Usually you ignore the Load and implement the Store. But if
18 // you ignore the Load, the VecFromPortal gets no portal to set values into.
19 // Instead, you need to implement the Load to point to the array portal. You
20 // can also ignore the Store because the data is already set in the array at
21 // that point.
22 
23 // This file is included from ArrayHandleGroupVecVariable.h
24 
25 namespace vtkm
26 {
27 namespace exec
28 {
29 namespace arg
30 {
31 
32 // We need to override the fetch for output fields using
33 // ArrayPortalGroupVecVariable because this portal does not behave like most
34 // ArrayPortals. Usually you ignore the Load and implement the Store. But if
35 // you ignore the Load, the VecFromPortal gets no portal to set values into.
36 // Instead, you need to implement the Load to point to the array portal. You
37 // can also ignore the Store because the data is already set in the array at
38 // that point.
39 template <typename ComponentsPortalType, typename OffsetsPortalType>
40 struct Fetch<vtkm::exec::arg::FetchTagArrayDirectOut,
42  vtkm::internal::ArrayPortalGroupVecVariable<ComponentsPortalType, OffsetsPortalType>>
43 {
44  using ExecObjectType =
45  vtkm::internal::ArrayPortalGroupVecVariable<ComponentsPortalType, OffsetsPortalType>;
46  using ValueType = typename ExecObjectType::ValueType;
47 
49  template <typename ThreadIndicesType>
50  VTKM_EXEC ValueType Load(const ThreadIndicesType& indices,
51  const ExecObjectType& arrayPortal) const
52  {
53  return arrayPortal.Get(indices.GetOutputIndex());
54  }
55 
57  template <typename ThreadIndicesType>
58  VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
59  {
60  // We can actually ignore this because the VecFromPortal will already have
61  // set new values in the array.
62  }
63 };
64 
65 }
66 }
67 } // namespace vtkm::exec::arg
68 
69 #endif //vtk_m_exec_arg_FetchTagArrayDirectOutArrayHandleGroupVecVariable_h
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::exec::arg::Fetch::Load
VTKM_EXEC ValueType Load(const ThreadIndicesType &indices, const ExecObjectType &execObject) const
Load data for a work instance.
vtkm::exec::arg::Fetch::ValueType
typename ExecObjectType::ValueType ValueType
The type of value to load and store.
Definition: Fetch.h:58
vtkm::exec::arg::Fetch::Store
VTKM_EXEC void Store(const ThreadIndicesType &indices, const ExecObjectType &execObject, const ValueType &value) const
Store data from a work instance.
FetchTagArrayDirectOut.h
vtkm::exec::arg::AspectTagDefault
Aspect tag to use for default load/store of data.
Definition: AspectTagDefault.h:22
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53