VTK-m  2.0
PointMerge.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_worklet_PointMerge_h
11 #define vtk_m_worklet_PointMerge_h
12 
17 #include <vtkm/worklet/Keys.h>
20 
21 #include <vtkm/cont/ArrayCopy.h>
26 #include <vtkm/cont/Invoker.h>
28 
29 #include <vtkm/Bounds.h>
30 #include <vtkm/Hash.h>
31 #include <vtkm/Math.h>
32 #include <vtkm/VectorAnalysis.h>
33 
34 namespace vtkm
35 {
36 namespace worklet
37 {
38 
40 {
41 public:
42  // This class can take point worldCoords as inputs and return the bin index of the enclosing bin.
44  {
47 
48 #ifdef VTKM_USE_64BIT_IDS
49  // IEEE double precision floating point as 53 bits for the significand, so it would not be
50  // possible to represent a number with more precision than that. We also back off a few bits to
51  // avoid potential issues with numerical imprecision in the scaling.
52  static constexpr vtkm::IdComponent BitsPerDimension = 50;
53 #else
54  static constexpr vtkm::IdComponent BitsPerDimension = 31;
55 #endif
56  static constexpr vtkm::Id MaxBinsPerDimension =
57  static_cast<vtkm::Id>((1LL << BitsPerDimension) - 1);
58 
59  public:
61  : Offset(0.0)
62  , Scale(0.0)
63  {
64  }
65 
66  VTKM_CONT
68  {
69  const vtkm::Vec3f_64 boundLengths(
70  bounds.X.Length() + delta, bounds.Y.Length() + delta, bounds.Z.Length() + delta);
71  vtkm::Vec3f_64 binWidths;
72  for (vtkm::IdComponent dimIndex = 0; dimIndex < 3; ++dimIndex)
73  {
74  if (boundLengths[dimIndex] > vtkm::Epsilon64())
75  {
76  vtkm::Float64 minBinWidth = boundLengths[dimIndex] / (MaxBinsPerDimension - 1);
77  if (minBinWidth < (2 * delta))
78  {
79  // We can accurately represent delta with the precision of the bin indices. The bin
80  // size is 2*delta, which means we scale the (offset) point coordinates by 1/delta to
81  // get the bin index.
82  binWidths[dimIndex] = 2.0 * delta;
83  }
84  else
85  {
86  // Scale the (offset) point coordinates by 1/minBinWidth, which will give us bin
87  // indices between 0 and MaxBinsPerDimension - 1.
88  binWidths[dimIndex] = minBinWidth;
89  }
90  }
91  else
92  {
93  // Bounds are essentially 0 in this dimension. The scale does not matter so much.
94  binWidths[dimIndex] = 1.0;
95  }
96  }
97  return binWidths;
98  }
99 
100  // Constructs a BinLocator such that all bins are at least 2*delta large. The bins might be
101  // made larger than that if there would be too many bins for the precision of vtkm::Id.
102  VTKM_CONT
103  BinLocator(const vtkm::Bounds& bounds, vtkm::Float64 delta = 0.0)
104  : Offset(bounds.X.Min, bounds.Y.Min, bounds.Z.Min)
105  {
106  const vtkm::Vec3f_64 binWidths = ComputeBinWidths(bounds, delta);
107  this->Scale = vtkm::Vec3f_64(1.0) / binWidths;
108  }
109 
110  // Shifts the grid by delta in the specified directions. This will allow the bins to cover
111  // neighbors that straddled the boundaries of the original.
112  VTKM_CONT
114  vtkm::Float64 delta,
115  const vtkm::Vec<bool, 3>& directions)
116  {
117  const vtkm::Vec3f_64 binWidths = ComputeBinWidths(bounds, delta);
118  BinLocator shiftedLocator(*this);
119  for (vtkm::IdComponent dimIndex = 0; dimIndex < 3; ++dimIndex)
120  {
121  if (directions[dimIndex])
122  {
123  shiftedLocator.Offset[dimIndex] -= (0.5 * binWidths[dimIndex]);
124  }
125  }
126  return shiftedLocator;
127  }
128 
129  template <typename T>
131  {
132  vtkm::Vec3f_64 relativeCoords = (worldCoords - this->Offset) * this->Scale;
133 
134  return vtkm::Id3(vtkm::Floor(relativeCoords));
135  }
136 
137  // Because this class is a POD, we can reuse it in both control and execution environments.
138 
140  {
141  return *this;
142  }
143 
144  BinLocator PrepareForControl() const { return *this; }
145  };
146 
147  // Converts point coordinates to a hash that represents the bin.
149  {
150  using ControlSignature = void(FieldIn pointCoordinates,
151  ExecObject binLocator,
152  FieldOut hashesOut);
153  using ExecutionSignature = void(_1, _2, _3);
154 
155  template <typename T>
156  VTKM_EXEC void operator()(const vtkm::Vec<T, 3>& coordiantes,
157  const BinLocator binLocator,
158  vtkm::HashType& hashOut) const
159  {
160  vtkm::Id3 binId = binLocator.FindBin(coordiantes);
161  hashOut = vtkm::Hash(binId);
162  }
163  };
164 
166  {
168  bool FastCheck;
169 
170  public:
171  VTKM_CONT
172  FindNeighbors(bool fastCheck = true, vtkm::Float64 delta = vtkm::Epsilon64())
173  : DeltaSquared(delta * delta)
174  , FastCheck(fastCheck)
175  {
176  }
177 
178  using ControlSignature = void(KeysIn keys,
179  ValuesInOut pointIndices,
180  ValuesInOut pointCoordinates,
181  ExecObject binLocator,
182  ValuesOut neighborIndices);
183  using ExecutionSignature = void(_2, _3, _4, _5);
184 
185  template <typename IndexVecInType, typename CoordinateVecInType, typename IndexVecOutType>
186  VTKM_EXEC void operator()(IndexVecInType& pointIndices,
187  CoordinateVecInType& pointCoordinates,
188  const BinLocator& binLocator,
189  IndexVecOutType& neighborIndices) const
190  {
191  // For each point we are going to find all points close enough to be considered neighbors. We
192  // record the neighbors by filling in the same index into neighborIndices. That is, if two
193  // items in neighborIndices have the same value, they should be considered neighbors.
194  // Otherwise, they should not. We will use the "local" index, which refers to index in the
195  // vec-like objects passed into this worklet. This allows us to quickly identify the local
196  // point without sorting through the global indices.
197 
198  using CoordType = typename CoordinateVecInType::ComponentType;
199 
200  vtkm::IdComponent numPoints = pointIndices.GetNumberOfComponents();
201  VTKM_ASSERT(numPoints == pointCoordinates.GetNumberOfComponents());
202  VTKM_ASSERT(numPoints == neighborIndices.GetNumberOfComponents());
203 
204  // Initially, set every point to be its own neighbor.
205  for (vtkm::IdComponent i = 0; i < numPoints; ++i)
206  {
207  neighborIndices[i] = i;
208  }
209 
210  // Iterate over every point and look for neighbors. Only need to look to numPoints-1 since we
211  // only need to check points after the current index (earlier points are already checked).
212  for (vtkm::IdComponent i = 0; i < (numPoints - 1); ++i)
213  {
214  CoordType p0 = pointCoordinates[i];
215  vtkm::Id3 bin0 = binLocator.FindBin(p0);
216 
217  // Check all points after this one. (All those before already checked themselves to this.)
218  for (vtkm::IdComponent j = i + 1; j < numPoints; ++j)
219  {
220  if (neighborIndices[i] == neighborIndices[j])
221  {
222  // We have already identified these points as neighbors. Can skip the check.
223  continue;
224  }
225  CoordType p1 = pointCoordinates[j];
226  vtkm::Id3 bin1 = binLocator.FindBin(p1);
227 
228  // Check to see if these points should be considered neighbors. First, check to make sure
229  // that they are in the same bin. If they are not, then they cannot be neighbors. Next,
230  // check the FastCheck flag. If fast checking is on, then all points in the same bin are
231  // considered neighbors. Otherwise, check that the distance is within the specified
232  // delta. If so, mark them as neighbors.
233  if ((bin0 == bin1) &&
234  (this->FastCheck || (this->DeltaSquared >= vtkm::MagnitudeSquared(p0 - p1))))
235  {
236  // The two points should be merged. But we also might need to merge larger
237  // neighborhoods.
238  if (neighborIndices[j] == j)
239  {
240  // Second point not yet merged into another neighborhood. We can just take it.
241  neighborIndices[j] = neighborIndices[i];
242  }
243  else
244  {
245  // The second point is already part of a neighborhood. Merge the neighborhood with
246  // the largest index into the neighborhood with the smaller index.
247  vtkm::IdComponent neighborhoodToGrow;
248  vtkm::IdComponent neighborhoodToAbsorb;
249  if (neighborIndices[i] < neighborIndices[j])
250  {
251  neighborhoodToGrow = neighborIndices[i];
252  neighborhoodToAbsorb = neighborIndices[j];
253  }
254  else
255  {
256  neighborhoodToGrow = neighborIndices[j];
257  neighborhoodToAbsorb = neighborIndices[i];
258  }
259 
260  // Change all neighborhoodToAbsorb indices to neighborhoodToGrow.
261  for (vtkm::IdComponent k = neighborhoodToAbsorb; k < numPoints; ++k)
262  {
263  if (neighborIndices[k] == neighborhoodToAbsorb)
264  {
265  neighborIndices[k] = neighborhoodToGrow;
266  }
267  }
268  }
269  } // if merge points
270  } // for each p1
271  } // for each p0
272 
273  // We have finished grouping neighbors. neighborIndices contains a unique local index for
274  // each neighbor group. Now find the average (centroid) point coordinates for each group and
275  // write those coordinates back into the coordinates array. Also modify the point indices
276  // so that all indices of a group are the same. (This forms a map from old point indices to
277  // merged point indices.)
278  for (vtkm::IdComponent i = 0; i < numPoints; ++i)
279  {
280  vtkm::IdComponent neighborhood = neighborIndices[i];
281  if (i == neighborhood)
282  {
283  // Found a new group. Find the centroid.
284  CoordType centroid = pointCoordinates[i];
285  vtkm::IdComponent numInGroup = 1;
286  for (vtkm::IdComponent j = i + 1; j < numPoints; ++j)
287  {
288  if (neighborhood == neighborIndices[j])
289  {
290  centroid = centroid + pointCoordinates[j];
291  ++numInGroup;
292  }
293  }
294  centroid = centroid / numInGroup;
295 
296  // Now that we have the centroid, write new point coordinates and index.
297  vtkm::Id groupIndex = pointIndices[i];
298  pointCoordinates[i] = centroid;
299  for (vtkm::IdComponent j = i + 1; j < numPoints; ++j)
300  {
301  if (neighborhood == neighborIndices[j])
302  {
303  pointCoordinates[j] = centroid;
304  pointIndices[j] = groupIndex;
305  }
306  }
307  }
308  }
309  }
310  };
311 
313  {
315  using ExecutionSignature = void(InputIndex, _2);
316 
317  template <typename MapPortalType>
318  VTKM_EXEC void operator()(vtkm::Id newIndex, MapPortalType outputIndices) const
319  {
320  const vtkm::IdComponent numIndices = outputIndices.GetNumberOfComponents();
321  for (vtkm::IdComponent i = 0; i < numIndices; ++i)
322  {
323  outputIndices[i] = newIndex;
324  }
325  }
326  };
327 
328 private:
329  template <typename T>
331  vtkm::Float64 delta, // Distance to consider two points coincident
332  bool fastCheck, // If true, approximate distances are used
333  const BinLocator& binLocator, // Used to find nearby points
334  vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& points, // coordinates, modified to merge close
336  indexNeighborMap) // identifies each neighbor group, updated
337  {
338  vtkm::cont::Invoker invoker;
339 
341  invoker(CoordsToHash(), points, binLocator, hashes);
342 
343  vtkm::worklet::Keys<HashType> keys(hashes);
344 
345  // Really just scratch space
347 
348  invoker(
349  FindNeighbors(fastCheck, delta), keys, indexNeighborMap, points, binLocator, neighborIndices);
350  }
351 
352 public:
353  template <typename T>
355  vtkm::Float64 delta, // Distance to consider two points coincident
356  bool fastCheck, // If true, approximate distances are used
357  const vtkm::Bounds& bounds, // Bounds of points
358  vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& points) // coordinates, modified to merge close
359  {
360  vtkm::cont::Invoker invoker;
361 
362  BinLocator binLocator(bounds, delta);
363 
364  vtkm::cont::ArrayHandle<vtkm::Id> indexNeighborMap;
365  vtkm::cont::ArrayCopy(vtkm::cont::ArrayHandleIndex(points.GetNumberOfValues()),
366  indexNeighborMap);
367 
368  this->RunOneIteration(delta, fastCheck, binLocator, points, indexNeighborMap);
369 
370  if (!fastCheck)
371  {
372  // Run the algorithm again after shifting the bins to capture nearby points that straddled
373  // the previous bins.
374  this->RunOneIteration(delta,
375  fastCheck,
376  binLocator.ShiftBins(bounds, delta, vtkm::make_Vec(true, false, false)),
377  points,
378  indexNeighborMap);
379  this->RunOneIteration(delta,
380  fastCheck,
381  binLocator.ShiftBins(bounds, delta, vtkm::make_Vec(false, true, false)),
382  points,
383  indexNeighborMap);
384  this->RunOneIteration(delta,
385  fastCheck,
386  binLocator.ShiftBins(bounds, delta, vtkm::make_Vec(false, false, true)),
387  points,
388  indexNeighborMap);
389  this->RunOneIteration(delta,
390  fastCheck,
391  binLocator.ShiftBins(bounds, delta, vtkm::make_Vec(true, true, false)),
392  points,
393  indexNeighborMap);
394  this->RunOneIteration(delta,
395  fastCheck,
396  binLocator.ShiftBins(bounds, delta, vtkm::make_Vec(true, false, true)),
397  points,
398  indexNeighborMap);
399  this->RunOneIteration(delta,
400  fastCheck,
401  binLocator.ShiftBins(bounds, delta, vtkm::make_Vec(false, true, true)),
402  points,
403  indexNeighborMap);
404  this->RunOneIteration(delta,
405  fastCheck,
406  binLocator.ShiftBins(bounds, delta, vtkm::make_Vec(true, true, true)),
407  points,
408  indexNeighborMap);
409  }
410 
411  this->MergeKeys = vtkm::worklet::Keys<vtkm::Id>(indexNeighborMap);
412 
414 
415  // Need to pull out the unique point coordiantes
416  vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>> uniquePointCoordinates;
419  uniquePointCoordinates);
420  points = uniquePointCoordinates;
421  }
422 
423  template <typename TL, typename SL>
425  vtkm::Float64 delta, // Distance to consider two points coincident
426  bool fastCheck, // If true, approximate distances are used
427  const vtkm::Bounds& bounds, // Bounds of points
428  vtkm::cont::UncertainArrayHandle<TL, SL>& points) // coordinates, modified to merge close
429  {
430  // Get a cast to a concrete set of point coordiantes so that it can be modified in place
432  vtkm::cont::ArrayCopyShallowIfPossible(points, concretePoints);
433 
434  Run(delta, fastCheck, bounds, concretePoints);
435 
436  // Make sure that the modified points are reflected back in the variant array.
437  points = concretePoints;
438  }
439 
440  VTKM_CONT void Run(vtkm::Float64 delta, // Distance to consider two points coincident
441  bool fastCheck, // If true, approximate distances are used
442  const vtkm::Bounds& bounds, // Bounds of points
443  vtkm::cont::UnknownArrayHandle& points) // coordinates, modified to merge close
444  {
445  // Get a cast to a concrete set of point coordiantes so that it can be modified in place
447  vtkm::cont::ArrayCopyShallowIfPossible(points, concretePoints);
448 
449  Run(delta, fastCheck, bounds, concretePoints);
450 
451  // Make sure that the modified points are reflected back in the variant array.
452  points = concretePoints;
453  }
454 
455  template <typename ShapeStorage, typename ConnectivityStorage, typename OffsetsStorage>
456  VTKM_CONT
459  inCellSet) const
460  {
462  inCellSet, this->PointInputToOutputMap, this->MergeKeys.GetInputRange());
463  }
464 
465 private:
467  {
468  template <typename T, typename S>
471  const PointMerge& self) const
472  {
474  self.MapPointField(inArray, outArray);
475  outHolder = vtkm::cont::UnknownArrayHandle(outArray);
476  }
477  };
478 
479 public:
480  template <typename InArrayHandle, typename OutArrayHandle>
481  VTKM_CONT void MapPointField(const InArrayHandle& inArray, OutArrayHandle& outArray) const
482  {
483  vtkm::worklet::AverageByKey::Run(this->MergeKeys, inArray, outArray);
484  }
485 
486  template <typename T, typename S>
488  const vtkm::cont::ArrayHandle<T, S>& inArray) const
489  {
491  this->MapPointField(inArray, outArray);
492 
493  return outArray;
494  }
495 
496  template <typename TL, typename SL>
498  const vtkm::cont::UncertainArrayHandle<TL, SL>& inArray) const
499  {
501  vtkm::cont::CastAndCall(inArray, MapPointFieldFunctor{}, outArray, *this);
502  return outArray;
503  }
504 
506 
507 private:
510 };
511 }
512 } // namespace vtkm::worklet
513 
514 #endif //vtk_m_worklet_PointMerge_h
vtkm::worklet::PointMerge::BuildPointInputToOutputMap::ExecutionSignature
void(InputIndex, _2) ExecutionSignature
Definition: PointMerge.h:315
vtkm::worklet::PointMerge::BinLocator::ShiftBins
VTKM_CONT BinLocator ShiftBins(const vtkm::Bounds &bounds, vtkm::Float64 delta, const vtkm::Vec< bool, 3 > &directions)
Definition: PointMerge.h:113
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:283
vtkm::Hash
VTKM_EXEC_CONT vtkm::HashType Hash(const InVecType &inVec)
Returns a 32-bit hash on a group of integer-type values.
Definition: Hash.h:106
vtkm::worklet::PointMerge::CoordsToHash
Definition: PointMerge.h:148
vtkm::MagnitudeSquared
VTKM_EXEC_CONT detail::FloatingPointReturnType< T >::Type MagnitudeSquared(const T &x)
Returns the square of the magnitude of a vector.
Definition: VectorAnalysis.h:64
vtkm::worklet::PointMerge::FindNeighbors::operator()
VTKM_EXEC void operator()(IndexVecInType &pointIndices, CoordinateVecInType &pointCoordinates, const BinLocator &binLocator, IndexVecOutType &neighborIndices) const
Definition: PointMerge.h:186
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
WorkletMapField.h
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
CellSetExplicit.h
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::worklet::PointMerge::RunOneIteration
static VTKM_CONT void RunOneIteration(vtkm::Float64 delta, bool fastCheck, const BinLocator &binLocator, vtkm::cont::ArrayHandle< vtkm::Vec< T, 3 >> &points, const vtkm::cont::ArrayHandle< vtkm::Id > &indexNeighborMap)
Definition: PointMerge.h:330
vtkm::worklet::WorkletMapField::FieldOut
A control signature tag for output fields.
Definition: WorkletMapField.h:60
vtkm::worklet::PointMerge::BinLocator::MaxBinsPerDimension
static constexpr vtkm::Id MaxBinsPerDimension
Definition: PointMerge.h:56
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::worklet::RemoveUnusedPoints::MapCellSet
VTKM_CONT vtkm::cont::CellSetExplicit< ShapeStorage, VTKM_DEFAULT_CONNECTIVITY_STORAGE_TAG, OffsetsStorage > MapCellSet(const vtkm::cont::CellSetExplicit< ShapeStorage, ConnectivityStorage, OffsetsStorage > &inCellSet) const
Map cell indices.
Definition: RemoveUnusedPoints.h:128
vtkm::worklet::PointMerge::FindNeighbors
Definition: PointMerge.h:165
vtkm::cont::ArrayCopyShallowIfPossible
VTKM_CONT void ArrayCopyShallowIfPossible(const vtkm::cont::UnknownArrayHandle source, vtkm::cont::ArrayHandle< T, S > &destination)
Copies from an unknown to a known array type.
Definition: ArrayCopy.h:182
vtkm::worklet::PointMerge::BinLocator::Offset
vtkm::Vec3f_64 Offset
Definition: PointMerge.h:45
RemoveUnusedPoints.h
vtkm::cont::UnknownArrayHandle
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:406
Keys.h
vtkm::worklet::PointMerge::BinLocator::FindBin
VTKM_EXEC_CONT vtkm::Id3 FindBin(const vtkm::Vec< T, 3 > &worldCoords) const
Definition: PointMerge.h:130
vtkm::worklet::WorkletReduceByKey::ValuesOut
A control signature tag for output values.
Definition: WorkletReduceByKey.h:102
vtkm::worklet::PointMerge::CoordsToHash::ExecutionSignature
void(_1, _2, _3) ExecutionSignature
Definition: PointMerge.h:153
vtkm::worklet::PointMerge::BinLocator
Definition: PointMerge.h:43
vtkm::worklet::PointMerge::MapPointField
VTKM_CONT vtkm::cont::UncertainArrayHandle< TL, SL > MapPointField(const vtkm::cont::UncertainArrayHandle< TL, SL > &inArray) const
Definition: PointMerge.h:497
vtkm::worklet::PointMerge::CoordsToHash::ControlSignature
void(FieldIn pointCoordinates, ExecObject binLocator, FieldOut hashesOut) ControlSignature
Definition: PointMerge.h:152
vtkm::worklet::PointMerge::CoordsToHash::operator()
VTKM_EXEC void operator()(const vtkm::Vec< T, 3 > &coordiantes, const BinLocator binLocator, vtkm::HashType &hashOut) const
Definition: PointMerge.h:156
Invoker.h
vtkm::worklet::AverageByKey::Run
static VTKM_CONT void Run(const vtkm::worklet::internal::KeysBase &keys, const InArrayType &inValues, const OutArrayType &outAverages)
Compute average values based on a set of Keys.
Definition: AverageByKey.h:63
vtkm::worklet::PointMerge::FindNeighbors::FastCheck
bool FastCheck
Definition: PointMerge.h:168
vtkm::cont::CastAndCall
void CastAndCall(const DynamicObject &dynamicObject, Functor &&f, Args &&... args)
A Generic interface to CastAndCall.
Definition: CastAndCall.h:47
vtkm::HashType
vtkm::UInt32 HashType
Definition: Hash.h:20
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::worklet::PointMerge::MapPointField
VTKM_CONT void MapPointField(const InArrayHandle &inArray, OutArrayHandle &outArray) const
Definition: PointMerge.h:481
AverageByKey.h
ArrayCopy.h
DispatcherMapField.h
vtkm::cont::ExecutionAndControlObjectBase
Base ExecutionAndControlObjectBase class.
Definition: ExecutionAndControlObjectBase.h:28
VectorAnalysis.h
vtkm::Floor
VTKM_EXEC_CONT vtkm::Float32 Floor(vtkm::Float32 x)
Round x to the largest integer value not greater than x.
Definition: Math.h:2204
vtkm::worklet::PointMerge::MapPointFieldFunctor
Definition: PointMerge.h:466
vtkm::Range::Length
VTKM_EXEC_CONT vtkm::Float64 Length() const
Returns the length of the range.
Definition: Range.h:87
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::Vec3f_64
vtkm::Vec< vtkm::Float64, 3 > Vec3f_64
Vec3f_64 corresponds to a 3-dimensional vector of 64-bit floating point values.
Definition: Types.h:1026
vtkm::worklet::PointMerge::FindNeighbors::FindNeighbors
VTKM_CONT FindNeighbors(bool fastCheck=true, vtkm::Float64 delta=vtkm::Epsilon64())
Definition: PointMerge.h:172
X
#define X
Definition: ClipTables.h:2430
UnknownArrayHandle.h
Bounds.h
WorkletReduceByKey.h
Math.h
ArrayHandlePermutation.h
vtkm::worklet::PointMerge::Run
VTKM_CONT void Run(vtkm::Float64 delta, bool fastCheck, const vtkm::Bounds &bounds, vtkm::cont::UnknownArrayHandle &points)
Definition: PointMerge.h:440
vtkm::worklet::WorkletMapField::FieldIn
A control signature tag for input fields.
Definition: WorkletMapField.h:49
ArrayHandleIndex.h
vtkm::worklet::WorkletReduceByKey
Definition: WorkletReduceByKey.h:42
vtkm::worklet::PointMerge::FindNeighbors::DeltaSquared
vtkm::Float64 DeltaSquared
Definition: PointMerge.h:167
vtkm::cont::Invoker
Allows launching any worklet without a dispatcher.
Definition: Invoker.h:41
vtkm::cont::ArrayCopy
void ArrayCopy(const SourceArrayType &source, DestArrayType &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopy.h:142
ExecutionAndControlObjectBase.h
vtkm::worklet::PointMerge::BuildPointInputToOutputMap::operator()
VTKM_EXEC void operator()(vtkm::Id newIndex, MapPortalType outputIndices) const
Definition: PointMerge.h:318
vtkm::worklet::PointMerge::MergeKeys
vtkm::worklet::Keys< vtkm::Id > MergeKeys
Definition: PointMerge.h:508
vtkm::Bounds::Z
vtkm::Range Z
Definition: Bounds.h:33
vtkm::worklet::PointMerge::MapCellSet
VTKM_CONT vtkm::cont::CellSetExplicit< ShapeStorage, VTKM_DEFAULT_CONNECTIVITY_STORAGE_TAG, OffsetsStorage > MapCellSet(const vtkm::cont::CellSetExplicit< ShapeStorage, ConnectivityStorage, OffsetsStorage > &inCellSet) const
Definition: PointMerge.h:458
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::WorkletReduceByKey::KeysIn
A control signature tag for input keys.
Definition: WorkletReduceByKey.h:56
vtkm::worklet::PointMerge::BinLocator::PrepareForControl
BinLocator PrepareForControl() const
Definition: PointMerge.h:144
vtkm::worklet::Keys::GetUniqueKeys
VTKM_CONT KeyArrayHandleType GetUniqueKeys() const
Definition: Keys.h:175
vtkm::Bounds
Represent an axis-aligned 3D bounds in space.
Definition: Bounds.h:29
vtkm::make_Vec
constexpr VTKM_EXEC_CONT vtkm::Vec< T, vtkm::IdComponent(sizeof...(Ts)+1)> make_Vec(T value0, Ts &&... args)
Initializes and returns a Vec containing all the arguments.
Definition: Types.h:1212
vtkm::worklet::PointMerge::BinLocator::BinLocator
VTKM_CONT BinLocator()
Definition: PointMerge.h:60
vtkm::Id3
vtkm::Vec< vtkm::Id, 3 > Id3
Id3 corresponds to a 3-dimensional index for 3d arrays.
Definition: Types.h:1003
vtkm::worklet::PointMerge::MapPointField
VTKM_CONT vtkm::cont::ArrayHandle< T > MapPointField(const vtkm::cont::ArrayHandle< T, S > &inArray) const
Definition: PointMerge.h:487
DispatcherReduceByKey.h
vtkm::worklet::PointMerge::BinLocator::BitsPerDimension
static constexpr vtkm::IdComponent BitsPerDimension
Definition: PointMerge.h:54
vtkm::worklet::PointMerge::MapPointFieldFunctor::operator()
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle< T, S > &inArray, vtkm::cont::UnknownArrayHandle &outHolder, const PointMerge &self) const
Definition: PointMerge.h:469
vtkm::cont::make_ArrayHandlePermutation
VTKM_CONT vtkm::cont::ArrayHandlePermutation< IndexArrayHandleType, ValueArrayHandleType > make_ArrayHandlePermutation(IndexArrayHandleType indexArray, ValueArrayHandleType valueArray)
make_ArrayHandleTransform is convenience function to generate an ArrayHandleTransform.
Definition: ArrayHandlePermutation.h:279
vtkm::cont::DeviceAdapterId
Definition: DeviceAdapterTag.h:52
vtkm::worklet::PointMerge::BuildPointInputToOutputMap
Definition: PointMerge.h:312
vtkm::Vec< T, 3 >
Definition: Types.h:975
vtkm::Vec< vtkm::Float64, 3 >
vtkm::cont::UncertainArrayHandle
An ArrayHandle of an uncertain value type and storage.
Definition: UncertainArrayHandle.h:39
vtkm::cont::CellSetExplicit
Definition: CastAndCall.h:36
vtkm::worklet::Keys
Manage keys for a WorkletReduceByKey.
Definition: Keys.h:131
vtkm::worklet::PointMerge
Definition: PointMerge.h:39
vtkm::Float64
double Float64
Definition: Types.h:155
vtkm::Bounds::X
vtkm::Range X
Definition: Bounds.h:31
vtkm::Bounds::Y
vtkm::Range Y
Definition: Bounds.h:32
vtkm::worklet::PointMerge::BinLocator::ComputeBinWidths
static VTKM_CONT vtkm::Vec3f_64 ComputeBinWidths(const vtkm::Bounds &bounds, vtkm::Float64 delta)
Definition: PointMerge.h:67
vtkm::worklet::PointMerge::GetMergeKeys
vtkm::worklet::Keys< vtkm::Id > GetMergeKeys() const
Definition: PointMerge.h:505
vtkm::worklet::PointMerge::Run
VTKM_CONT void Run(vtkm::Float64 delta, bool fastCheck, const vtkm::Bounds &bounds, vtkm::cont::ArrayHandle< vtkm::Vec< T, 3 >> &points)
Definition: PointMerge.h:354
vtkm::worklet::PointMerge::BinLocator::PrepareForExecution
BinLocator PrepareForExecution(vtkm::cont::DeviceAdapterId, vtkm::cont::Token &) const
Definition: PointMerge.h:139
vtkm::worklet::PointMerge::FindNeighbors::ExecutionSignature
void(_2, _3, _4, _5) ExecutionSignature
Definition: PointMerge.h:183
Hash.h
vtkm::worklet::PointMerge::Run
VTKM_CONT void Run(vtkm::Float64 delta, bool fastCheck, const vtkm::Bounds &bounds, vtkm::cont::UncertainArrayHandle< TL, SL > &points)
Definition: PointMerge.h:424
vtkm::exec::arg::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: InputIndex.h:42
vtkm::worklet::PointMerge::BuildPointInputToOutputMap::ControlSignature
void(KeysIn, ValuesOut PointInputToOutputMap) ControlSignature
Definition: PointMerge.h:314
vtkm::worklet::PointMerge::PointInputToOutputMap
vtkm::cont::ArrayHandle< vtkm::Id > PointInputToOutputMap
Definition: PointMerge.h:509
vtkm::worklet::PointMerge::BinLocator::Scale
vtkm::Vec3f_64 Scale
Definition: PointMerge.h:46
vtkm::cont::ArrayHandleIndex
An implicit array handle containing the its own indices.
Definition: ArrayHandleIndex.h:54
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38
vtkm::worklet::PointMerge::BinLocator::BinLocator
VTKM_CONT BinLocator(const vtkm::Bounds &bounds, vtkm::Float64 delta=0.0)
Definition: PointMerge.h:103
vtkm::worklet::PointMerge::FindNeighbors::ControlSignature
void(KeysIn keys, ValuesInOut pointIndices, ValuesInOut pointCoordinates, ExecObject binLocator, ValuesOut neighborIndices) ControlSignature
Definition: PointMerge.h:182