VTK-m  2.0
BoundingIntervalHierarchy.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_spatialstructure_BoundingIntervalHierarchy_h
11 #define vtk_m_worklet_spatialstructure_BoundingIntervalHierarchy_h
12 
13 #include <type_traits>
14 
15 #include <vtkm/Bounds.h>
16 #include <vtkm/Types.h>
18 #include <vtkm/cont/Algorithm.h>
19 #include <vtkm/cont/ArrayHandle.h>
31 
32 namespace vtkm
33 {
34 namespace worklet
35 {
36 namespace spatialstructure
37 {
38 
39 struct TreeNode
40 {
44 
45  VTKM_EXEC
47  : LMax()
48  , RMin()
49  , Dimension()
50  {
51  }
52 }; // struct TreeNode
53 
55 {
62 
63  VTKM_EXEC
65  : Plane()
66  , NumLeftPoints()
67  , NumRightPoints()
68  , LMax()
69  , RMin()
70  , Cost()
71  {
72  }
73 }; // struct SplitProperties
74 
76 {
77  typedef void ControlSignature(CellSetIn,
78  WholeArrayIn,
84  FieldOutCell);
85  typedef void ExecutionSignature(_1, PointIndices, _2, _3, _4, _5, _6, _7, _8);
86 
87  template <typename CellShape, typename PointIndicesVec, typename PointsPortal>
88  VTKM_EXEC void operator()(CellShape vtkmNotUsed(shape),
89  const PointIndicesVec& pointIndices,
90  const PointsPortal& points,
91  vtkm::Range& rangeX,
92  vtkm::Range& rangeY,
93  vtkm::Range& rangeZ,
94  vtkm::FloatDefault& centerX,
95  vtkm::FloatDefault& centerY,
96  vtkm::FloatDefault& centerZ) const
97  {
98  vtkm::Bounds bounds;
99  vtkm::VecFromPortalPermute<PointIndicesVec, PointsPortal> cellPoints(&pointIndices, points);
100  vtkm::IdComponent numPoints = cellPoints.GetNumberOfComponents();
101  for (vtkm::IdComponent i = 0; i < numPoints; ++i)
102  {
103  bounds.Include(cellPoints[i]);
104  }
105  rangeX = bounds.X;
106  rangeY = bounds.Y;
107  rangeZ = bounds.Z;
108  vtkm::Vec3f center = bounds.Center();
109  centerX = center[0];
110  centerY = center[1];
111  centerZ = center[2];
112  }
113 }; // struct CellRangesExtracter
114 
116 {
117 public:
119  typedef void ExecutionSignature(_1, _2, _3, _4);
120  using InputDomain = _1;
121 
122  VTKM_EXEC
123  void operator()(const vtkm::FloatDefault& value,
124  const vtkm::FloatDefault& planeValue,
125  vtkm::Id& leq,
126  vtkm::Id& r) const
127  {
128  leq = value <= planeValue;
129  r = !leq;
130  }
131 }; // struct LEQWorklet
132 
133 template <bool LEQ>
135 
136 template <>
138 {
139 public:
141  typedef void ExecutionSignature(_1, _2, _3, _4);
142  using InputDomain = _1;
143 
144  VTKM_EXEC
145  void operator()(const vtkm::FloatDefault& value,
146  const vtkm::FloatDefault& planeValue,
147  const vtkm::Range& cellBounds,
148  vtkm::Range& outBounds) const
149  {
150  outBounds = (value <= planeValue) ? cellBounds : vtkm::Range();
151  }
152 }; // struct FilterRanges
153 
154 template <>
156 {
157 public:
159  typedef void ExecutionSignature(_1, _2, _3, _4);
160  using InputDomain = _1;
161 
162  VTKM_EXEC
163  void operator()(const vtkm::FloatDefault& value,
164  const vtkm::FloatDefault& planeValue,
165  const vtkm::Range& cellBounds,
166  vtkm::Range& outBounds) const
167  {
168  outBounds = (value > planeValue) ? cellBounds : vtkm::Range();
169  }
170 }; // struct FilterRanges
171 
173 {
174 public:
176  typedef void ExecutionSignature(_1, _2);
177  using InputDomain = _1;
178 
179  VTKM_CONT
181  : Scale(static_cast<vtkm::FloatDefault>(planeIdx + 1) /
182  static_cast<vtkm::FloatDefault>(numPlanes + 1))
183  {
184  }
185 
186  VTKM_EXEC
187  void operator()(const vtkm::Range& range, vtkm::FloatDefault& splitPlane) const
188  {
189  splitPlane = static_cast<vtkm::FloatDefault>(range.Min + Scale * (range.Max - range.Min));
190  }
191 
193 };
194 
196 {
197 public:
198  typedef void ControlSignature(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, WholeArrayInOut);
199  typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, InputIndex);
200  using InputDomain = _1;
201 
202  VTKM_CONT
204  : Index(index)
205  , Stride(stride)
206  {
207  }
208 
209  template <typename SplitPropertiesPortal>
210  VTKM_EXEC void operator()(const vtkm::Id& pointsToLeft,
211  const vtkm::Id& pointsToRight,
212  const vtkm::Range& lMaxRanges,
213  const vtkm::Range& rMinRanges,
214  const vtkm::FloatDefault& planeValue,
215  SplitPropertiesPortal& splits,
216  vtkm::Id inputIndex) const
217  {
218  SplitProperties split;
219  split.Plane = planeValue;
220  split.NumLeftPoints = pointsToLeft;
221  split.NumRightPoints = pointsToRight;
222  split.LMax = static_cast<vtkm::FloatDefault>(lMaxRanges.Max);
223  split.RMin = static_cast<vtkm::FloatDefault>(rMinRanges.Min);
224  if (lMaxRanges.IsNonEmpty() && rMinRanges.IsNonEmpty())
225  {
226  split.Cost = vtkm::Abs(split.LMax * static_cast<vtkm::FloatDefault>(pointsToLeft) -
227  split.RMin * static_cast<vtkm::FloatDefault>(pointsToRight));
228  }
229  else
230  {
231  split.Cost = vtkm::Infinity<vtkm::FloatDefault>();
232  }
233  splits.Set(inputIndex * Stride + Index, split);
234  //printf("Plane = %lf, NL = %lld, NR = %lld, LM = %lf, RM = %lf, C = %lf\n", split.Plane, split.NumLeftPoints, split.NumRightPoints, split.LMax, split.RMin, split.Cost);
235  }
236 
239 };
240 
242 {
243 public:
244  typedef void ControlSignature(FieldIn,
245  WholeArrayIn,
246  WholeArrayIn,
247  WholeArrayIn,
248  FieldIn,
249  FieldOut,
250  FieldOut,
251  FieldOut);
252  typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8);
253  using InputDomain = _1;
254 
255  VTKM_CONT
257  vtkm::IdComponent maxLeafSize,
258  vtkm::IdComponent stride)
259  : NumPlanes(numPlanes)
260  , MaxLeafSize(maxLeafSize)
261  , Stride(stride)
262  {
263  }
264 
265  template <typename SplitPropertiesPortal>
267  const SplitPropertiesPortal& xSplits,
268  const SplitPropertiesPortal& ySplits,
269  const SplitPropertiesPortal& zSplits,
270  const vtkm::Id& segmentSize,
271  TreeNode& node,
272  vtkm::FloatDefault& plane,
273  vtkm::Id& choice) const
274  {
275  if (segmentSize <= MaxLeafSize)
276  {
277  node.Dimension = -1;
278  choice = 0;
279  return;
280  }
281  choice = 1;
282  using Split = SplitProperties;
283  vtkm::FloatDefault minCost = vtkm::Infinity<vtkm::FloatDefault>();
284  const Split& xSplit = xSplits.Get(ArgMin(xSplits, index * Stride, Stride));
285  bool found = false;
286  if (xSplit.Cost < minCost && xSplit.NumLeftPoints != 0 && xSplit.NumRightPoints != 0)
287  {
288  minCost = xSplit.Cost;
289  node.Dimension = 0;
290  node.LMax = xSplit.LMax;
291  node.RMin = xSplit.RMin;
292  plane = xSplit.Plane;
293  found = true;
294  }
295  const Split& ySplit = ySplits.Get(ArgMin(ySplits, index * Stride, Stride));
296  if (ySplit.Cost < minCost && ySplit.NumLeftPoints != 0 && ySplit.NumRightPoints != 0)
297  {
298  minCost = ySplit.Cost;
299  node.Dimension = 1;
300  node.LMax = ySplit.LMax;
301  node.RMin = ySplit.RMin;
302  plane = ySplit.Plane;
303  found = true;
304  }
305  const Split& zSplit = zSplits.Get(ArgMin(zSplits, index * Stride, Stride));
306  if (zSplit.Cost < minCost && zSplit.NumLeftPoints != 0 && zSplit.NumRightPoints != 0)
307  {
308  minCost = zSplit.Cost;
309  node.Dimension = 2;
310  node.LMax = zSplit.LMax;
311  node.RMin = zSplit.RMin;
312  plane = zSplit.Plane;
313  found = true;
314  }
315  if (!found)
316  {
317  const Split& xMSplit = xSplits.Get(NumPlanes);
318  minCost = xMSplit.Cost;
319  node.Dimension = 0;
320  node.LMax = xMSplit.LMax;
321  node.RMin = xMSplit.RMin;
322  plane = xMSplit.Plane;
323  const Split& yMSplit = ySplits.Get(NumPlanes);
324  if (yMSplit.Cost < minCost && yMSplit.NumLeftPoints != 0 && yMSplit.NumRightPoints != 0)
325  {
326  minCost = yMSplit.Cost;
327  node.Dimension = 1;
328  node.LMax = yMSplit.LMax;
329  node.RMin = yMSplit.RMin;
330  plane = yMSplit.Plane;
331  }
332  const Split& zMSplit = zSplits.Get(NumPlanes);
333  if (zMSplit.Cost < minCost && zMSplit.NumLeftPoints != 0 && zMSplit.NumRightPoints != 0)
334  {
335  minCost = zMSplit.Cost;
336  node.Dimension = 2;
337  node.LMax = zMSplit.LMax;
338  node.RMin = zMSplit.RMin;
339  plane = zMSplit.Plane;
340  }
341  }
342  //printf("Selected plane %lf, with cost %lf [%d, %lf, %lf]\n", plane, minCost, node.Dimension, node.LMax, node.RMin);
343  }
344 
345  template <typename ArrayPortal>
346  VTKM_EXEC vtkm::Id ArgMin(const ArrayPortal& values, vtkm::Id start, vtkm::Id length) const
347  {
348  vtkm::Id minIdx = start;
349  for (vtkm::Id i = start; i < (start + length); ++i)
350  {
351  if (values.Get(i).Cost < values.Get(minIdx).Cost)
352  {
353  minIdx = i;
354  }
355  }
356  return minIdx;
357  }
358 
362 };
363 
365 {
367  typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6);
368  using InputDomain = _1;
369 
370  VTKM_EXEC
372  const vtkm::FloatDefault& y,
373  const vtkm::FloatDefault& z,
374  const TreeNode& split,
375  const vtkm::FloatDefault& plane,
376  vtkm::Id& flag) const
377  {
378  if (split.Dimension >= 0)
379  {
380  const vtkm::Vec3f point(x, y, z);
381  const vtkm::FloatDefault& c = point[split.Dimension];
382  // We use 0 to signify left child, 1 for right child
383  flag = 1 - static_cast<vtkm::Id>(c <= plane);
384  }
385  else
386  {
387  flag = 0;
388  }
389  }
390 }; // struct CalculateSplitDirectionFlag
391 
393 {
395  typedef void ExecutionSignature(_1, _2, _3, _4);
396  using InputDomain = _1;
397 
398  VTKM_CONT
400  : MaxLeafSize(maxLeafSize)
401  {
402  }
403 
404  VTKM_EXEC
405  void operator()(const vtkm::Id& segmentId,
406  const vtkm::Id& leqFlag,
407  const vtkm::Id& segmentSize,
408  vtkm::Id& newSegmentId) const
409  {
410  if (segmentSize <= MaxLeafSize)
411  {
412  // We do not split the segments which have cells fewer than MaxLeafSize, moving them to left
413  newSegmentId = 2 * segmentId;
414  }
415  else
416  {
417  newSegmentId = 2 * segmentId + leqFlag;
418  }
419  }
420 
422 }; // struct SegmentSplitter
423 
425 {
426 public:
428  typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6);
429  using InputDomain = _1;
430 
431  VTKM_EXEC
432  void operator()(const vtkm::Id& leqFlag,
433  const vtkm::Id& trueFlagCount,
434  const vtkm::Id& countPreviousSegment,
435  const vtkm::Id& runningFalseFlagCount,
436  const vtkm::Id& totalFalseFlagCount,
437  vtkm::Id& scatterIndex) const
438  {
439  if (leqFlag)
440  {
441  scatterIndex = countPreviousSegment + totalFalseFlagCount + trueFlagCount;
442  }
443  else
444  {
445  scatterIndex = countPreviousSegment + runningFalseFlagCount - 1;
446  }
447  }
448 }; // struct SplitIndicesCalculator
449 
451 {
452  typedef void ControlSignature(FieldIn, FieldIn, WholeArrayOut);
453  typedef void ExecutionSignature(_1, _2, _3);
454  using InputDomain = _1;
455 
456  template <typename InputType, typename OutputPortalType>
457  VTKM_EXEC void operator()(const InputType& in, const vtkm::Id& idx, OutputPortalType& out) const
458  {
459  out.Set(idx, in);
460  }
461 }; // struct Scatter
462 
463 template <typename ValueArrayHandle, typename IndexArrayHandle>
464 ValueArrayHandle ScatterArray(const ValueArrayHandle& input, const IndexArrayHandle& indices)
465 {
466  ValueArrayHandle output;
467  output.Allocate(input.GetNumberOfValues());
468  vtkm::worklet::DispatcherMapField<Scatter>().Invoke(input, indices, output);
469  return output;
470 }
471 
473 {
475  typedef void ExecutionSignature(_1, _2);
476  using InputDomain = _1;
477 
478  VTKM_CONT
480  : MaxLeafSize(maxLeafSize)
481  {
482  }
483 
484  VTKM_EXEC void operator()(const vtkm::Id& inSegmentSize, vtkm::Id& outSegmentSize) const
485  {
486  if (inSegmentSize <= MaxLeafSize)
487  {
488  outSegmentSize = inSegmentSize;
489  }
490  else
491  {
492  outSegmentSize = 0;
493  }
494  }
495 
497 }; // struct NonSplitIndexCalculator
498 
500 {
501  typedef void ControlSignature(FieldIn nodeIndices,
502  FieldIn segmentSplits,
503  FieldIn nonSplitSegmentIndices,
504  FieldIn segmentSizes,
505  FieldIn runningSplitSegmentCounts,
506  FieldIn parentIndices,
507  WholeArrayInOut newTree,
508  WholeArrayOut nextParentIndices);
509  typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8);
510  using InputDomain = _1;
511 
512  VTKM_CONT
513  TreeLevelAdder(vtkm::Id cellIdsOffset, vtkm::Id treeOffset, vtkm::IdComponent maxLeafSize)
514  : CellIdsOffset(cellIdsOffset)
515  , TreeOffset(treeOffset)
516  , MaxLeafSize(maxLeafSize)
517  {
518  }
519 
520  template <typename BoundingIntervalHierarchyPortal, typename NextParentPortal>
522  const TreeNode& split,
523  vtkm::Id start,
524  vtkm::Id count,
525  vtkm::Id numPreviousSplits,
526  vtkm::Id parentIndex,
527  BoundingIntervalHierarchyPortal& treePortal,
528  NextParentPortal& nextParentPortal) const
529  {
531  node.ParentIndex = parentIndex;
532  if (count > this->MaxLeafSize)
533  {
534  node.Dimension = split.Dimension;
535  node.ChildIndex = this->TreeOffset + 2 * numPreviousSplits;
536  node.Node.LMax = split.LMax;
537  node.Node.RMin = split.RMin;
538  nextParentPortal.Set(2 * numPreviousSplits, index);
539  nextParentPortal.Set(2 * numPreviousSplits + 1, index);
540  }
541  else
542  {
543  node.ChildIndex = -1;
544  node.Leaf.Start = this->CellIdsOffset + start;
545  node.Leaf.Size = count;
546  }
547  treePortal.Set(index, node);
548  }
549 
553 }; // struct TreeLevelAdder
554 
555 template <typename T, class BinaryFunctor>
557  const vtkm::cont::ArrayHandle<T>& values,
558  BinaryFunctor binaryFunctor)
559 {
561  auto reversedResult = vtkm::cont::make_ArrayHandleReverse(result);
562 
565  reversedResult,
566  binaryFunctor);
567 
568  return result;
569 }
570 
571 template <typename T, typename U>
573  const vtkm::cont::ArrayHandle<U>& stencil)
574 {
576  vtkm::cont::Algorithm::CopyIf(input, stencil, result);
577 
578  return result;
579 }
580 
581 VTKM_CONT
582 struct Invert
583 {
584  VTKM_EXEC
585  vtkm::Id operator()(const vtkm::Id& value) const { return 1 - value; }
586 }; // struct Invert
587 
588 VTKM_CONT
589 struct RangeAdd
590 {
591  VTKM_EXEC
592  vtkm::Range operator()(const vtkm::Range& accumulator, const vtkm::Range& value) const
593  {
594  if (value.IsNonEmpty())
595  {
596  return accumulator.Union(value);
597  }
598  else
599  {
600  return accumulator;
601  }
602  }
603 }; // struct RangeAdd
604 
605 } // namespace spatialstructure
606 } // namespace worklet
607 } // namespace vtkm
608 
609 #endif //vtk_m_worklet_spatialstructure_BoundingIntervalHierarchy_h
vtkm::worklet::spatialstructure::Scatter::operator()
VTKM_EXEC void operator()(const InputType &in, const vtkm::Id &idx, OutputPortalType &out) const
Definition: BoundingIntervalHierarchy.h:457
vtkm::exec::CellLocatorBoundingIntervalHierarchyNode
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:28
vtkm::worklet::spatialstructure::SplitProperties::SplitProperties
VTKM_EXEC SplitProperties()
Definition: BoundingIntervalHierarchy.h:64
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:283
ArrayHandle.h
vtkm::Bounds::Center
VTKM_EXEC_CONT vtkm::Vec3f_64 Center() const
Returns the center of the range.
Definition: Bounds.h:147
vtkm::VecFromPortalPermute::GetNumberOfComponents
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
Definition: VecFromPortalPermute.h:47
vtkm::worklet::spatialstructure::TreeLevelAdder
Definition: BoundingIntervalHierarchy.h:499
vtkm::worklet::spatialstructure::FilterRanges< false >::ControlSignature
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:158
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::worklet::spatialstructure::CellRangesExtracter::operator()
VTKM_EXEC void operator()(CellShape vtkmNotUsed(shape), const PointIndicesVec &pointIndices, const PointsPortal &points, vtkm::Range &rangeX, vtkm::Range &rangeY, vtkm::Range &rangeZ, vtkm::FloatDefault &centerX, vtkm::FloatDefault &centerY, vtkm::FloatDefault &centerZ) const
Definition: BoundingIntervalHierarchy.h:88
vtkm::worklet::spatialstructure::CalculateSplitDirectionFlag::operator()
VTKM_EXEC void operator()(const vtkm::FloatDefault &x, const vtkm::FloatDefault &y, const vtkm::FloatDefault &z, const TreeNode &split, const vtkm::FloatDefault &plane, vtkm::Id &flag) const
Definition: BoundingIntervalHierarchy.h:371
vtkm::worklet::spatialstructure::ReverseScanInclusiveByKey
vtkm::cont::ArrayHandle< T > ReverseScanInclusiveByKey(const vtkm::cont::ArrayHandle< T > &keys, const vtkm::cont::ArrayHandle< T > &values, BinaryFunctor binaryFunctor)
Definition: BoundingIntervalHierarchy.h:556
vtkm::worklet::spatialstructure::TreeLevelAdder::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8)
Definition: BoundingIntervalHierarchy.h:509
Types.h
vtkm::worklet::spatialstructure::TreeNode::TreeNode
VTKM_EXEC TreeNode()
Definition: BoundingIntervalHierarchy.h:46
WorkletMapField.h
vtkm::worklet::spatialstructure::SplitProperties::RMin
vtkm::FloatDefault RMin
Definition: BoundingIntervalHierarchy.h:60
vtkm::worklet::WorkletMapField::FieldOut
A control signature tag for output fields.
Definition: WorkletMapField.h:60
vtkm::worklet::spatialstructure::SegmentSplitter::operator()
VTKM_EXEC void operator()(const vtkm::Id &segmentId, const vtkm::Id &leqFlag, const vtkm::Id &segmentSize, vtkm::Id &newSegmentId) const
Definition: BoundingIntervalHierarchy.h:405
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::worklet::spatialstructure::FilterRanges< false >::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4)
Definition: BoundingIntervalHierarchy.h:159
vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::ParentIndex
vtkm::Id ParentIndex
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:35
vtkm::worklet::spatialstructure::SplitIndicesCalculator::ControlSignature
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:427
vtkm::worklet::spatialstructure::NonSplitIndexCalculator::operator()
VTKM_EXEC void operator()(const vtkm::Id &inSegmentSize, vtkm::Id &outSegmentSize) const
Definition: BoundingIntervalHierarchy.h:484
vtkm::worklet::spatialstructure::CellRangesExtracter::ControlSignature
void ControlSignature(CellSetIn, WholeArrayIn, FieldOutCell, FieldOutCell, FieldOutCell, FieldOutCell, FieldOutCell, FieldOutCell)
Definition: BoundingIntervalHierarchy.h:77
vtkm::cont::Algorithm::ScanInclusiveByKey
static VTKM_CONT void ScanInclusiveByKey(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:772
vtkm::worklet::spatialstructure::SegmentSplitter::SegmentSplitter
VTKM_CONT SegmentSplitter(vtkm::IdComponent maxLeafSize)
Definition: BoundingIntervalHierarchy.h:399
ArrayHandleTransform.h
vtkm::worklet::spatialstructure::Invert
Definition: BoundingIntervalHierarchy.h:582
vtkm::worklet::spatialstructure::SplitPlaneCalculatorWorklet::ControlSignature
void ControlSignature(FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:175
vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::Dimension
vtkm::IdComponent Dimension
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:34
vtkm::worklet::spatialstructure::FilterRanges< true >::operator()
VTKM_EXEC void operator()(const vtkm::FloatDefault &value, const vtkm::FloatDefault &planeValue, const vtkm::Range &cellBounds, vtkm::Range &outBounds) const
Definition: BoundingIntervalHierarchy.h:145
ArrayHandleConstant.h
vtkm::worklet::spatialstructure::CalculateSplitDirectionFlag
Definition: BoundingIntervalHierarchy.h:364
vtkm::worklet::spatialstructure::Scatter::ExecutionSignature
void ExecutionSignature(_1, _2, _3)
Definition: BoundingIntervalHierarchy.h:453
vtkm::worklet::spatialstructure::SegmentSplitter::MaxLeafSize
vtkm::IdComponent MaxLeafSize
Definition: BoundingIntervalHierarchy.h:421
vtkm::worklet::spatialstructure::SplitPropertiesCalculator::Index
vtkm::IdComponent Index
Definition: BoundingIntervalHierarchy.h:237
vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::ChildIndex
vtkm::Id ChildIndex
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:36
vtkm::worklet::spatialstructure::SplitProperties::NumRightPoints
vtkm::Id NumRightPoints
Definition: BoundingIntervalHierarchy.h:58
vtkm::worklet::spatialstructure::SplitPlaneCalculatorWorklet::Scale
vtkm::FloatDefault Scale
Definition: BoundingIntervalHierarchy.h:192
vtkm::worklet::spatialstructure::FilterRanges
Definition: BoundingIntervalHierarchy.h:134
vtkm::worklet::spatialstructure::SplitPropertiesCalculator::ControlSignature
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, WholeArrayInOut)
Definition: BoundingIntervalHierarchy.h:198
vtkm::worklet::WorkletVisitCellsWithPoints::PointIndices
IncidentElementIndices PointIndices
Definition: WorkletMapTopology.h:269
vtkm::worklet::spatialstructure::LEQWorklet::operator()
VTKM_EXEC void operator()(const vtkm::FloatDefault &value, const vtkm::FloatDefault &planeValue, vtkm::Id &leq, vtkm::Id &r) const
Definition: BoundingIntervalHierarchy.h:123
vtkm::worklet::spatialstructure::ScatterArray
ValueArrayHandle ScatterArray(const ValueArrayHandle &input, const IndexArrayHandle &indices)
Definition: BoundingIntervalHierarchy.h:464
vtkm::worklet::spatialstructure::SplitPropertiesCalculator::SplitPropertiesCalculator
VTKM_CONT SplitPropertiesCalculator(vtkm::IdComponent index, vtkm::Id stride)
Definition: BoundingIntervalHierarchy.h:203
DeviceAdapterAlgorithm.h
vtkm::worklet::spatialstructure::RangeAdd::operator()
VTKM_EXEC vtkm::Range operator()(const vtkm::Range &accumulator, const vtkm::Range &value) const
Definition: BoundingIntervalHierarchy.h:592
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
VecFromPortalPermute.h
DispatcherMapField.h
vtkm::worklet::spatialstructure::TreeLevelAdder::TreeOffset
vtkm::Id TreeOffset
Definition: BoundingIntervalHierarchy.h:551
vtkm::worklet::spatialstructure::SplitProperties
Definition: BoundingIntervalHierarchy.h:54
vtkm::worklet::spatialstructure::SplitSelector::ArgMin
VTKM_EXEC vtkm::Id ArgMin(const ArrayPortal &values, vtkm::Id start, vtkm::Id length) const
Definition: BoundingIntervalHierarchy.h:346
vtkm::worklet::spatialstructure::CopyIfArray
vtkm::cont::ArrayHandle< T > CopyIfArray(const vtkm::cont::ArrayHandle< T > &input, const vtkm::cont::ArrayHandle< U > &stencil)
Definition: BoundingIntervalHierarchy.h:572
vtkm::worklet::spatialstructure::TreeLevelAdder::ControlSignature
void ControlSignature(FieldIn nodeIndices, FieldIn segmentSplits, FieldIn nonSplitSegmentIndices, FieldIn segmentSizes, FieldIn runningSplitSegmentCounts, FieldIn parentIndices, WholeArrayInOut newTree, WholeArrayOut nextParentIndices)
Definition: BoundingIntervalHierarchy.h:501
vtkm::worklet::spatialstructure::FilterRanges< false >::operator()
VTKM_EXEC void operator()(const vtkm::FloatDefault &value, const vtkm::FloatDefault &planeValue, const vtkm::Range &cellBounds, vtkm::Range &outBounds) const
Definition: BoundingIntervalHierarchy.h:163
vtkm::Bounds::Include
VTKM_EXEC_CONT void Include(const vtkm::Vec< T, 3 > &point)
Expand bounds to include a point.
Definition: Bounds.h:175
Bounds.h
vtkm::worklet::DispatcherMapField
Dispatcher for worklets that inherit from WorkletMapField.
Definition: DispatcherMapField.h:25
vtkm::worklet::spatialstructure::TreeLevelAdder::operator()
VTKM_EXEC void operator()(vtkm::Id index, const TreeNode &split, vtkm::Id start, vtkm::Id count, vtkm::Id numPreviousSplits, vtkm::Id parentIndex, BoundingIntervalHierarchyPortal &treePortal, NextParentPortal &nextParentPortal) const
Definition: BoundingIntervalHierarchy.h:521
vtkm::worklet::spatialstructure::LEQWorklet
Definition: BoundingIntervalHierarchy.h:115
ArrayHandlePermutation.h
Algorithm.h
vtkm::worklet::spatialstructure::RangeAdd
Definition: BoundingIntervalHierarchy.h:589
vtkm::worklet::spatialstructure::TreeNode::RMin
vtkm::FloatDefault RMin
Definition: BoundingIntervalHierarchy.h:42
vtkm::worklet::spatialstructure::SplitIndicesCalculator::operator()
VTKM_EXEC void operator()(const vtkm::Id &leqFlag, const vtkm::Id &trueFlagCount, const vtkm::Id &countPreviousSegment, const vtkm::Id &runningFalseFlagCount, const vtkm::Id &totalFalseFlagCount, vtkm::Id &scatterIndex) const
Definition: BoundingIntervalHierarchy.h:432
vtkm::worklet::spatialstructure::CellRangesExtracter
Definition: BoundingIntervalHierarchy.h:75
vtkm::worklet::WorkletMapField::FieldIn
A control signature tag for input fields.
Definition: WorkletMapField.h:49
DeviceAdapterCuda.h
vtkm::worklet::spatialstructure::SplitPlaneCalculatorWorklet::ExecutionSignature
void ExecutionSignature(_1, _2)
Definition: BoundingIntervalHierarchy.h:176
vtkm::worklet::spatialstructure::SplitSelector::MaxLeafSize
vtkm::IdComponent MaxLeafSize
Definition: BoundingIntervalHierarchy.h:360
vtkm::worklet::spatialstructure::TreeNode
Definition: BoundingIntervalHierarchy.h:39
vtkm::worklet::spatialstructure::NonSplitIndexCalculator
Definition: BoundingIntervalHierarchy.h:472
vtkm::worklet::spatialstructure::SplitSelector::ControlSignature
void ControlSignature(FieldIn, WholeArrayIn, WholeArrayIn, WholeArrayIn, FieldIn, FieldOut, FieldOut, FieldOut)
Definition: BoundingIntervalHierarchy.h:244
vtkm::worklet::WorkletVisitCellsWithPoints
Base class for worklets that map from Points to Cells.
Definition: WorkletMapTopology.h:255
vtkm::worklet::spatialstructure::NonSplitIndexCalculator::MaxLeafSize
vtkm::Id MaxLeafSize
Definition: BoundingIntervalHierarchy.h:496
vtkm::cont::Algorithm::CopyIf
static VTKM_CONT void CopyIf(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:435
vtkm::worklet::spatialstructure::SplitPropertiesCalculator::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4, _5, _6, InputIndex)
Definition: BoundingIntervalHierarchy.h:199
vtkm::Bounds::Z
vtkm::Range Z
Definition: Bounds.h:33
vtkm::worklet::spatialstructure::CalculateSplitDirectionFlag::ControlSignature
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:366
vtkm::worklet::spatialstructure::SplitSelector::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8)
Definition: BoundingIntervalHierarchy.h:252
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::spatialstructure::SplitIndicesCalculator::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4, _5, _6)
Definition: BoundingIntervalHierarchy.h:428
vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::Leaf
struct vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::@1::@4 Leaf
vtkm::Range::IsNonEmpty
VTKM_EXEC_CONT bool IsNonEmpty() const
Determine if the range is valid (i.e.
Definition: Range.h:66
vtkm::worklet::spatialstructure::SplitProperties::Cost
vtkm::FloatDefault Cost
Definition: BoundingIntervalHierarchy.h:61
vtkm::Bounds
Represent an axis-aligned 3D bounds in space.
Definition: Bounds.h:29
vtkmNotUsed
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
vtkm::worklet::spatialstructure::TreeNode::Dimension
vtkm::IdComponent Dimension
Definition: BoundingIntervalHierarchy.h:43
vtkm::worklet::spatialstructure::Invert::operator()
VTKM_EXEC vtkm::Id operator()(const vtkm::Id &value) const
Definition: BoundingIntervalHierarchy.h:585
vtkm::Range::Union
VTKM_EXEC_CONT vtkm::Range Union(const vtkm::Range &otherRange) const
Return the union of this and another range.
Definition: Range.h:150
vtkm::worklet::spatialstructure::SegmentSplitter::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4)
Definition: BoundingIntervalHierarchy.h:395
vtkm::worklet::spatialstructure::Scatter::ControlSignature
void ControlSignature(FieldIn, FieldIn, WholeArrayOut)
Definition: BoundingIntervalHierarchy.h:452
vtkm::worklet::spatialstructure::SplitSelector::SplitSelector
VTKM_CONT SplitSelector(vtkm::IdComponent numPlanes, vtkm::IdComponent maxLeafSize, vtkm::IdComponent stride)
Definition: BoundingIntervalHierarchy.h:256
vtkm::worklet::spatialstructure::SegmentSplitter::ControlSignature
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:394
vtkm::worklet::spatialstructure::SplitProperties::Plane
vtkm::FloatDefault Plane
Definition: BoundingIntervalHierarchy.h:56
vtkm::worklet::spatialstructure::SplitPropertiesCalculator::operator()
VTKM_EXEC void operator()(const vtkm::Id &pointsToLeft, const vtkm::Id &pointsToRight, const vtkm::Range &lMaxRanges, const vtkm::Range &rMinRanges, const vtkm::FloatDefault &planeValue, SplitPropertiesPortal &splits, vtkm::Id inputIndex) const
Definition: BoundingIntervalHierarchy.h:210
vtkm::worklet::spatialstructure::SplitPropertiesCalculator
Definition: BoundingIntervalHierarchy.h:195
vtkm::worklet::spatialstructure::SplitPropertiesCalculator::Stride
vtkm::Id Stride
Definition: BoundingIntervalHierarchy.h:238
vtkm::Vec< vtkm::FloatDefault, 3 >
vtkm::worklet::spatialstructure::LEQWorklet::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4)
Definition: BoundingIntervalHierarchy.h:119
vtkm::worklet::spatialstructure::FilterRanges< true >::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4)
Definition: BoundingIntervalHierarchy.h:141
vtkm::worklet::spatialstructure::FilterRanges< true >::ControlSignature
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:140
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::Range::Min
vtkm::Float64 Min
Definition: Range.h:33
vtkm::worklet::spatialstructure::SplitPlaneCalculatorWorklet
Definition: BoundingIntervalHierarchy.h:172
vtkm::worklet::spatialstructure::SplitPlaneCalculatorWorklet::SplitPlaneCalculatorWorklet
VTKM_CONT SplitPlaneCalculatorWorklet(vtkm::IdComponent planeIdx, vtkm::IdComponent numPlanes)
Definition: BoundingIntervalHierarchy.h:180
vtkm::worklet::spatialstructure::TreeLevelAdder::MaxLeafSize
vtkm::IdComponent MaxLeafSize
Definition: BoundingIntervalHierarchy.h:552
ArrayHandleCounting.h
vtkm::worklet::spatialstructure::CellRangesExtracter::ExecutionSignature
void ExecutionSignature(_1, PointIndices, _2, _3, _4, _5, _6, _7, _8)
Definition: BoundingIntervalHierarchy.h:85
vtkm::Bounds::X
vtkm::Range X
Definition: Bounds.h:31
vtkm::Bounds::Y
vtkm::Range Y
Definition: Bounds.h:32
vtkm::worklet::spatialstructure::SplitProperties::LMax
vtkm::FloatDefault LMax
Definition: BoundingIntervalHierarchy.h:59
vtkm::worklet::spatialstructure::SplitSelector
Definition: BoundingIntervalHierarchy.h:241
vtkm::worklet::spatialstructure::SplitSelector::operator()
VTKM_EXEC void operator()(vtkm::Id index, const SplitPropertiesPortal &xSplits, const SplitPropertiesPortal &ySplits, const SplitPropertiesPortal &zSplits, const vtkm::Id &segmentSize, TreeNode &node, vtkm::FloatDefault &plane, vtkm::Id &choice) const
Definition: BoundingIntervalHierarchy.h:266
vtkm::worklet::spatialstructure::NonSplitIndexCalculator::ControlSignature
void ControlSignature(FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:474
vtkm::worklet::spatialstructure::TreeLevelAdder::CellIdsOffset
vtkm::Id CellIdsOffset
Definition: BoundingIntervalHierarchy.h:550
vtkm::worklet::spatialstructure::LEQWorklet::ControlSignature
void ControlSignature(FieldIn, FieldIn, FieldOut, FieldOut)
Definition: BoundingIntervalHierarchy.h:118
vtkm::worklet::spatialstructure::CalculateSplitDirectionFlag::ExecutionSignature
void ExecutionSignature(_1, _2, _3, _4, _5, _6)
Definition: BoundingIntervalHierarchy.h:367
vtkm::Range::Max
vtkm::Float64 Max
Definition: Range.h:34
vtkm::worklet::spatialstructure::NonSplitIndexCalculator::NonSplitIndexCalculator
VTKM_CONT NonSplitIndexCalculator(vtkm::IdComponent maxLeafSize)
Definition: BoundingIntervalHierarchy.h:479
vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::Node
struct vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::@1::@3 Node
vtkm::Plane
Represent a plane with a base point (origin) and normal vector.
Definition: Geometry.h:25
vtkm::worklet::spatialstructure::SegmentSplitter
Definition: BoundingIntervalHierarchy.h:392
vtkm::worklet::spatialstructure::NonSplitIndexCalculator::ExecutionSignature
void ExecutionSignature(_1, _2)
Definition: BoundingIntervalHierarchy.h:475
vtkm::worklet::spatialstructure::SplitPlaneCalculatorWorklet::operator()
VTKM_EXEC void operator()(const vtkm::Range &range, vtkm::FloatDefault &splitPlane) const
Definition: BoundingIntervalHierarchy.h:187
WorkletMapTopology.h
vtkm::worklet::spatialstructure::TreeNode::LMax
vtkm::FloatDefault LMax
Definition: BoundingIntervalHierarchy.h:41
vtkm::worklet::spatialstructure::TreeLevelAdder::TreeLevelAdder
VTKM_CONT TreeLevelAdder(vtkm::Id cellIdsOffset, vtkm::Id treeOffset, vtkm::IdComponent maxLeafSize)
Definition: BoundingIntervalHierarchy.h:513
ArrayHandleReverse.h
vtkm::cont::make_ArrayHandleReverse
VTKM_CONT ArrayHandleReverse< HandleType > make_ArrayHandleReverse(const HandleType &handle)
make_ArrayHandleReverse is convenience function to generate an ArrayHandleReverse.
Definition: ArrayHandleReverse.h:176
vtkm::worklet::spatialstructure::SplitProperties::NumLeftPoints
vtkm::Id NumLeftPoints
Definition: BoundingIntervalHierarchy.h:57
vtkm::exec::arg::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: InputIndex.h:42
vtkm::worklet::spatialstructure::SplitSelector::NumPlanes
vtkm::IdComponent NumPlanes
Definition: BoundingIntervalHierarchy.h:359
CellLocatorBoundingIntervalHierarchy.h
vtkm::worklet::spatialstructure::SplitIndicesCalculator
Definition: BoundingIntervalHierarchy.h:424
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38
vtkm::worklet::WorkletVisitCellsWithPoints::FieldOutCell
FieldOut FieldOutCell
Definition: WorkletMapTopology.h:263
vtkm::worklet::spatialstructure::Scatter
Definition: BoundingIntervalHierarchy.h:450
vtkm::worklet::spatialstructure::SplitSelector::Stride
vtkm::Id Stride
Definition: BoundingIntervalHierarchy.h:361
vtkm::VecFromPortalPermute
A short vector from an ArrayPortal and a vector of indices.
Definition: VecFromPortalPermute.h:28
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31