VTK-m  2.2
FetchExtrude.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_FetchExtrude_h
11 #define vtk_m_exec_arg_FetchExtrude_h
12 
16 
18 
19 //optimized fetches for ArrayPortalXGCCoordinates for
20 // - 3D Scheduling
21 // - WorkletNeighboorhood
22 namespace vtkm
23 {
24 namespace exec
25 {
26 namespace arg
27 {
28 
35 {
36 };
37 
38 //Optimized fetch for point ids when iterating the cells ConnectivityExtrude
39 template <typename FetchType, typename ExecObjectType>
40 struct Fetch<FetchType, vtkm::exec::arg::AspectTagIncidentElementIndices, ExecObjectType>
41 {
43  template <typename ScatterAndMaskMode>
46  ScatterAndMaskMode>& indices,
47  const ExecObjectType&) const -> vtkm::Vec<vtkm::Id, 6>
48  {
49  // std::cout << "opimized fetch for point ids" << std::endl;
50  const auto& xgcidx = indices.GetIndicesIncident();
51  const vtkm::Id offset1 = (xgcidx.Planes[0] * xgcidx.NumberOfPointsPerPlane);
52  const vtkm::Id offset2 = (xgcidx.Planes[1] * xgcidx.NumberOfPointsPerPlane);
54  result[0] = offset1 + xgcidx.PointIds[0][0];
55  result[1] = offset1 + xgcidx.PointIds[0][1];
56  result[2] = offset1 + xgcidx.PointIds[0][2];
57  result[3] = offset2 + xgcidx.PointIds[1][0];
58  result[4] = offset2 + xgcidx.PointIds[1][1];
59  result[5] = offset2 + xgcidx.PointIds[1][2];
60  return result;
61  }
62 
64  template <typename ConnectivityType, typename ScatterAndMaskMode>
67  const ExecObjectType&) const -> decltype(indices.GetIndicesIncident())
68  {
69  return indices.GetIndicesIncident();
70  }
71 
72  template <typename ThreadIndicesType, typename ValueType>
73  VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
74  {
75  // Store is a no-op.
76  }
77 };
78 
79 //Optimized fetch for point coordinates when iterating the cells of ConnectivityExtrude
80 template <typename T>
83  vtkm::internal::ArrayPortalXGCCoordinates<T>>
84 
85 {
86  //Optimized fetch for point arrays when iterating the cells ConnectivityExtrude
88  template <typename ScatterAndMaskMode>
89  VTKM_EXEC auto Load(
91  ScatterAndMaskMode>& indices,
92  const vtkm::internal::ArrayPortalXGCCoordinates<T>& portal)
93  -> decltype(portal.GetWedge(indices.GetIndicesIncident()))
94  {
95  return portal.GetWedge(indices.GetIndicesIncident());
96  }
97 
99  template <typename ThreadIndicesType>
100  VTKM_EXEC auto Load(const ThreadIndicesType& indices,
101  const vtkm::internal::ArrayPortalXGCCoordinates<T>& field) const
102  -> decltype(
103  detail::FetchArrayTopologyMapInImplementation<typename ThreadIndicesType::Connectivity,
104  vtkm::internal::ArrayPortalXGCCoordinates<T>,
105  ThreadIndicesType>::Load(indices, field))
106  {
107  using Implementation =
108  detail::FetchArrayTopologyMapInImplementation<typename ThreadIndicesType::Connectivity,
109  vtkm::internal::ArrayPortalXGCCoordinates<T>,
110  ThreadIndicesType>;
111  return Implementation::Load(indices, field);
112  }
113 
114  template <typename ThreadIndicesType, typename ValueType>
115  VTKM_EXEC void Store(const ThreadIndicesType&,
116  const vtkm::internal::ArrayPortalXGCCoordinates<T>&,
117  const ValueType&) const
118  {
119  // Store is a no-op for this fetch.
120  }
121 };
122 
123 //Optimized fetch for point coordinates when iterating the points of ConnectivityExtrude
124 template <typename T>
125 struct Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
127  vtkm::internal::ArrayPortalXGCCoordinates<T>>
128 
129 {
131  template <typename ThreadIndicesType>
132  VTKM_EXEC auto Load(const ThreadIndicesType& indices,
133  const vtkm::internal::ArrayPortalXGCCoordinates<T>& points)
134  -> decltype(points.Get(indices.GetInputIndex()))
135  {
136  // std::cout << "optimized fetch for point coordinates" << std::endl;
137  return points.Get(indices.GetInputIndex());
138  }
139 
141  template <typename ScatterAndMaskMode>
142  VTKM_EXEC auto Load(
144  ScatterAndMaskMode>& indices,
145  const vtkm::internal::ArrayPortalXGCCoordinates<T>& points)
146  -> decltype(points.Get(indices.GetIndexLogical()))
147  {
148  // std::cout << "optimized fetch for point coordinates" << std::endl;
149  return points.Get(indices.GetIndexLogical());
150  }
151 
152  template <typename ThreadIndicesType, typename ValueType>
153  VTKM_EXEC void Store(const ThreadIndicesType&,
154  const vtkm::internal::ArrayPortalXGCCoordinates<T>&,
155  const ValueType&) const
156  {
157  // Store is a no-op for this fetch.
158  }
159 };
160 }
161 }
162 }
163 
164 
165 #endif
vtkm::exec::ReverseConnectivityExtrude
Definition: ConnectivityExtrude.h:95
vtkm::exec::arg::AspectTagIncidentElementIndices
Aspect tag to use for getting the visited indices.
Definition: FetchExtrude.h:34
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::FetchTagArrayTopologyMapIn
Fetch tag for getting array values determined by topology connections.
Definition: FetchTagArrayTopologyMapIn.h:40
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
Class for loading and storing values in thread instance.
Definition: Fetch.h:49
ConnectivityExtrude.h
vtkm::exec::arg::Fetch::Store
void Store(const ThreadIndicesType &indices, const ExecObjectType &execObject, const ValueType &value) const
Store data from a work instance.
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::exec::ConnectivityExtrude
Definition: ConnectivityExtrude.h:26
vtkm::exec::arg::Fetch< FetchType, vtkm::exec::arg::AspectTagIncidentElementIndices, ExecObjectType >::Load
auto Load(const vtkm::exec::arg::ThreadIndicesTopologyMap< ConnectivityType, ScatterAndMaskMode > &indices, const ExecObjectType &) const -> decltype(indices.GetIndicesIncident())
Definition: FetchExtrude.h:65
FetchTagArrayTopologyMapIn.h
FetchTagArrayDirectIn.h
vtkm::Vec
A short fixed-length array.
Definition: Types.h:357
vtkm::exec::arg::Fetch::Load
ValueType Load(const ThreadIndicesType &indices, const ExecObjectType &execObject) const
Load data for a work instance.
vtkm::exec::arg::Fetch< FetchType, vtkm::exec::arg::AspectTagIncidentElementIndices, ExecObjectType >::Load
auto Load(const vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode > &indices, const ExecObjectType &) const -> vtkm::Vec< vtkm::Id, 6 >
Definition: FetchExtrude.h:44
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
vtkm::exec::arg::ThreadIndicesTopologyMap
Container for thread indices in a topology map.
Definition: ThreadIndicesTopologyMap.h:95
ArrayHandleXGCCoordinates.h
vtkm::exec::arg::Fetch< FetchType, vtkm::exec::arg::AspectTagIncidentElementIndices, ExecObjectType >::Store
void Store(const ThreadIndicesType &, const ExecObjectType &, const ValueType &) const
Definition: FetchExtrude.h:73