mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-06 18:38:59 +00:00
Adding changes for Ken's review from GitLab
- Reducing the stack allocation for CUDA for the BIH unit test - Adding changes from Ken's review - Suppress ptxas stack size warning for BoundingIntervalHierarchy
This commit is contained in:
parent
7a122f23b4
commit
72d4556f7d
@ -39,4 +39,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
|
|||||||
# We explicitly only suppress specific worklets so we can see when new recursive
|
# We explicitly only suppress specific worklets so we can see when new recursive
|
||||||
# worklets are added
|
# worklets are added
|
||||||
"ptxas warning : Stack size for entry function.*NearestNeighborSearch3DWorklet.*"
|
"ptxas warning : Stack size for entry function.*NearestNeighborSearch3DWorklet.*"
|
||||||
|
"ptxas warning : Stack size for entry function.*BoundingIntervalHierarchy.*"
|
||||||
|
"ptxas warning : Stack size for entry function.*CoordinatesPortal.*"
|
||||||
|
"ptxas warning : Stack size for entry function.*CellRangesExtracter.*"
|
||||||
)
|
)
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <vtkm/cont/ArrayHandlePermutation.h>
|
#include <vtkm/cont/ArrayHandlePermutation.h>
|
||||||
#include <vtkm/cont/ArrayHandleReverse.h>
|
#include <vtkm/cont/ArrayHandleReverse.h>
|
||||||
#include <vtkm/cont/ArrayHandleTransform.h>
|
#include <vtkm/cont/ArrayHandleTransform.h>
|
||||||
#include <vtkm/cont/BoundingIntervalHierarchyExec.h>
|
|
||||||
#include <vtkm/cont/BoundingIntervalHierarchyNode.h>
|
#include <vtkm/cont/BoundingIntervalHierarchyNode.h>
|
||||||
#include <vtkm/cont/CellLocator.h>
|
#include <vtkm/cont/CellLocator.h>
|
||||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||||
@ -40,6 +39,7 @@
|
|||||||
#include <vtkm/cont/Timer.h>
|
#include <vtkm/cont/Timer.h>
|
||||||
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
|
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
|
||||||
#include <vtkm/cont/internal/DeviceAdapterListHelpers.h>
|
#include <vtkm/cont/internal/DeviceAdapterListHelpers.h>
|
||||||
|
#include <vtkm/exec/BoundingIntervalHierarchyExec.h>
|
||||||
#include <vtkm/worklet/DispatcherMapField.h>
|
#include <vtkm/worklet/DispatcherMapField.h>
|
||||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||||
#include <vtkm/worklet/WorkletMapField.h>
|
#include <vtkm/worklet/WorkletMapField.h>
|
||||||
@ -49,7 +49,7 @@ namespace vtkm
|
|||||||
{
|
{
|
||||||
namespace cont
|
namespace cont
|
||||||
{
|
{
|
||||||
namespace
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
#define START_TIMER(x) Timer x;
|
#define START_TIMER(x) Timer x;
|
||||||
@ -645,7 +645,7 @@ struct RangeAdd
|
|||||||
}
|
}
|
||||||
}; // struct RangeAdd
|
}; // struct RangeAdd
|
||||||
|
|
||||||
} // namespace
|
} // namespace detail
|
||||||
|
|
||||||
|
|
||||||
class BoundingIntervalHierarchy : public vtkm::cont::CellLocator
|
class BoundingIntervalHierarchy : public vtkm::cont::CellLocator
|
||||||
@ -661,10 +661,10 @@ private:
|
|||||||
using RangeArrayHandle = vtkm::cont::ArrayHandle<vtkm::Range>;
|
using RangeArrayHandle = vtkm::cont::ArrayHandle<vtkm::Range>;
|
||||||
using RangePermutationArrayHandle =
|
using RangePermutationArrayHandle =
|
||||||
vtkm::cont::ArrayHandlePermutation<IdArrayHandle, RangeArrayHandle>;
|
vtkm::cont::ArrayHandlePermutation<IdArrayHandle, RangeArrayHandle>;
|
||||||
using SplitArrayHandle = vtkm::cont::ArrayHandle<TreeNode>;
|
using SplitArrayHandle = vtkm::cont::ArrayHandle<detail::TreeNode>;
|
||||||
using SplitPermutationArrayHandle =
|
using SplitPermutationArrayHandle =
|
||||||
vtkm::cont::ArrayHandlePermutation<IdArrayHandle, SplitArrayHandle>;
|
vtkm::cont::ArrayHandlePermutation<IdArrayHandle, SplitArrayHandle>;
|
||||||
using SplitPropertiesArrayHandle = vtkm::cont::ArrayHandle<SplitProperties>;
|
using SplitPropertiesArrayHandle = vtkm::cont::ArrayHandle<detail::SplitProperties>;
|
||||||
|
|
||||||
class BuildFunctor
|
class BuildFunctor
|
||||||
{
|
{
|
||||||
@ -690,7 +690,7 @@ private:
|
|||||||
|
|
||||||
vtkm::cont::DynamicCellSet cellSet = Self->GetCellSet();
|
vtkm::cont::DynamicCellSet cellSet = Self->GetCellSet();
|
||||||
vtkm::Id numCells = cellSet.GetNumberOfCells();
|
vtkm::Id numCells = cellSet.GetNumberOfCells();
|
||||||
vtkm::cont::CoordinateSystem coords = Self->GetCoords();
|
vtkm::cont::CoordinateSystem coords = Self->GetCoordinates();
|
||||||
vtkm::cont::ArrayHandleVirtualCoordinates points = coords.GetData();
|
vtkm::cont::ArrayHandleVirtualCoordinates points = coords.GetData();
|
||||||
|
|
||||||
//std::cout << "No of cells: " << numCells << "\n";
|
//std::cout << "No of cells: " << numCells << "\n";
|
||||||
@ -705,7 +705,7 @@ private:
|
|||||||
//START_TIMER(s12);
|
//START_TIMER(s12);
|
||||||
CoordsArrayHandle centerXs, centerYs, centerZs;
|
CoordsArrayHandle centerXs, centerYs, centerZs;
|
||||||
RangeArrayHandle xRanges, yRanges, zRanges;
|
RangeArrayHandle xRanges, yRanges, zRanges;
|
||||||
vtkm::worklet::DispatcherMapTopology<CellRangesExtracter, DeviceAdapter>().Invoke(
|
vtkm::worklet::DispatcherMapTopology<detail::CellRangesExtracter, DeviceAdapter>().Invoke(
|
||||||
cellSet, points, xRanges, yRanges, zRanges, centerXs, centerYs, centerZs);
|
cellSet, points, xRanges, yRanges, zRanges, centerXs, centerYs, centerZs);
|
||||||
//PRINT_TIMER("1.2", s12);
|
//PRINT_TIMER("1.2", s12);
|
||||||
|
|
||||||
@ -743,7 +743,7 @@ private:
|
|||||||
//START_TIMER(s22);
|
//START_TIMER(s22);
|
||||||
// Calculate split costs for NumPlanes split planes, across X, Y and Z dimensions
|
// Calculate split costs for NumPlanes split planes, across X, Y and Z dimensions
|
||||||
vtkm::Id numSplitPlanes = numSegments * (Self->NumPlanes + 1);
|
vtkm::Id numSplitPlanes = numSegments * (Self->NumPlanes + 1);
|
||||||
vtkm::cont::ArrayHandle<SplitProperties> xSplits, ySplits, zSplits;
|
vtkm::cont::ArrayHandle<detail::SplitProperties> xSplits, ySplits, zSplits;
|
||||||
xSplits.Allocate(numSplitPlanes);
|
xSplits.Allocate(numSplitPlanes);
|
||||||
ySplits.Allocate(numSplitPlanes);
|
ySplits.Allocate(numSplitPlanes);
|
||||||
zSplits.Allocate(numSplitPlanes);
|
zSplits.Allocate(numSplitPlanes);
|
||||||
@ -760,8 +760,8 @@ private:
|
|||||||
SplitArrayHandle segmentSplits;
|
SplitArrayHandle segmentSplits;
|
||||||
vtkm::cont::ArrayHandle<vtkm::Float64> segmentPlanes;
|
vtkm::cont::ArrayHandle<vtkm::Float64> segmentPlanes;
|
||||||
vtkm::cont::ArrayHandle<vtkm::Id> splitChoices;
|
vtkm::cont::ArrayHandle<vtkm::Id> splitChoices;
|
||||||
SplitSelector worklet(Self->NumPlanes, Self->MaxLeafSize, Self->NumPlanes + 1);
|
detail::SplitSelector worklet(Self->NumPlanes, Self->MaxLeafSize, Self->NumPlanes + 1);
|
||||||
vtkm::worklet::DispatcherMapField<SplitSelector> splitSelectorDispatcher(worklet);
|
vtkm::worklet::DispatcherMapField<detail::SplitSelector> splitSelectorDispatcher(worklet);
|
||||||
CountingIdArrayHandle indices(0, 1, numSegments);
|
CountingIdArrayHandle indices(0, 1, numSegments);
|
||||||
splitSelectorDispatcher.Invoke(indices,
|
splitSelectorDispatcher.Invoke(indices,
|
||||||
xSplits,
|
xSplits,
|
||||||
@ -779,7 +779,8 @@ private:
|
|||||||
|
|
||||||
//START_TIMER(s31);
|
//START_TIMER(s31);
|
||||||
IdArrayHandle leqFlags;
|
IdArrayHandle leqFlags;
|
||||||
vtkm::worklet::DispatcherMapField<CalculateSplitDirectionFlag> computeFlagDispatcher;
|
vtkm::worklet::DispatcherMapField<detail::CalculateSplitDirectionFlag>
|
||||||
|
computeFlagDispatcher;
|
||||||
computeFlagDispatcher.Invoke(centerXs, centerYs, centerZs, splits, planes, leqFlags);
|
computeFlagDispatcher.Invoke(centerXs, centerYs, centerZs, splits, planes, leqFlags);
|
||||||
//PRINT_TIMER("3.1", s31);
|
//PRINT_TIMER("3.1", s31);
|
||||||
|
|
||||||
@ -788,30 +789,31 @@ private:
|
|||||||
Self->CalculateSplitScatterIndices(cellIds, leqFlags, segmentIds, DeviceAdapter());
|
Self->CalculateSplitScatterIndices(cellIds, leqFlags, segmentIds, DeviceAdapter());
|
||||||
IdArrayHandle newSegmentIds;
|
IdArrayHandle newSegmentIds;
|
||||||
IdPermutationArrayHandle sizes(segmentIds, segmentSizes);
|
IdPermutationArrayHandle sizes(segmentIds, segmentSizes);
|
||||||
vtkm::worklet::DispatcherMapField<SegmentSplitter>(SegmentSplitter(Self->MaxLeafSize))
|
vtkm::worklet::DispatcherMapField<detail::SegmentSplitter>(
|
||||||
|
detail::SegmentSplitter(Self->MaxLeafSize))
|
||||||
.Invoke(segmentIds, leqFlags, sizes, newSegmentIds);
|
.Invoke(segmentIds, leqFlags, sizes, newSegmentIds);
|
||||||
//PRINT_TIMER("3.2", s32);
|
//PRINT_TIMER("3.2", s32);
|
||||||
|
|
||||||
//START_TIMER(s33);
|
//START_TIMER(s33);
|
||||||
vtkm::cont::ArrayHandle<vtkm::Id> choices;
|
vtkm::cont::ArrayHandle<vtkm::Id> choices;
|
||||||
Algorithms::Copy(IdPermutationArrayHandle(segmentIds, splitChoices), choices);
|
Algorithms::Copy(IdPermutationArrayHandle(segmentIds, splitChoices), choices);
|
||||||
cellIds = ScatterArray(cellIds, scatterIndices);
|
cellIds = detail::ScatterArray(cellIds, scatterIndices);
|
||||||
segmentIds = ScatterArray(segmentIds, scatterIndices);
|
segmentIds = detail::ScatterArray(segmentIds, scatterIndices);
|
||||||
newSegmentIds = ScatterArray(newSegmentIds, scatterIndices);
|
newSegmentIds = detail::ScatterArray(newSegmentIds, scatterIndices);
|
||||||
xRanges = ScatterArray(xRanges, scatterIndices);
|
xRanges = detail::ScatterArray(xRanges, scatterIndices);
|
||||||
yRanges = ScatterArray(yRanges, scatterIndices);
|
yRanges = detail::ScatterArray(yRanges, scatterIndices);
|
||||||
zRanges = ScatterArray(zRanges, scatterIndices);
|
zRanges = detail::ScatterArray(zRanges, scatterIndices);
|
||||||
centerXs = ScatterArray(centerXs, scatterIndices);
|
centerXs = detail::ScatterArray(centerXs, scatterIndices);
|
||||||
centerYs = ScatterArray(centerYs, scatterIndices);
|
centerYs = detail::ScatterArray(centerYs, scatterIndices);
|
||||||
centerZs = ScatterArray(centerZs, scatterIndices);
|
centerZs = detail::ScatterArray(centerZs, scatterIndices);
|
||||||
choices = ScatterArray(choices, scatterIndices);
|
choices = detail::ScatterArray(choices, scatterIndices);
|
||||||
//PRINT_TIMER("3.3", s33);
|
//PRINT_TIMER("3.3", s33);
|
||||||
|
|
||||||
// Move the cell ids at leafs to the processed cellids list
|
// Move the cell ids at leafs to the processed cellids list
|
||||||
//START_TIMER(s41);
|
//START_TIMER(s41);
|
||||||
IdArrayHandle nonSplitSegmentSizes;
|
IdArrayHandle nonSplitSegmentSizes;
|
||||||
vtkm::worklet::DispatcherMapField<NonSplitIndexCalculator>(
|
vtkm::worklet::DispatcherMapField<detail::NonSplitIndexCalculator>(
|
||||||
NonSplitIndexCalculator(Self->MaxLeafSize))
|
detail::NonSplitIndexCalculator(Self->MaxLeafSize))
|
||||||
.Invoke(segmentSizes, nonSplitSegmentSizes);
|
.Invoke(segmentSizes, nonSplitSegmentSizes);
|
||||||
IdArrayHandle nonSplitSegmentIndices;
|
IdArrayHandle nonSplitSegmentIndices;
|
||||||
Algorithms::ScanExclusive(nonSplitSegmentSizes, nonSplitSegmentIndices);
|
Algorithms::ScanExclusive(nonSplitSegmentSizes, nonSplitSegmentIndices);
|
||||||
@ -821,18 +823,18 @@ private:
|
|||||||
|
|
||||||
//START_TIMER(s42);
|
//START_TIMER(s42);
|
||||||
IdArrayHandle doneCellIds;
|
IdArrayHandle doneCellIds;
|
||||||
Algorithms::CopyIf(cellIds, choices, doneCellIds, Invert());
|
Algorithms::CopyIf(cellIds, choices, doneCellIds, detail::Invert());
|
||||||
Algorithms::CopySubRange(
|
Algorithms::CopySubRange(
|
||||||
doneCellIds, 0, doneCellIds.GetNumberOfValues(), Self->ProcessedCellIds, cellIdsOffset);
|
doneCellIds, 0, doneCellIds.GetNumberOfValues(), Self->ProcessedCellIds, cellIdsOffset);
|
||||||
|
|
||||||
cellIds = CopyIfArray(cellIds, choices, DeviceAdapter());
|
cellIds = detail::CopyIfArray(cellIds, choices, DeviceAdapter());
|
||||||
newSegmentIds = CopyIfArray(newSegmentIds, choices, DeviceAdapter());
|
newSegmentIds = detail::CopyIfArray(newSegmentIds, choices, DeviceAdapter());
|
||||||
xRanges = CopyIfArray(xRanges, choices, DeviceAdapter());
|
xRanges = detail::CopyIfArray(xRanges, choices, DeviceAdapter());
|
||||||
yRanges = CopyIfArray(yRanges, choices, DeviceAdapter());
|
yRanges = detail::CopyIfArray(yRanges, choices, DeviceAdapter());
|
||||||
zRanges = CopyIfArray(zRanges, choices, DeviceAdapter());
|
zRanges = detail::CopyIfArray(zRanges, choices, DeviceAdapter());
|
||||||
centerXs = CopyIfArray(centerXs, choices, DeviceAdapter());
|
centerXs = detail::CopyIfArray(centerXs, choices, DeviceAdapter());
|
||||||
centerYs = CopyIfArray(centerYs, choices, DeviceAdapter());
|
centerYs = detail::CopyIfArray(centerYs, choices, DeviceAdapter());
|
||||||
centerZs = CopyIfArray(centerZs, choices, DeviceAdapter());
|
centerZs = detail::CopyIfArray(centerZs, choices, DeviceAdapter());
|
||||||
//PRINT_TIMER("4.2", s42);
|
//PRINT_TIMER("4.2", s42);
|
||||||
|
|
||||||
//START_TIMER(s43);
|
//START_TIMER(s43);
|
||||||
@ -843,8 +845,8 @@ private:
|
|||||||
Algorithms::CopySubRange(Self->Nodes, 0, Self->Nodes.GetNumberOfValues(), newTree);
|
Algorithms::CopySubRange(Self->Nodes, 0, Self->Nodes.GetNumberOfValues(), newTree);
|
||||||
|
|
||||||
CountingIdArrayHandle nodesIndices(nodesIndexOffset, 1, numSegments);
|
CountingIdArrayHandle nodesIndices(nodesIndexOffset, 1, numSegments);
|
||||||
TreeLevelAdder nodesAdder(cellIdsOffset, nodesSize, Self->MaxLeafSize);
|
detail::TreeLevelAdder nodesAdder(cellIdsOffset, nodesSize, Self->MaxLeafSize);
|
||||||
vtkm::worklet::DispatcherMapField<TreeLevelAdder>(nodesAdder)
|
vtkm::worklet::DispatcherMapField<detail::TreeLevelAdder>(nodesAdder)
|
||||||
.Invoke(nodesIndices,
|
.Invoke(nodesIndices,
|
||||||
segmentSplits,
|
segmentSplits,
|
||||||
nonSplitSegmentIndices,
|
nonSplitSegmentIndices,
|
||||||
@ -908,7 +910,7 @@ private:
|
|||||||
RangeArrayHandle ranges,
|
RangeArrayHandle ranges,
|
||||||
CoordsArrayHandle& coords,
|
CoordsArrayHandle& coords,
|
||||||
IdArrayHandle& segmentIds,
|
IdArrayHandle& segmentIds,
|
||||||
vtkm::cont::ArrayHandle<SplitProperties>& splits,
|
vtkm::cont::ArrayHandle<detail::SplitProperties>& splits,
|
||||||
DeviceAdapter)
|
DeviceAdapter)
|
||||||
{
|
{
|
||||||
for (vtkm::IdComponent planeIndex = 0; planeIndex < NumPlanes; ++planeIndex)
|
for (vtkm::IdComponent planeIndex = 0; planeIndex < NumPlanes; ++planeIndex)
|
||||||
@ -935,21 +937,21 @@ private:
|
|||||||
RangeArrayHandle ranges,
|
RangeArrayHandle ranges,
|
||||||
CoordsArrayHandle& coords,
|
CoordsArrayHandle& coords,
|
||||||
IdArrayHandle& segmentIds,
|
IdArrayHandle& segmentIds,
|
||||||
vtkm::cont::ArrayHandle<SplitProperties>& splits,
|
vtkm::cont::ArrayHandle<detail::SplitProperties>& splits,
|
||||||
vtkm::IdComponent index,
|
vtkm::IdComponent index,
|
||||||
DeviceAdapter)
|
DeviceAdapter)
|
||||||
{
|
{
|
||||||
using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
|
using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
|
||||||
// Make candidate split plane array
|
// Make candidate split plane array
|
||||||
vtkm::cont::ArrayHandle<vtkm::Float64> splitPlanes;
|
vtkm::cont::ArrayHandle<vtkm::Float64> splitPlanes;
|
||||||
SplitPlaneCalculatorWorklet splitPlaneCalcWorklet(planeIndex, numPlanes);
|
detail::SplitPlaneCalculatorWorklet splitPlaneCalcWorklet(planeIndex, numPlanes);
|
||||||
vtkm::worklet::DispatcherMapField<SplitPlaneCalculatorWorklet, DeviceAdapter> splitDispatcher(
|
vtkm::worklet::DispatcherMapField<detail::SplitPlaneCalculatorWorklet, DeviceAdapter>
|
||||||
splitPlaneCalcWorklet);
|
splitDispatcher(splitPlaneCalcWorklet);
|
||||||
splitDispatcher.Invoke(segmentRanges, splitPlanes);
|
splitDispatcher.Invoke(segmentRanges, splitPlanes);
|
||||||
|
|
||||||
// Check if a point is to the left of the split plane or right
|
// Check if a point is to the left of the split plane or right
|
||||||
vtkm::cont::ArrayHandle<vtkm::Id> isLEQOfSplitPlane, isROfSplitPlane;
|
vtkm::cont::ArrayHandle<vtkm::Id> isLEQOfSplitPlane, isROfSplitPlane;
|
||||||
vtkm::worklet::DispatcherMapField<LEQWorklet, DeviceAdapter>().Invoke(
|
vtkm::worklet::DispatcherMapField<detail::LEQWorklet, DeviceAdapter>().Invoke(
|
||||||
coords, splitPlanes, isLEQOfSplitPlane, isROfSplitPlane);
|
coords, splitPlanes, isLEQOfSplitPlane, isROfSplitPlane);
|
||||||
|
|
||||||
// Count of points to the left
|
// Count of points to the left
|
||||||
@ -964,23 +966,23 @@ private:
|
|||||||
// Calculate Lmax and Rmin
|
// Calculate Lmax and Rmin
|
||||||
vtkm::cont::ArrayHandle<vtkm::Range> leqRanges;
|
vtkm::cont::ArrayHandle<vtkm::Range> leqRanges;
|
||||||
vtkm::cont::ArrayHandle<vtkm::Range> rRanges;
|
vtkm::cont::ArrayHandle<vtkm::Range> rRanges;
|
||||||
vtkm::worklet::DispatcherMapField<FilterRanges<true>>().Invoke(
|
vtkm::worklet::DispatcherMapField<detail::FilterRanges<true>>().Invoke(
|
||||||
coords, splitPlanes, ranges, leqRanges);
|
coords, splitPlanes, ranges, leqRanges);
|
||||||
vtkm::worklet::DispatcherMapField<FilterRanges<false>>().Invoke(
|
vtkm::worklet::DispatcherMapField<detail::FilterRanges<false>>().Invoke(
|
||||||
coords, splitPlanes, ranges, rRanges);
|
coords, splitPlanes, ranges, rRanges);
|
||||||
|
|
||||||
vtkm::cont::ArrayHandle<vtkm::Range> lMaxRanges;
|
vtkm::cont::ArrayHandle<vtkm::Range> lMaxRanges;
|
||||||
vtkm::cont::ArrayHandle<vtkm::Range> rMinRanges;
|
vtkm::cont::ArrayHandle<vtkm::Range> rMinRanges;
|
||||||
Algorithms::ReduceByKey(segmentIds, leqRanges, discardKeys, lMaxRanges, RangeAdd());
|
Algorithms::ReduceByKey(segmentIds, leqRanges, discardKeys, lMaxRanges, detail::RangeAdd());
|
||||||
Algorithms::ReduceByKey(segmentIds, rRanges, discardKeys, rMinRanges, RangeAdd());
|
Algorithms::ReduceByKey(segmentIds, rRanges, discardKeys, rMinRanges, detail::RangeAdd());
|
||||||
|
|
||||||
vtkm::cont::ArrayHandle<vtkm::Float64> segmentedSplitPlanes;
|
vtkm::cont::ArrayHandle<vtkm::Float64> segmentedSplitPlanes;
|
||||||
Algorithms::ReduceByKey(
|
Algorithms::ReduceByKey(
|
||||||
segmentIds, splitPlanes, discardKeys, segmentedSplitPlanes, vtkm::Minimum());
|
segmentIds, splitPlanes, discardKeys, segmentedSplitPlanes, vtkm::Minimum());
|
||||||
|
|
||||||
// Calculate costs
|
// Calculate costs
|
||||||
SplitPropertiesCalculator splitPropertiesCalculator(index, NumPlanes + 1);
|
detail::SplitPropertiesCalculator splitPropertiesCalculator(index, NumPlanes + 1);
|
||||||
vtkm::worklet::DispatcherMapField<SplitPropertiesCalculator>(splitPropertiesCalculator)
|
vtkm::worklet::DispatcherMapField<detail::SplitPropertiesCalculator>(splitPropertiesCalculator)
|
||||||
.Invoke(pointsToLeft, pointsToRight, lMaxRanges, rMinRanges, segmentedSplitPlanes, splits);
|
.Invoke(pointsToLeft, pointsToRight, lMaxRanges, rMinRanges, segmentedSplitPlanes, splits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1003,12 +1005,13 @@ private:
|
|||||||
Algorithms::ScanInclusiveByKey(segmentIds, counts, countPreviousSegments, vtkm::Minimum());
|
Algorithms::ScanInclusiveByKey(segmentIds, counts, countPreviousSegments, vtkm::Minimum());
|
||||||
|
|
||||||
// Total number of false flags so far in segment
|
// Total number of false flags so far in segment
|
||||||
vtkm::cont::ArrayHandleTransform<IdArrayHandle, Invert> flagsInverse(leqFlags, Invert());
|
vtkm::cont::ArrayHandleTransform<IdArrayHandle, detail::Invert> flagsInverse(leqFlags,
|
||||||
|
detail::Invert());
|
||||||
vtkm::cont::ArrayHandle<vtkm::Id> runningFalseFlagCount;
|
vtkm::cont::ArrayHandle<vtkm::Id> runningFalseFlagCount;
|
||||||
Algorithms::ScanInclusiveByKey(segmentIds, flagsInverse, runningFalseFlagCount, vtkm::Add());
|
Algorithms::ScanInclusiveByKey(segmentIds, flagsInverse, runningFalseFlagCount, vtkm::Add());
|
||||||
|
|
||||||
// Total number of false flags in segment
|
// Total number of false flags in segment
|
||||||
IdArrayHandle totalFalseFlagSegmentCount = ReverseScanInclusiveByKey(
|
IdArrayHandle totalFalseFlagSegmentCount = detail::ReverseScanInclusiveByKey(
|
||||||
segmentIds, runningFalseFlagCount, vtkm::Maximum(), DeviceAdapter());
|
segmentIds, runningFalseFlagCount, vtkm::Maximum(), DeviceAdapter());
|
||||||
|
|
||||||
// if point is to the left,
|
// if point is to the left,
|
||||||
@ -1016,12 +1019,13 @@ private:
|
|||||||
// else
|
// else
|
||||||
// index = total number in previous segments + number of falses preceeding it in the segment.
|
// index = total number in previous segments + number of falses preceeding it in the segment.
|
||||||
IdArrayHandle scatterIndices;
|
IdArrayHandle scatterIndices;
|
||||||
vtkm::worklet::DispatcherMapField<SplitIndicesCalculator>().Invoke(leqFlags,
|
vtkm::worklet::DispatcherMapField<detail::SplitIndicesCalculator>().Invoke(
|
||||||
trueFlagCounts,
|
leqFlags,
|
||||||
countPreviousSegments,
|
trueFlagCounts,
|
||||||
runningFalseFlagCount,
|
countPreviousSegments,
|
||||||
totalFalseFlagSegmentCount,
|
runningFalseFlagCount,
|
||||||
scatterIndices);
|
totalFalseFlagSegmentCount,
|
||||||
|
scatterIndices);
|
||||||
return scatterIndices;
|
return scatterIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1042,7 +1046,7 @@ private:
|
|||||||
ExecutionType* execObject = new ExecutionType(bih->Nodes,
|
ExecutionType* execObject = new ExecutionType(bih->Nodes,
|
||||||
bih->ProcessedCellIds,
|
bih->ProcessedCellIds,
|
||||||
bih->GetCellSet().Cast<CellSetType>(),
|
bih->GetCellSet().Cast<CellSetType>(),
|
||||||
bih->GetCoords().GetData(),
|
bih->GetCoordinates().GetData(),
|
||||||
DeviceAdapter());
|
DeviceAdapter());
|
||||||
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter());
|
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter());
|
||||||
}
|
}
|
||||||
@ -1053,7 +1057,7 @@ private:
|
|||||||
ExecutionType* execObject = new ExecutionType(bih->Nodes,
|
ExecutionType* execObject = new ExecutionType(bih->Nodes,
|
||||||
bih->ProcessedCellIds,
|
bih->ProcessedCellIds,
|
||||||
bih->GetCellSet().Cast<CellSetType>(),
|
bih->GetCellSet().Cast<CellSetType>(),
|
||||||
bih->GetCoords().GetData(),
|
bih->GetCoordinates().GetData(),
|
||||||
DeviceAdapter());
|
DeviceAdapter());
|
||||||
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter());
|
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter());
|
||||||
}
|
}
|
||||||
@ -1064,7 +1068,7 @@ private:
|
|||||||
ExecutionType* execObject = new ExecutionType(bih->Nodes,
|
ExecutionType* execObject = new ExecutionType(bih->Nodes,
|
||||||
bih->ProcessedCellIds,
|
bih->ProcessedCellIds,
|
||||||
bih->GetCellSet().Cast<CellSetType>(),
|
bih->GetCellSet().Cast<CellSetType>(),
|
||||||
bih->GetCoords().GetData(),
|
bih->GetCoordinates().GetData(),
|
||||||
DeviceAdapter());
|
DeviceAdapter());
|
||||||
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter());
|
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter());
|
||||||
}
|
}
|
||||||
@ -1075,7 +1079,7 @@ private:
|
|||||||
ExecutionType* execObject = new ExecutionType(bih->Nodes,
|
ExecutionType* execObject = new ExecutionType(bih->Nodes,
|
||||||
bih->ProcessedCellIds,
|
bih->ProcessedCellIds,
|
||||||
bih->GetCellSet().Cast<CellSetType>(),
|
bih->GetCellSet().Cast<CellSetType>(),
|
||||||
bih->GetCoords().GetData(),
|
bih->GetCoordinates().GetData(),
|
||||||
DeviceAdapter());
|
DeviceAdapter());
|
||||||
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter());
|
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter());
|
||||||
}
|
}
|
||||||
@ -1094,6 +1098,28 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VTKM_CONT
|
||||||
|
void SetNumberOfSplittingPlanes(vtkm::IdComponent numPlanes)
|
||||||
|
{
|
||||||
|
NumPlanes = numPlanes;
|
||||||
|
SetDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
VTKM_CONT
|
||||||
|
vtkm::IdComponent GetNumberOfSplittingPlanes() { return NumPlanes; }
|
||||||
|
|
||||||
|
VTKM_CONT
|
||||||
|
void SetMaxLeafSize(vtkm::IdComponent maxLeafSize)
|
||||||
|
{
|
||||||
|
MaxLeafSize = maxLeafSize;
|
||||||
|
SetDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
VTKM_CONT
|
||||||
|
vtkm::Id GetMaxLeafSize() { return MaxLeafSize; }
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
void Build() override
|
void Build() override
|
||||||
{
|
{
|
||||||
@ -1101,13 +1127,10 @@ public:
|
|||||||
vtkm::cont::TryExecute(functor);
|
vtkm::cont::TryExecute(functor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
const vtkm::exec::CellLocator* PrepareForExecutionImpl(const vtkm::Int8 device) const override
|
const vtkm::exec::CellLocator* PrepareForExecutionImpl(const vtkm::Int8 device) const override
|
||||||
{
|
{
|
||||||
using DeviceList = vtkm::ListTagBase<vtkm::cont::DeviceAdapterTagCuda,
|
using DeviceList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG;
|
||||||
vtkm::cont::DeviceAdapterTagTBB,
|
|
||||||
vtkm::cont::DeviceAdapterTagSerial>;
|
|
||||||
const vtkm::exec::CellLocator* toReturn;
|
const vtkm::exec::CellLocator* toReturn;
|
||||||
vtkm::cont::internal::FindDeviceAdapterTagAndCall(
|
vtkm::cont::internal::FindDeviceAdapterTagAndCall(
|
||||||
device, DeviceList(), PrepareForExecutionFunctor(), this, &toReturn);
|
device, DeviceList(), PrepareForExecutionFunctor(), this, &toReturn);
|
||||||
@ -1120,7 +1143,8 @@ private:
|
|||||||
vtkm::cont::ArrayHandle<BoundingIntervalHierarchyNode> Nodes;
|
vtkm::cont::ArrayHandle<BoundingIntervalHierarchyNode> Nodes;
|
||||||
IdArrayHandle ProcessedCellIds;
|
IdArrayHandle ProcessedCellIds;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
} // namespace vtkm::cont
|
} // namespace cont
|
||||||
|
} // namespace vtkm
|
||||||
|
|
||||||
#endif // vtk_m_cont_BoundingIntervalHierarchy_h
|
#endif // vtk_m_cont_BoundingIntervalHierarchy_h
|
||||||
|
@ -47,7 +47,6 @@ set(headers
|
|||||||
ArrayRangeCompute.h
|
ArrayRangeCompute.h
|
||||||
AssignerMultiBlock.h
|
AssignerMultiBlock.h
|
||||||
BoundingIntervalHierarchyNode.h
|
BoundingIntervalHierarchyNode.h
|
||||||
BoundingIntervalHierarchyExec.h
|
|
||||||
BoundingIntervalHierarchy.h
|
BoundingIntervalHierarchy.h
|
||||||
BoundsCompute.h
|
BoundsCompute.h
|
||||||
BoundsGlobalCompute.h
|
BoundsGlobalCompute.h
|
||||||
|
@ -21,34 +21,14 @@
|
|||||||
#define vtk_m_cont_CellLocator_h
|
#define vtk_m_cont_CellLocator_h
|
||||||
|
|
||||||
#include <vtkm/Types.h>
|
#include <vtkm/Types.h>
|
||||||
#include <vtkm/VirtualObjectBase.h>
|
|
||||||
#include <vtkm/cont/CoordinateSystem.h>
|
#include <vtkm/cont/CoordinateSystem.h>
|
||||||
#include <vtkm/cont/DeviceAdapter.h>
|
#include <vtkm/cont/DeviceAdapter.h>
|
||||||
#include <vtkm/cont/DynamicCellSet.h>
|
#include <vtkm/cont/DynamicCellSet.h>
|
||||||
#include <vtkm/cont/ExecutionObjectBase.h>
|
#include <vtkm/cont/ExecutionObjectBase.h>
|
||||||
|
#include <vtkm/exec/CellLocator.h>
|
||||||
|
|
||||||
namespace vtkm
|
namespace vtkm
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace exec
|
|
||||||
{
|
|
||||||
// This will actually be used in the Execution Environment.
|
|
||||||
// As this object is returned by the PrepareForExecution on
|
|
||||||
// the CellLocator we need it to be covarient, and this acts
|
|
||||||
// like a base class.
|
|
||||||
|
|
||||||
class CellLocator : public vtkm::VirtualObjectBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VTKM_EXEC
|
|
||||||
virtual void FindCell(const vtkm::Vec<vtkm::FloatDefault, 3>& point,
|
|
||||||
vtkm::Id& cellId,
|
|
||||||
vtkm::Vec<vtkm::FloatDefault, 3>& parametric,
|
|
||||||
const vtkm::exec::FunctorBase& worklet) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace exec
|
|
||||||
|
|
||||||
namespace cont
|
namespace cont
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -66,20 +46,17 @@ public:
|
|||||||
void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet)
|
void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet)
|
||||||
{
|
{
|
||||||
CellSet = cellSet;
|
CellSet = cellSet;
|
||||||
Dirty = true;
|
SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkm::cont::CoordinateSystem GetCoords() const { return Coords; }
|
vtkm::cont::CoordinateSystem GetCoordinates() const { return Coords; }
|
||||||
|
|
||||||
void SetCoords(const vtkm::cont::CoordinateSystem& coords)
|
void SetCoordinates(const vtkm::cont::CoordinateSystem& coords)
|
||||||
{
|
{
|
||||||
Coords = coords;
|
Coords = coords;
|
||||||
Dirty = true;
|
SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//This is going to need a TryExecute
|
|
||||||
virtual void Build() = 0;
|
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (Dirty)
|
if (Dirty)
|
||||||
@ -95,6 +72,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void SetDirty() { Dirty = true; }
|
||||||
|
|
||||||
|
//This is going to need a TryExecute
|
||||||
|
VTKM_CONT virtual void Build() = 0;
|
||||||
|
|
||||||
VTKM_CONT virtual const vtkm::exec::CellLocator* PrepareForExecutionImpl(
|
VTKM_CONT virtual const vtkm::exec::CellLocator* PrepareForExecutionImpl(
|
||||||
const vtkm::Int8 device) const = 0;
|
const vtkm::Int8 device) const = 0;
|
||||||
|
|
||||||
|
@ -24,23 +24,10 @@
|
|||||||
#include <vtkm/cont/CoordinateSystem.h>
|
#include <vtkm/cont/CoordinateSystem.h>
|
||||||
#include <vtkm/cont/DeviceAdapter.h>
|
#include <vtkm/cont/DeviceAdapter.h>
|
||||||
#include <vtkm/cont/ExecutionObjectBase.h>
|
#include <vtkm/cont/ExecutionObjectBase.h>
|
||||||
|
#include <vtkm/exec/PointLocator.h>
|
||||||
|
|
||||||
namespace vtkm
|
namespace vtkm
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace exec
|
|
||||||
{
|
|
||||||
|
|
||||||
class PointLocator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VTKM_EXEC virtual void FindNearestNeighbor(const vtkm::Vec<vtkm::FloatDefault, 3>& queryPoint,
|
|
||||||
vtkm::Id& pointId,
|
|
||||||
vtkm::FloatDefault& distanceSquared) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace exec
|
|
||||||
|
|
||||||
namespace cont
|
namespace cont
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -53,16 +40,14 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkm::cont::CoordinateSystem GetCoords() const { return Coords; }
|
vtkm::cont::CoordinateSystem GetCoordinates() const { return Coords; }
|
||||||
|
|
||||||
void SetCoords(const vtkm::cont::CoordinateSystem& coords)
|
void SetCoordinates(const vtkm::cont::CoordinateSystem& coords)
|
||||||
{
|
{
|
||||||
Coords = coords;
|
Coords = coords;
|
||||||
Dirty = true;
|
Dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Build() = 0;
|
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (Dirty)
|
if (Dirty)
|
||||||
@ -77,6 +62,11 @@ public:
|
|||||||
return PrepareForExecution(deviceId);
|
return PrepareForExecution(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void SetDirty() { Dirty = true; }
|
||||||
|
|
||||||
|
VTKM_CONT virtual void Build() = 0;
|
||||||
|
|
||||||
VTKM_CONT virtual const vtkm::exec::PointLocator* PrepareForExecutionImpl(
|
VTKM_CONT virtual const vtkm::exec::PointLocator* PrepareForExecutionImpl(
|
||||||
const vtkm::Int8 device) = 0;
|
const vtkm::Int8 device) = 0;
|
||||||
|
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
#ifndef vtk_m_cont_BoundingIntervalHierarchyExec_h
|
#ifndef vtk_m_cont_BoundingIntervalHierarchyExec_h
|
||||||
#define vtk_m_cont_BoundingIntervalHierarchyExec_h
|
#define vtk_m_cont_BoundingIntervalHierarchyExec_h
|
||||||
|
|
||||||
|
#include <vtkm/TopologyElementTag.h>
|
||||||
#include <vtkm/VecFromPortalPermute.h>
|
#include <vtkm/VecFromPortalPermute.h>
|
||||||
#include <vtkm/cont/ArrayHandle.h>
|
#include <vtkm/cont/ArrayHandle.h>
|
||||||
|
#include <vtkm/cont/ArrayHandleVirtualCoordinates.h>
|
||||||
#include <vtkm/cont/BoundingIntervalHierarchyNode.h>
|
#include <vtkm/cont/BoundingIntervalHierarchyNode.h>
|
||||||
#include <vtkm/cont/CellLocator.h>
|
|
||||||
#include <vtkm/exec/CellInside.h>
|
#include <vtkm/exec/CellInside.h>
|
||||||
|
#include <vtkm/exec/CellLocator.h>
|
||||||
#include <vtkm/exec/ParametricCoordinates.h>
|
#include <vtkm/exec/ParametricCoordinates.h>
|
||||||
|
|
||||||
namespace vtkm
|
namespace vtkm
|
@ -20,11 +20,13 @@
|
|||||||
|
|
||||||
set(headers
|
set(headers
|
||||||
AtomicArray.h
|
AtomicArray.h
|
||||||
|
BoundingIntervalHierarchyExec.h
|
||||||
CellDerivative.h
|
CellDerivative.h
|
||||||
CellEdge.h
|
CellEdge.h
|
||||||
CellFace.h
|
CellFace.h
|
||||||
CellInside.h
|
CellInside.h
|
||||||
CellInterpolate.h
|
CellInterpolate.h
|
||||||
|
CellLocator.h
|
||||||
CellMeasure.h
|
CellMeasure.h
|
||||||
ColorTable.h
|
ColorTable.h
|
||||||
ConnectivityExplicit.h
|
ConnectivityExplicit.h
|
||||||
@ -34,6 +36,7 @@ set(headers
|
|||||||
FunctorBase.h
|
FunctorBase.h
|
||||||
Jacobian.h
|
Jacobian.h
|
||||||
ParametricCoordinates.h
|
ParametricCoordinates.h
|
||||||
|
PointLocator.h
|
||||||
TaskBase.h
|
TaskBase.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
45
vtkm/exec/CellLocator.h
Normal file
45
vtkm/exec/CellLocator.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
//============================================================================
|
||||||
|
// Copyright (c) Kitware, Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
// See LICENSE.txt for details.
|
||||||
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||||
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE. See the above copyright notice for more information.
|
||||||
|
//
|
||||||
|
// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
||||||
|
// Copyright 2017 UT-Battelle, LLC.
|
||||||
|
// Copyright 2017 Los Alamos National Security.
|
||||||
|
//
|
||||||
|
// Under the terms of Contract DE-NA0003525 with NTESS,
|
||||||
|
// the U.S. Government retains certain rights in this software.
|
||||||
|
//
|
||||||
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||||
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||||
|
// this software.
|
||||||
|
//============================================================================
|
||||||
|
#ifndef vtk_m_exec_CellLocator_h
|
||||||
|
#define vtk_m_exec_CellLocator_h
|
||||||
|
|
||||||
|
#include <vtkm/Types.h>
|
||||||
|
#include <vtkm/VirtualObjectBase.h>
|
||||||
|
#include <vtkm/exec/FunctorBase.h>
|
||||||
|
|
||||||
|
namespace vtkm
|
||||||
|
{
|
||||||
|
namespace exec
|
||||||
|
{
|
||||||
|
|
||||||
|
class CellLocator : public vtkm::VirtualObjectBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VTKM_EXEC
|
||||||
|
virtual void FindCell(const vtkm::Vec<vtkm::FloatDefault, 3>& point,
|
||||||
|
vtkm::Id& cellId,
|
||||||
|
vtkm::Vec<vtkm::FloatDefault, 3>& parametric,
|
||||||
|
const vtkm::exec::FunctorBase& worklet) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace exec
|
||||||
|
} // namespace vtkm
|
||||||
|
|
||||||
|
#endif // vtk_m_exec_CellLocator_h
|
42
vtkm/exec/PointLocator.h
Normal file
42
vtkm/exec/PointLocator.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
//============================================================================
|
||||||
|
// Copyright (c) Kitware, Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
// See LICENSE.txt for details.
|
||||||
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||||
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE. See the above copyright notice for more information.
|
||||||
|
//
|
||||||
|
// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
||||||
|
// Copyright 2017 UT-Battelle, LLC.
|
||||||
|
// Copyright 2017 Los Alamos National Security.
|
||||||
|
//
|
||||||
|
// Under the terms of Contract DE-NA0003525 with NTESS,
|
||||||
|
// the U.S. Government retains certain rights in this software.
|
||||||
|
//
|
||||||
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||||
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||||
|
// this software.
|
||||||
|
//============================================================================
|
||||||
|
#ifndef vtk_m_exec_PointLocator_h
|
||||||
|
#define vtk_m_exec_PointLocator_h
|
||||||
|
|
||||||
|
#include <vtkm/Types.h>
|
||||||
|
#include <vtkm/VirtualObjectBase.h>
|
||||||
|
|
||||||
|
namespace vtkm
|
||||||
|
{
|
||||||
|
namespace exec
|
||||||
|
{
|
||||||
|
|
||||||
|
class PointLocator : public vtkm::VirtualObjectBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VTKM_EXEC virtual void FindNearestNeighbor(const vtkm::Vec<vtkm::FloatDefault, 3>& queryPoint,
|
||||||
|
vtkm::Id& pointId,
|
||||||
|
vtkm::FloatDefault& distanceSquared) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace exec
|
||||||
|
} // namespace vtkm
|
||||||
|
|
||||||
|
#endif // vtk_m_exec_PointLocator_h
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <vtkm/cont/ArrayHandleConcatenate.h>
|
#include <vtkm/cont/ArrayHandleConcatenate.h>
|
||||||
#include <vtkm/cont/BoundingIntervalHierarchy.h>
|
#include <vtkm/cont/BoundingIntervalHierarchy.h>
|
||||||
#include <vtkm/cont/BoundingIntervalHierarchyExec.h>
|
|
||||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||||
#include <vtkm/cont/Timer.h>
|
#include <vtkm/cont/Timer.h>
|
||||||
#include <vtkm/cont/testing/Testing.h>
|
#include <vtkm/cont/testing/Testing.h>
|
||||||
@ -79,8 +78,8 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen
|
|||||||
std::cout << "Using numPlanes: " << numPlanes << "\n";
|
std::cout << "Using numPlanes: " << numPlanes << "\n";
|
||||||
vtkm::cont::BoundingIntervalHierarchy bih = vtkm::cont::BoundingIntervalHierarchy(numPlanes, 5);
|
vtkm::cont::BoundingIntervalHierarchy bih = vtkm::cont::BoundingIntervalHierarchy(numPlanes, 5);
|
||||||
bih.SetCellSet(cellSet);
|
bih.SetCellSet(cellSet);
|
||||||
bih.SetCoords(dataSet.GetCoordinateSystem());
|
bih.SetCoordinates(dataSet.GetCoordinateSystem());
|
||||||
bih.Build();
|
bih.Update();
|
||||||
|
|
||||||
Timer centroidsTimer;
|
Timer centroidsTimer;
|
||||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> centroids;
|
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> centroids;
|
||||||
@ -96,7 +95,10 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen
|
|||||||
//set up stack size for cuda envinroment
|
//set up stack size for cuda envinroment
|
||||||
size_t stackSizeBackup;
|
size_t stackSizeBackup;
|
||||||
cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize);
|
cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize);
|
||||||
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 200);
|
|
||||||
|
std::cout << "Default stack size" << stackSizeBackup << "\n";
|
||||||
|
|
||||||
|
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 50);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vtkm::worklet::DispatcherMapField<BoundingIntervalHierarchyTester>().Invoke(
|
vtkm::worklet::DispatcherMapField<BoundingIntervalHierarchyTester>().Invoke(
|
||||||
@ -117,10 +119,10 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen
|
|||||||
|
|
||||||
void RunTest()
|
void RunTest()
|
||||||
{
|
{
|
||||||
TestBoundingIntervalHierarchy(ConstructDataSet(10), 3);
|
TestBoundingIntervalHierarchy(ConstructDataSet(16), 3);
|
||||||
TestBoundingIntervalHierarchy(ConstructDataSet(10), 4);
|
TestBoundingIntervalHierarchy(ConstructDataSet(16), 4);
|
||||||
TestBoundingIntervalHierarchy(ConstructDataSet(10), 6);
|
TestBoundingIntervalHierarchy(ConstructDataSet(16), 6);
|
||||||
TestBoundingIntervalHierarchy(ConstructDataSet(10), 9);
|
TestBoundingIntervalHierarchy(ConstructDataSet(16), 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user