Go to the documentation of this file.
10 #ifndef vtk_m_worklet_spatialstructure_BoundingIntervalHierarchy_h
11 #define vtk_m_worklet_spatialstructure_BoundingIntervalHierarchy_h
13 #include <type_traits>
36 namespace spatialstructure
87 template <
typename CellShape,
typename Po
intIndicesVec,
typename Po
intsPortal>
89 const PointIndicesVec& pointIndices,
90 const PointsPortal& points,
120 using InputDomain = _1;
128 leq = value <= planeValue;
142 using InputDomain = _1;
150 outBounds = (value <= planeValue) ? cellBounds :
vtkm::Range();
160 using InputDomain = _1;
168 outBounds = (value > planeValue) ? cellBounds :
vtkm::Range();
177 using InputDomain = _1;
200 using InputDomain = _1;
209 template <
typename SplitPropertiesPortal>
215 SplitPropertiesPortal& splits,
219 split.
Plane = planeValue;
231 split.
Cost = vtkm::Infinity<vtkm::FloatDefault>();
253 using InputDomain = _1;
265 template <
typename SplitPropertiesPortal>
267 const SplitPropertiesPortal& xSplits,
268 const SplitPropertiesPortal& ySplits,
269 const SplitPropertiesPortal& zSplits,
286 if (xSplit.Cost < minCost && xSplit.NumLeftPoints != 0 && xSplit.NumRightPoints != 0)
288 minCost = xSplit.Cost;
290 node.
LMax = xSplit.LMax;
291 node.
RMin = xSplit.RMin;
292 plane = xSplit.Plane;
296 if (ySplit.Cost < minCost && ySplit.NumLeftPoints != 0 && ySplit.NumRightPoints != 0)
298 minCost = ySplit.Cost;
300 node.
LMax = ySplit.LMax;
301 node.
RMin = ySplit.RMin;
302 plane = ySplit.Plane;
306 if (zSplit.Cost < minCost && zSplit.NumLeftPoints != 0 && zSplit.NumRightPoints != 0)
308 minCost = zSplit.Cost;
310 node.
LMax = zSplit.LMax;
311 node.
RMin = zSplit.RMin;
312 plane = zSplit.Plane;
317 const Split& xMSplit = xSplits.Get(
NumPlanes);
318 minCost = xMSplit.Cost;
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)
326 minCost = yMSplit.Cost;
328 node.
LMax = yMSplit.LMax;
329 node.
RMin = yMSplit.RMin;
330 plane = yMSplit.Plane;
332 const Split& zMSplit = zSplits.Get(
NumPlanes);
333 if (zMSplit.Cost < minCost && zMSplit.NumLeftPoints != 0 && zMSplit.NumRightPoints != 0)
335 minCost = zMSplit.Cost;
337 node.
LMax = zMSplit.LMax;
338 node.
RMin = zMSplit.RMin;
339 plane = zMSplit.Plane;
345 template <
typename ArrayPortal>
349 for (
vtkm::Id i = start; i < (start + length); ++i)
351 if (values.Get(i).Cost < values.Get(minIdx).Cost)
368 using InputDomain = _1;
383 flag = 1 -
static_cast<vtkm::Id>(c <= plane);
396 using InputDomain = _1;
413 newSegmentId = 2 * segmentId;
417 newSegmentId = 2 * segmentId + leqFlag;
429 using InputDomain = _1;
434 const vtkm::Id& countPreviousSegment,
435 const vtkm::Id& runningFalseFlagCount,
436 const vtkm::Id& totalFalseFlagCount,
441 scatterIndex = countPreviousSegment + totalFalseFlagCount + trueFlagCount;
445 scatterIndex = countPreviousSegment + runningFalseFlagCount - 1;
454 using InputDomain = _1;
456 template <
typename InputType,
typename OutputPortalType>
463 template <
typename ValueArrayHandle,
typename IndexArrayHandle>
464 ValueArrayHandle
ScatterArray(
const ValueArrayHandle& input,
const IndexArrayHandle& indices)
466 ValueArrayHandle output;
467 output.Allocate(input.GetNumberOfValues());
476 using InputDomain = _1;
488 outSegmentSize = inSegmentSize;
503 FieldIn nonSplitSegmentIndices,
505 FieldIn runningSplitSegmentCounts,
507 WholeArrayInOut newTree,
508 WholeArrayOut nextParentIndices);
510 using InputDomain = _1;
520 template <
typename BoundingIntervalHierarchyPortal,
typename NextParentPortal>
527 BoundingIntervalHierarchyPortal& treePortal,
528 NextParentPortal& nextParentPortal)
const
538 nextParentPortal.Set(2 * numPreviousSplits, index);
539 nextParentPortal.Set(2 * numPreviousSplits + 1, index);
545 node.
Leaf.Size = count;
547 treePortal.Set(index, node);
555 template <
typename T,
class BinaryFunctor>
558 BinaryFunctor binaryFunctor)
571 template <
typename T,
typename U>
596 return accumulator.
Union(value);
609 #endif //vtk_m_worklet_spatialstructure_BoundingIntervalHierarchy_h
VTKM_EXEC void operator()(const InputType &in, const vtkm::Id &idx, OutputPortalType &out) const
Definition: BoundingIntervalHierarchy.h:457
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:28
VTKM_EXEC SplitProperties()
Definition: BoundingIntervalHierarchy.h:64
Manages an array-worth of data.
Definition: ArrayHandle.h:283
VTKM_EXEC_CONT vtkm::Vec3f_64 Center() const
Returns the center of the range.
Definition: Bounds.h:147
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
Definition: VecFromPortalPermute.h:47
Definition: BoundingIntervalHierarchy.h:499
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:158
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
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::cont::ArrayHandle< T > ReverseScanInclusiveByKey(const vtkm::cont::ArrayHandle< T > &keys, const vtkm::cont::ArrayHandle< T > &values, BinaryFunctor binaryFunctor)
Definition: BoundingIntervalHierarchy.h:556
void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8)
Definition: BoundingIntervalHierarchy.h:509
VTKM_EXEC TreeNode()
Definition: BoundingIntervalHierarchy.h:46
vtkm::FloatDefault RMin
Definition: BoundingIntervalHierarchy.h:60
A control signature tag for output fields.
Definition: WorkletMapField.h:60
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::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
void ExecutionSignature(_1, _2, _3, _4)
Definition: BoundingIntervalHierarchy.h:159
vtkm::Id ParentIndex
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:35
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:427
VTKM_EXEC void operator()(const vtkm::Id &inSegmentSize, vtkm::Id &outSegmentSize) const
Definition: BoundingIntervalHierarchy.h:484
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_CONT SegmentSplitter(vtkm::IdComponent maxLeafSize)
Definition: BoundingIntervalHierarchy.h:399
Definition: BoundingIntervalHierarchy.h:582
void ControlSignature(FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:175
vtkm::IdComponent Dimension
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:34
VTKM_EXEC void operator()(const vtkm::FloatDefault &value, const vtkm::FloatDefault &planeValue, const vtkm::Range &cellBounds, vtkm::Range &outBounds) const
Definition: BoundingIntervalHierarchy.h:145
Definition: BoundingIntervalHierarchy.h:364
void ExecutionSignature(_1, _2, _3)
Definition: BoundingIntervalHierarchy.h:453
vtkm::IdComponent MaxLeafSize
Definition: BoundingIntervalHierarchy.h:421
vtkm::IdComponent Index
Definition: BoundingIntervalHierarchy.h:237
vtkm::Id ChildIndex
Definition: exec/CellLocatorBoundingIntervalHierarchy.h:36
vtkm::Id NumRightPoints
Definition: BoundingIntervalHierarchy.h:58
vtkm::FloatDefault Scale
Definition: BoundingIntervalHierarchy.h:192
Definition: BoundingIntervalHierarchy.h:134
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, WholeArrayInOut)
Definition: BoundingIntervalHierarchy.h:198
IncidentElementIndices PointIndices
Definition: WorkletMapTopology.h:269
VTKM_EXEC void operator()(const vtkm::FloatDefault &value, const vtkm::FloatDefault &planeValue, vtkm::Id &leq, vtkm::Id &r) const
Definition: BoundingIntervalHierarchy.h:123
ValueArrayHandle ScatterArray(const ValueArrayHandle &input, const IndexArrayHandle &indices)
Definition: BoundingIntervalHierarchy.h:464
VTKM_CONT SplitPropertiesCalculator(vtkm::IdComponent index, vtkm::Id stride)
Definition: BoundingIntervalHierarchy.h:203
VTKM_EXEC vtkm::Range operator()(const vtkm::Range &accumulator, const vtkm::Range &value) const
Definition: BoundingIntervalHierarchy.h:592
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::Id TreeOffset
Definition: BoundingIntervalHierarchy.h:551
Definition: BoundingIntervalHierarchy.h:54
VTKM_EXEC vtkm::Id ArgMin(const ArrayPortal &values, vtkm::Id start, vtkm::Id length) const
Definition: BoundingIntervalHierarchy.h:346
vtkm::cont::ArrayHandle< T > CopyIfArray(const vtkm::cont::ArrayHandle< T > &input, const vtkm::cont::ArrayHandle< U > &stencil)
Definition: BoundingIntervalHierarchy.h:572
void ControlSignature(FieldIn nodeIndices, FieldIn segmentSplits, FieldIn nonSplitSegmentIndices, FieldIn segmentSizes, FieldIn runningSplitSegmentCounts, FieldIn parentIndices, WholeArrayInOut newTree, WholeArrayOut nextParentIndices)
Definition: BoundingIntervalHierarchy.h:501
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_EXEC_CONT void Include(const vtkm::Vec< T, 3 > &point)
Expand bounds to include a point.
Definition: Bounds.h:175
Dispatcher for worklets that inherit from WorkletMapField.
Definition: DispatcherMapField.h:25
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
Definition: BoundingIntervalHierarchy.h:115
Definition: BoundingIntervalHierarchy.h:589
vtkm::FloatDefault RMin
Definition: BoundingIntervalHierarchy.h:42
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
A control signature tag for input fields.
Definition: WorkletMapField.h:49
void ExecutionSignature(_1, _2)
Definition: BoundingIntervalHierarchy.h:176
vtkm::IdComponent MaxLeafSize
Definition: BoundingIntervalHierarchy.h:360
Definition: BoundingIntervalHierarchy.h:39
Definition: BoundingIntervalHierarchy.h:472
void ControlSignature(FieldIn, WholeArrayIn, WholeArrayIn, WholeArrayIn, FieldIn, FieldOut, FieldOut, FieldOut)
Definition: BoundingIntervalHierarchy.h:244
Base class for worklets that map from Points to Cells.
Definition: WorkletMapTopology.h:255
vtkm::Id MaxLeafSize
Definition: BoundingIntervalHierarchy.h:496
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
void ExecutionSignature(_1, _2, _3, _4, _5, _6, InputIndex)
Definition: BoundingIntervalHierarchy.h:199
vtkm::Range Z
Definition: Bounds.h:33
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:366
void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8)
Definition: BoundingIntervalHierarchy.h:252
#define VTKM_CONT
Definition: ExportMacros.h:57
void ExecutionSignature(_1, _2, _3, _4, _5, _6)
Definition: BoundingIntervalHierarchy.h:428
struct vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::@1::@4 Leaf
VTKM_EXEC_CONT bool IsNonEmpty() const
Determine if the range is valid (i.e.
Definition: Range.h:66
vtkm::FloatDefault Cost
Definition: BoundingIntervalHierarchy.h:61
Represent an axis-aligned 3D bounds in space.
Definition: Bounds.h:29
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
vtkm::IdComponent Dimension
Definition: BoundingIntervalHierarchy.h:43
VTKM_EXEC vtkm::Id operator()(const vtkm::Id &value) const
Definition: BoundingIntervalHierarchy.h:585
VTKM_EXEC_CONT vtkm::Range Union(const vtkm::Range &otherRange) const
Return the union of this and another range.
Definition: Range.h:150
void ExecutionSignature(_1, _2, _3, _4)
Definition: BoundingIntervalHierarchy.h:395
void ControlSignature(FieldIn, FieldIn, WholeArrayOut)
Definition: BoundingIntervalHierarchy.h:452
VTKM_CONT SplitSelector(vtkm::IdComponent numPlanes, vtkm::IdComponent maxLeafSize, vtkm::IdComponent stride)
Definition: BoundingIntervalHierarchy.h:256
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:394
vtkm::FloatDefault Plane
Definition: BoundingIntervalHierarchy.h:56
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
Definition: BoundingIntervalHierarchy.h:195
vtkm::Id Stride
Definition: BoundingIntervalHierarchy.h:238
void ExecutionSignature(_1, _2, _3, _4)
Definition: BoundingIntervalHierarchy.h:119
void ExecutionSignature(_1, _2, _3, _4)
Definition: BoundingIntervalHierarchy.h:141
void ControlSignature(FieldIn, FieldIn, FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:140
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::Float64 Min
Definition: Range.h:33
Definition: BoundingIntervalHierarchy.h:172
VTKM_CONT SplitPlaneCalculatorWorklet(vtkm::IdComponent planeIdx, vtkm::IdComponent numPlanes)
Definition: BoundingIntervalHierarchy.h:180
vtkm::IdComponent MaxLeafSize
Definition: BoundingIntervalHierarchy.h:552
vtkm::Range X
Definition: Bounds.h:31
vtkm::Range Y
Definition: Bounds.h:32
vtkm::FloatDefault LMax
Definition: BoundingIntervalHierarchy.h:59
Definition: BoundingIntervalHierarchy.h:241
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
void ControlSignature(FieldIn, FieldOut)
Definition: BoundingIntervalHierarchy.h:474
vtkm::Id CellIdsOffset
Definition: BoundingIntervalHierarchy.h:550
void ControlSignature(FieldIn, FieldIn, FieldOut, FieldOut)
Definition: BoundingIntervalHierarchy.h:118
void ExecutionSignature(_1, _2, _3, _4, _5, _6)
Definition: BoundingIntervalHierarchy.h:367
vtkm::Float64 Max
Definition: Range.h:34
VTKM_CONT NonSplitIndexCalculator(vtkm::IdComponent maxLeafSize)
Definition: BoundingIntervalHierarchy.h:479
struct vtkm::exec::CellLocatorBoundingIntervalHierarchyNode::@1::@3 Node
Represent a plane with a base point (origin) and normal vector.
Definition: Geometry.h:25
Definition: BoundingIntervalHierarchy.h:392
void ExecutionSignature(_1, _2)
Definition: BoundingIntervalHierarchy.h:475
VTKM_EXEC void operator()(const vtkm::Range &range, vtkm::FloatDefault &splitPlane) const
Definition: BoundingIntervalHierarchy.h:187
vtkm::FloatDefault LMax
Definition: BoundingIntervalHierarchy.h:41
VTKM_CONT TreeLevelAdder(vtkm::Id cellIdsOffset, vtkm::Id treeOffset, vtkm::IdComponent maxLeafSize)
Definition: BoundingIntervalHierarchy.h:513
VTKM_CONT ArrayHandleReverse< HandleType > make_ArrayHandleReverse(const HandleType &handle)
make_ArrayHandleReverse is convenience function to generate an ArrayHandleReverse.
Definition: ArrayHandleReverse.h:176
vtkm::Id NumLeftPoints
Definition: BoundingIntervalHierarchy.h:57
vtkm::IdComponent NumPlanes
Definition: BoundingIntervalHierarchy.h:359
Definition: BoundingIntervalHierarchy.h:424
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38
FieldOut FieldOutCell
Definition: WorkletMapTopology.h:263
Definition: BoundingIntervalHierarchy.h:450
vtkm::Id Stride
Definition: BoundingIntervalHierarchy.h:361
A short vector from an ArrayPortal and a vector of indices.
Definition: VecFromPortalPermute.h:28
Represent a continuous scalar range of values.
Definition: Range.h:31