VTK-m  2.0
FlyingEdgesPass4.h
Go to the documentation of this file.
1 
2 //============================================================================
3 // Copyright (c) Kitware, Inc.
4 // All rights reserved.
5 // See LICENSE.txt for details.
6 //
7 // This software is distributed WITHOUT ANY WARRANTY; without even
8 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9 // PURPOSE. See the above copyright notice for more information.
10 //============================================================================
11 
12 
13 #ifndef vtk_m_worklet_contour_flyingedges_pass4_h
14 #define vtk_m_worklet_contour_flyingedges_pass4_h
15 
20 
21 namespace vtkm
22 {
23 namespace worklet
24 {
25 namespace flying_edges
26 {
27 
29 {
33 
36 
38  const vtkm::Vec3f& origin,
39  const vtkm::Vec3f& spacing,
40  vtkm::Id multiContourCellOffset,
41  vtkm::Id multiContourPointOffset)
42  : PointDims(pdims)
43  , Origin(origin)
44  , Spacing(spacing)
45  , CellWriteOffset(multiContourCellOffset)
46  , PointWriteOffset(multiContourPointOffset)
47  {
48  }
49 
50  template <typename DeviceAdapterTag,
51  typename T,
52  typename StorageTagField,
53  typename MeshSums,
54  typename PointType,
55  typename NormalType>
56  VTKM_CONT bool LaunchXAxis(DeviceAdapterTag device,
57  vtkm::Id vtkmNotUsed(newPointSize),
58  T isoval,
61  vtkm::cont::CellSetStructured<2>& metaDataMesh2D,
62  const MeshSums& metaDataSums,
63  const vtkm::cont::ArrayHandle<vtkm::Id>& metaDataMin,
64  const vtkm::cont::ArrayHandle<vtkm::Id>& metaDataMax,
65  const vtkm::cont::ArrayHandle<vtkm::Int32>& metaDataNumTris,
67  vtkm::cont::ArrayHandle<vtkm::Id>& triangle_topology,
68  PointType& points,
69  NormalType& normals) const
70  {
71  vtkm::cont::Invoker invoke(device);
72  if (sharedState.GenerateNormals)
73  {
74  ComputePass4XWithNormals<T> worklet4(isoval,
75  this->PointDims,
76  this->Origin,
77  this->Spacing,
78  this->CellWriteOffset,
79  this->PointWriteOffset);
80  invoke(worklet4,
81  metaDataMesh2D,
82  metaDataSums,
83  metaDataMin,
84  metaDataMax,
85  metaDataNumTris,
86  edgeCases,
87  inputField,
88  triangle_topology,
89  sharedState.InterpolationEdgeIds,
90  sharedState.InterpolationWeights,
91  sharedState.CellIdMap,
92  points,
93  normals);
94  }
95  else
96  {
97  ComputePass4X<T> worklet4(isoval,
98  this->PointDims,
99  this->Origin,
100  this->Spacing,
101  this->CellWriteOffset,
102  this->PointWriteOffset);
103  invoke(worklet4,
104  metaDataMesh2D,
105  metaDataSums,
106  metaDataMin,
107  metaDataMax,
108  metaDataNumTris,
109  edgeCases,
110  inputField,
111  triangle_topology,
112  sharedState.InterpolationEdgeIds,
113  sharedState.InterpolationWeights,
114  sharedState.CellIdMap,
115  points);
116  }
117 
118  return true;
119  }
120 
121  template <typename DeviceAdapterTag,
122  typename T,
123  typename StorageTagField,
124  typename MeshSums,
125  typename PointType,
126  typename NormalType>
127  VTKM_CONT bool LaunchYAxis(DeviceAdapterTag device,
128  vtkm::Id newPointSize,
129  T isoval,
132  vtkm::cont::CellSetStructured<2>& metaDataMesh2D,
133  const MeshSums& metaDataSums,
134  const vtkm::cont::ArrayHandle<vtkm::Id>& metaDataMin,
135  const vtkm::cont::ArrayHandle<vtkm::Id>& metaDataMax,
136  const vtkm::cont::ArrayHandle<vtkm::Int32>& metaDataNumTris,
138  vtkm::cont::ArrayHandle<vtkm::Id>& triangle_topology,
139  PointType& points,
140  NormalType& normals) const
141  {
142  vtkm::cont::Invoker invoke(device);
143 
144  ComputePass4Y<T> worklet4(
145  isoval, this->PointDims, this->CellWriteOffset, this->PointWriteOffset);
146  invoke(worklet4,
147  metaDataMesh2D,
148  metaDataSums,
149  metaDataMin,
150  metaDataMax,
151  metaDataNumTris,
152  edgeCases,
153  inputField,
154  triangle_topology,
155  sharedState.InterpolationEdgeIds,
156  sharedState.InterpolationWeights,
157  sharedState.CellIdMap);
158 
159  //This needs to be done on array handle view ( start = this->PointWriteOffset, len = newPointSize)
160  ComputePass5Y<T> worklet5(this->PointDims,
161  this->Origin,
162  this->Spacing,
163  this->PointWriteOffset,
164  sharedState.GenerateNormals);
165  invoke(worklet5,
167  sharedState.InterpolationEdgeIds, this->PointWriteOffset, newPointSize),
169  sharedState.InterpolationWeights, this->PointWriteOffset, newPointSize),
170  vtkm::cont::make_ArrayHandleView(points, this->PointWriteOffset, newPointSize),
171  inputField,
172  normals);
173 
174  return true;
175  }
176 
177  template <typename DeviceAdapterTag, typename... Args>
178  VTKM_CONT bool operator()(DeviceAdapterTag device, Args&&... args) const
179  {
180  return this->LaunchXAxis(device, std::forward<Args>(args)...);
181  }
182 
183  template <typename... Args>
184  VTKM_CONT bool operator()(vtkm::cont::DeviceAdapterTagCuda device, Args&&... args) const
185  {
186  return this->LaunchYAxis(device, std::forward<Args>(args)...);
187  }
188 
189  template <typename... Args>
190  VTKM_CONT bool operator()(vtkm::cont::DeviceAdapterTagKokkos device, Args&&... args) const
191  {
192  return this->LaunchYAxis(device, std::forward<Args>(args)...);
193  }
194 };
195 }
196 }
197 }
198 #endif
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:283
FlyingEdgesPass4Y.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::make_ArrayHandleView
ArrayHandleView< ArrayHandleType > make_ArrayHandleView(const ArrayHandleType &array, vtkm::Id startIndex, vtkm::Id numValues)
Definition: ArrayHandleView.h:222
vtkm::worklet::contour::CommonState::InterpolationWeights
vtkm::cont::ArrayHandle< vtkm::FloatDefault > InterpolationWeights
Definition: CommonState.h:33
vtkm::cont::CellSetStructured
Definition: CastAndCall.h:32
vtkm::worklet::flying_edges::launchComputePass4
Definition: FlyingEdgesPass4.h:28
vtkm::worklet::flying_edges::launchComputePass4::operator()
VTKM_CONT bool operator()(DeviceAdapterTag device, Args &&... args) const
Definition: FlyingEdgesPass4.h:178
vtkm::worklet::flying_edges::launchComputePass4::LaunchXAxis
VTKM_CONT bool LaunchXAxis(DeviceAdapterTag device, vtkm::Id vtkmNotUsed(newPointSize), T isoval, const vtkm::cont::ArrayHandle< T, StorageTagField > &inputField, vtkm::cont::ArrayHandle< vtkm::UInt8 > edgeCases, vtkm::cont::CellSetStructured< 2 > &metaDataMesh2D, const MeshSums &metaDataSums, const vtkm::cont::ArrayHandle< vtkm::Id > &metaDataMin, const vtkm::cont::ArrayHandle< vtkm::Id > &metaDataMax, const vtkm::cont::ArrayHandle< vtkm::Int32 > &metaDataNumTris, vtkm::worklet::contour::CommonState &sharedState, vtkm::cont::ArrayHandle< vtkm::Id > &triangle_topology, PointType &points, NormalType &normals) const
Definition: FlyingEdgesPass4.h:56
vtkm::worklet::contour::CommonState::GenerateNormals
bool GenerateNormals
Definition: CommonState.h:32
vtkm::worklet::flying_edges::ComputePass4X
Definition: FlyingEdgesPass4X.h:31
vtkm::worklet::flying_edges::ComputePass4XWithNormals
Definition: FlyingEdgesPass4XWithNormals.h:30
FlyingEdgesPass4XWithNormals.h
vtkm::worklet::flying_edges::launchComputePass4::PointWriteOffset
vtkm::Id PointWriteOffset
Definition: FlyingEdgesPass4.h:35
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
FlyingEdgesPass4Common.h
vtkm::worklet::flying_edges::ComputePass5Y
Definition: FlyingEdgesPass4Y.h:277
vtkm::worklet::contour::CommonState
Definition: CommonState.h:24
vtkm::cont::Invoker
Allows launching any worklet without a dispatcher.
Definition: Invoker.h:41
vtkm::worklet::flying_edges::launchComputePass4::Origin
vtkm::Vec3f Origin
Definition: FlyingEdgesPass4.h:31
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::flying_edges::launchComputePass4::PointDims
vtkm::Id3 PointDims
Definition: FlyingEdgesPass4.h:30
vtkmNotUsed
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
vtkm::worklet::flying_edges::launchComputePass4::CellWriteOffset
vtkm::Id CellWriteOffset
Definition: FlyingEdgesPass4.h:34
vtkm::worklet::flying_edges::launchComputePass4::launchComputePass4
launchComputePass4(const vtkm::Id3 &pdims, const vtkm::Vec3f &origin, const vtkm::Vec3f &spacing, vtkm::Id multiContourCellOffset, vtkm::Id multiContourPointOffset)
Definition: FlyingEdgesPass4.h:37
vtkm::Vec< vtkm::Id, 3 >
FlyingEdgesPass4X.h
vtkm::worklet::contour::CommonState::CellIdMap
vtkm::cont::ArrayHandle< vtkm::Id > CellIdMap
Definition: CommonState.h:35
vtkm::worklet::flying_edges::launchComputePass4::operator()
VTKM_CONT bool operator()(vtkm::cont::DeviceAdapterTagCuda device, Args &&... args) const
Definition: FlyingEdgesPass4.h:184
vtkm::worklet::flying_edges::launchComputePass4::operator()
VTKM_CONT bool operator()(vtkm::cont::DeviceAdapterTagKokkos device, Args &&... args) const
Definition: FlyingEdgesPass4.h:190
vtkm::worklet::flying_edges::launchComputePass4::LaunchYAxis
VTKM_CONT bool LaunchYAxis(DeviceAdapterTag device, vtkm::Id newPointSize, T isoval, const vtkm::cont::ArrayHandle< T, StorageTagField > &inputField, vtkm::cont::ArrayHandle< vtkm::UInt8 > edgeCases, vtkm::cont::CellSetStructured< 2 > &metaDataMesh2D, const MeshSums &metaDataSums, const vtkm::cont::ArrayHandle< vtkm::Id > &metaDataMin, const vtkm::cont::ArrayHandle< vtkm::Id > &metaDataMax, const vtkm::cont::ArrayHandle< vtkm::Int32 > &metaDataNumTris, vtkm::worklet::contour::CommonState &sharedState, vtkm::cont::ArrayHandle< vtkm::Id > &triangle_topology, PointType &points, NormalType &normals) const
Definition: FlyingEdgesPass4.h:127
vtkm::worklet::flying_edges::launchComputePass4::Spacing
vtkm::Vec3f Spacing
Definition: FlyingEdgesPass4.h:32
vtkm::worklet::flying_edges::ComputePass4Y
Definition: FlyingEdgesPass4Y.h:32
vtkm::worklet::contour::CommonState::InterpolationEdgeIds
vtkm::cont::ArrayHandle< vtkm::Id2 > InterpolationEdgeIds
Definition: CommonState.h:34