Add CellLocator to name of BoundingIntervalHierarchy

This will help identify the nature of this object as well as find cell
locator implementations.
This commit is contained in:
Kenneth Moreland 2018-07-12 15:34:29 -06:00
parent c008df90cc
commit 8127093a2f
8 changed files with 104 additions and 133 deletions

@ -1,62 +0,0 @@
//============================================================================
// 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 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 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_cont_BoundingIntervalHierarchyNode_h
#define vtk_m_cont_BoundingIntervalHierarchyNode_h
#include <vtkm/Types.h>
namespace vtkm
{
namespace cont
{
struct BoundingIntervalHierarchyNode
{
vtkm::IdComponent Dimension;
vtkm::Id ParentIndex;
vtkm::Id ChildIndex;
union {
struct
{
vtkm::FloatDefault LMax;
vtkm::FloatDefault RMin;
} Node;
struct
{
vtkm::Id Start;
vtkm::Id Size;
} Leaf;
};
VTKM_EXEC_CONT
BoundingIntervalHierarchyNode()
: Dimension()
, ParentIndex()
, ChildIndex()
, Node{ 0, 0 }
{
}
}; // struct BoundingIntervalHierarchyNode
} // namespace cont
} // namespace vtkm
#endif // vtk_m_cont_BoundingIntervalHierarchyNode_h

@ -49,11 +49,10 @@ set(headers
ArrayRangeCompute.h ArrayRangeCompute.h
AssignerMultiBlock.h AssignerMultiBlock.h
AtomicArray.h AtomicArray.h
BoundingIntervalHierarchy.h
BoundingIntervalHierarchyNode.h
BoundsCompute.h BoundsCompute.h
BoundsGlobalCompute.h BoundsGlobalCompute.h
CellLocator.h CellLocator.h
CellLocatorBoundingIntervalHierarchy.h
CellLocatorHelper.h CellLocatorHelper.h
CellLocatorRectilinearGrid.h CellLocatorRectilinearGrid.h
CellLocatorTwoLevelUniformGrid.h CellLocatorTwoLevelUniformGrid.h
@ -115,7 +114,7 @@ set(template_sources
ArrayHandle.hxx ArrayHandle.hxx
ArrayHandleVirtual.hxx ArrayHandleVirtual.hxx
ArrayRangeCompute.hxx ArrayRangeCompute.hxx
BoundingIntervalHierarchy.hxx CellLocatorBoundingIntervalHierarchy.hxx
CellSetExplicit.hxx CellSetExplicit.hxx
CellSetStructured.hxx CellSetStructured.hxx
ColorTable.hxx ColorTable.hxx

@ -18,14 +18,12 @@
// this software. // this software.
//============================================================================ //============================================================================
#ifndef vtk_m_cont_BoundingIntervalHierarchy_h #ifndef vtk_m_cont_CellLocatorBoundingIntervalHierarchy_h
#define vtk_m_cont_BoundingIntervalHierarchy_h #define vtk_m_cont_CellLocatorBoundingIntervalHierarchy_h
#include <vtkm/Types.h> #include <vtkm/Types.h>
#include <vtkm/cont/ArrayHandle.h> #include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleTransform.h> #include <vtkm/cont/ArrayHandleTransform.h>
#include <vtkm/cont/BoundingIntervalHierarchyNode.h>
#include <vtkm/cont/CellLocator.h> #include <vtkm/cont/CellLocator.h>
#include <vtkm/worklet/spatialstructure/BoundingIntervalHierarchy.h> #include <vtkm/worklet/spatialstructure/BoundingIntervalHierarchy.h>
@ -35,7 +33,7 @@ namespace vtkm
namespace cont namespace cont
{ {
class BoundingIntervalHierarchy : public vtkm::cont::CellLocator class CellLocatorBoundingIntervalHierarchy : public vtkm::cont::CellLocator
{ {
private: private:
using IdArrayHandle = vtkm::cont::ArrayHandle<vtkm::Id>; using IdArrayHandle = vtkm::cont::ArrayHandle<vtkm::Id>;
@ -83,7 +81,8 @@ private:
public: public:
VTKM_CONT VTKM_CONT
BoundingIntervalHierarchy(vtkm::IdComponent numPlanes = 4, vtkm::IdComponent maxLeafSize = 5) CellLocatorBoundingIntervalHierarchy(vtkm::IdComponent numPlanes = 4,
vtkm::IdComponent maxLeafSize = 5)
: NumPlanes(numPlanes) : NumPlanes(numPlanes)
, MaxLeafSize(maxLeafSize) , MaxLeafSize(maxLeafSize)
, Nodes() , Nodes()
@ -122,7 +121,7 @@ protected:
private: private:
vtkm::IdComponent NumPlanes; vtkm::IdComponent NumPlanes;
vtkm::IdComponent MaxLeafSize; vtkm::IdComponent MaxLeafSize;
vtkm::cont::ArrayHandle<BoundingIntervalHierarchyNode> Nodes; vtkm::cont::ArrayHandle<vtkm::exec::CellLocatorBoundingIntervalHierarchyNode> Nodes;
IdArrayHandle ProcessedCellIds; IdArrayHandle ProcessedCellIds;
mutable HandleType ExecHandle; mutable HandleType ExecHandle;
}; };
@ -130,4 +129,4 @@ private:
} // namespace cont } // namespace cont
} // namespace vtkm } // namespace vtkm
#endif // vtk_m_cont_BoundingIntervalHierarchy_h #endif // vtk_m_cont_CellLocatorBoundingIntervalHierarchy_h

@ -26,12 +26,12 @@
#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/BoundingIntervalHierarchy.h> #include <vtkm/cont/CellLocatorBoundingIntervalHierarchy.h>
#include <vtkm/cont/BoundingIntervalHierarchyNode.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h> #include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/ErrorBadDevice.h> #include <vtkm/cont/ErrorBadDevice.h>
#include <vtkm/cont/cuda/DeviceAdapterCuda.h> #include <vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h>
#include <vtkm/exec/BoundingIntervalHierarchyExec.h> #include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/DispatcherMapTopology.h>
#include <vtkm/worklet/Invoker.h> #include <vtkm/worklet/Invoker.h>
#include <vtkm/worklet/WorkletMapField.h> #include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/WorkletMapTopology.h> #include <vtkm/worklet/WorkletMapTopology.h>
@ -62,7 +62,8 @@ using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator>;
template <typename DeviceAdapter> template <typename DeviceAdapter>
VTKM_CONT IdArrayHandle VTKM_CONT IdArrayHandle
BoundingIntervalHierarchy::CalculateSegmentSizes(const IdArrayHandle& segmentIds, vtkm::Id numCells) CellLocatorBoundingIntervalHierarchy::CalculateSegmentSizes(const IdArrayHandle& segmentIds,
vtkm::Id numCells)
{ {
using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>; using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
IdArrayHandle discardKeys; IdArrayHandle discardKeys;
@ -77,7 +78,8 @@ BoundingIntervalHierarchy::CalculateSegmentSizes(const IdArrayHandle& segmentIds
template <typename DeviceAdapter> template <typename DeviceAdapter>
VTKM_CONT IdArrayHandle VTKM_CONT IdArrayHandle
BoundingIntervalHierarchy::GenerateSegmentIds(const IdArrayHandle& segmentSizes, vtkm::Id numCells) CellLocatorBoundingIntervalHierarchy::GenerateSegmentIds(const IdArrayHandle& segmentSizes,
vtkm::Id numCells)
{ {
// Compact segment ids, removing non-contiguous values. // Compact segment ids, removing non-contiguous values.
using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>; using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
@ -92,7 +94,7 @@ BoundingIntervalHierarchy::GenerateSegmentIds(const IdArrayHandle& segmentSizes,
} }
template <typename DeviceAdapter> template <typename DeviceAdapter>
VTKM_CONT void BoundingIntervalHierarchy::CalculateSplitCosts( VTKM_CONT void CellLocatorBoundingIntervalHierarchy::CalculateSplitCosts(
RangePermutationArrayHandle& segmentRanges, RangePermutationArrayHandle& segmentRanges,
RangeArrayHandle& ranges, RangeArrayHandle& ranges,
CoordsArrayHandle& coords, CoordsArrayHandle& coords,
@ -118,7 +120,7 @@ VTKM_CONT void BoundingIntervalHierarchy::CalculateSplitCosts(
} }
template <typename DeviceAdapter> template <typename DeviceAdapter>
VTKM_CONT void BoundingIntervalHierarchy::CalculatePlaneSplitCost( VTKM_CONT void CellLocatorBoundingIntervalHierarchy::CalculatePlaneSplitCost(
vtkm::IdComponent planeIndex, vtkm::IdComponent planeIndex,
vtkm::IdComponent numPlanes, vtkm::IdComponent numPlanes,
RangePermutationArrayHandle& segmentRanges, RangePermutationArrayHandle& segmentRanges,
@ -197,10 +199,10 @@ VTKM_CONT void BoundingIntervalHierarchy::CalculatePlaneSplitCost(
template <typename DeviceAdapter> template <typename DeviceAdapter>
VTKM_CONT IdArrayHandle VTKM_CONT IdArrayHandle
BoundingIntervalHierarchy::CalculateSplitScatterIndices(const IdArrayHandle& cellIds, CellLocatorBoundingIntervalHierarchy::CalculateSplitScatterIndices(const IdArrayHandle& cellIds,
const IdArrayHandle& leqFlags, const IdArrayHandle& leqFlags,
const IdArrayHandle& segmentIds, const IdArrayHandle& segmentIds,
DeviceAdapter) DeviceAdapter)
{ {
using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>; using Algorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
vtkm::worklet::Invoker invoker(DeviceAdapter{}); vtkm::worklet::Invoker invoker(DeviceAdapter{});
@ -242,14 +244,14 @@ BoundingIntervalHierarchy::CalculateSplitScatterIndices(const IdArrayHandle& cel
return scatterIndices; return scatterIndices;
} }
class BoundingIntervalHierarchy::BuildFunctor class CellLocatorBoundingIntervalHierarchy::BuildFunctor
{ {
protected: protected:
BoundingIntervalHierarchy* Self; CellLocatorBoundingIntervalHierarchy* Self;
public: public:
VTKM_CONT VTKM_CONT
BuildFunctor(BoundingIntervalHierarchy* self) BuildFunctor(CellLocatorBoundingIntervalHierarchy* self)
: Self(self) : Self(self)
{ {
} }
@ -437,7 +439,7 @@ public:
//START_TIMER(s43); //START_TIMER(s43);
// Make a new nodes with enough nodes for the current level, copying over the old one // Make a new nodes with enough nodes for the current level, copying over the old one
vtkm::Id nodesSize = Self->Nodes.GetNumberOfValues() + numSegments; vtkm::Id nodesSize = Self->Nodes.GetNumberOfValues() + numSegments;
vtkm::cont::ArrayHandle<BoundingIntervalHierarchyNode> newTree; vtkm::cont::ArrayHandle<vtkm::exec::CellLocatorBoundingIntervalHierarchyNode> newTree;
newTree.Allocate(nodesSize); newTree.Allocate(nodesSize);
Algorithms::CopySubRange(Self->Nodes, 0, Self->Nodes.GetNumberOfValues(), newTree); Algorithms::CopySubRange(Self->Nodes, 0, Self->Nodes.GetNumberOfValues(), newTree);
@ -480,19 +482,20 @@ public:
} }
}; };
class BoundingIntervalHierarchy::PrepareForExecutionFunctor class CellLocatorBoundingIntervalHierarchy::PrepareForExecutionFunctor
{ {
public: public:
template <typename DeviceAdapter> template <typename DeviceAdapter>
VTKM_CONT bool operator()(DeviceAdapter, VTKM_CONT bool operator()(DeviceAdapter,
const vtkm::cont::BoundingIntervalHierarchy& bih, const vtkm::cont::CellLocatorBoundingIntervalHierarchy& bih,
HandleType& bihExec) const HandleType& bihExec) const
{ {
vtkm::cont::DynamicCellSet cellSet = bih.GetCellSet(); vtkm::cont::DynamicCellSet cellSet = bih.GetCellSet();
if (cellSet.IsType<vtkm::cont::CellSetExplicit<>>()) if (cellSet.IsType<vtkm::cont::CellSetExplicit<>>())
{ {
using CellSetType = vtkm::cont::CellSetExplicit<>; using CellSetType = vtkm::cont::CellSetExplicit<>;
using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>; using ExecutionType =
vtkm::exec::CellLocatorBoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>;
ExecutionType* execObject = new ExecutionType(bih.Nodes, ExecutionType* execObject = new ExecutionType(bih.Nodes,
bih.ProcessedCellIds, bih.ProcessedCellIds,
bih.GetCellSet().Cast<CellSetType>(), bih.GetCellSet().Cast<CellSetType>(),
@ -503,7 +506,8 @@ public:
else if (cellSet.IsType<vtkm::cont::CellSetStructured<2>>()) else if (cellSet.IsType<vtkm::cont::CellSetStructured<2>>())
{ {
using CellSetType = vtkm::cont::CellSetStructured<2>; using CellSetType = vtkm::cont::CellSetStructured<2>;
using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>; using ExecutionType =
vtkm::exec::CellLocatorBoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>;
ExecutionType* execObject = new ExecutionType(bih.Nodes, ExecutionType* execObject = new ExecutionType(bih.Nodes,
bih.ProcessedCellIds, bih.ProcessedCellIds,
bih.GetCellSet().Cast<CellSetType>(), bih.GetCellSet().Cast<CellSetType>(),
@ -514,7 +518,8 @@ public:
else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>()) else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>())
{ {
using CellSetType = vtkm::cont::CellSetStructured<3>; using CellSetType = vtkm::cont::CellSetStructured<3>;
using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>; using ExecutionType =
vtkm::exec::CellLocatorBoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>;
ExecutionType* execObject = new ExecutionType(bih.Nodes, ExecutionType* execObject = new ExecutionType(bih.Nodes,
bih.ProcessedCellIds, bih.ProcessedCellIds,
bih.GetCellSet().Cast<CellSetType>(), bih.GetCellSet().Cast<CellSetType>(),
@ -525,7 +530,8 @@ public:
else if (cellSet.IsType<vtkm::cont::CellSetSingleType<>>()) else if (cellSet.IsType<vtkm::cont::CellSetSingleType<>>())
{ {
using CellSetType = vtkm::cont::CellSetSingleType<>; using CellSetType = vtkm::cont::CellSetSingleType<>;
using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>; using ExecutionType =
vtkm::exec::CellLocatorBoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>;
ExecutionType* execObject = new ExecutionType(bih.Nodes, ExecutionType* execObject = new ExecutionType(bih.Nodes,
bih.ProcessedCellIds, bih.ProcessedCellIds,
bih.GetCellSet().Cast<CellSetType>(), bih.GetCellSet().Cast<CellSetType>(),
@ -542,14 +548,14 @@ public:
}; };
VTKM_CONT VTKM_CONT
void BoundingIntervalHierarchy::Build() void CellLocatorBoundingIntervalHierarchy::Build()
{ {
BuildFunctor functor(this); BuildFunctor functor(this);
vtkm::cont::TryExecute(functor); vtkm::cont::TryExecute(functor);
} }
VTKM_CONT VTKM_CONT
const HandleType BoundingIntervalHierarchy::PrepareForExecutionImpl( const HandleType CellLocatorBoundingIntervalHierarchy::PrepareForExecutionImpl(
const vtkm::cont::DeviceAdapterId deviceId) const const vtkm::cont::DeviceAdapterId deviceId) const
{ {
const bool success = const bool success =

@ -19,17 +19,17 @@
##============================================================================ ##============================================================================
set(headers set(headers
BoundingIntervalHierarchyExec.h
BoundaryState.h
AtomicArrayExecutionObject.h AtomicArrayExecutionObject.h
BoundaryState.h
CellDerivative.h CellDerivative.h
CellEdge.h CellEdge.h
CellFace.h CellFace.h
CellInside.h CellInside.h
CellInterpolate.h CellInterpolate.h
CellLocator.h CellLocator.h
CellLocatorUniformGrid.h CellLocatorBoundingIntervalHierarchyExec.h
CellLocatorRectilinearGrid.h CellLocatorRectilinearGrid.h
CellLocatorUniformGrid.h
CellMeasure.h CellMeasure.h
ColorTable.h ColorTable.h
ConnectivityExplicit.h ConnectivityExplicit.h

@ -17,14 +17,13 @@
// Laboratory (LANL), the U.S. Government retains certain rights in // Laboratory (LANL), the U.S. Government retains certain rights in
// this software. // this software.
//============================================================================ //============================================================================
#ifndef vtk_m_cont_BoundingIntervalHierarchyExec_h #ifndef vtk_m_cont_CellLocatorBoundingIntervalHierarchyExec_h
#define vtk_m_cont_BoundingIntervalHierarchyExec_h #define vtk_m_cont_CellLocatorBoundingIntervalHierarchyExec_h
#include <vtkm/TopologyElementTag.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/ArrayHandleVirtualCoordinates.h>
#include <vtkm/cont/BoundingIntervalHierarchyNode.h>
#include <vtkm/exec/CellInside.h> #include <vtkm/exec/CellInside.h>
#include <vtkm/exec/CellLocator.h> #include <vtkm/exec/CellLocator.h>
#include <vtkm/exec/ParametricCoordinates.h> #include <vtkm/exec/ParametricCoordinates.h>
@ -33,31 +32,57 @@ namespace vtkm
{ {
namespace exec namespace exec
{ {
namespace
{
using NodeArrayHandle = vtkm::cont::ArrayHandle<vtkm::cont::BoundingIntervalHierarchyNode>;
using CellIdArrayHandle = vtkm::cont::ArrayHandle<vtkm::Id>;
} // namespace struct CellLocatorBoundingIntervalHierarchyNode
{
vtkm::IdComponent Dimension;
vtkm::Id ParentIndex;
vtkm::Id ChildIndex;
union {
struct
{
vtkm::FloatDefault LMax;
vtkm::FloatDefault RMin;
} Node;
struct
{
vtkm::Id Start;
vtkm::Id Size;
} Leaf;
};
VTKM_EXEC_CONT
CellLocatorBoundingIntervalHierarchyNode()
: Dimension()
, ParentIndex()
, ChildIndex()
, Node{ 0, 0 }
{
}
}; // struct CellLocatorBoundingIntervalHierarchyNode
template <typename DeviceAdapter, typename CellSetType> template <typename DeviceAdapter, typename CellSetType>
class BoundingIntervalHierarchyExec : public vtkm::exec::CellLocator class CellLocatorBoundingIntervalHierarchyExec : public vtkm::exec::CellLocator
{ {
using NodeArrayHandle =
vtkm::cont::ArrayHandle<vtkm::exec::CellLocatorBoundingIntervalHierarchyNode>;
using CellIdArrayHandle = vtkm::cont::ArrayHandle<vtkm::Id>;
public: public:
VTKM_CONT VTKM_CONT
BoundingIntervalHierarchyExec() {} CellLocatorBoundingIntervalHierarchyExec() {}
VTKM_CONT VTKM_CONT
BoundingIntervalHierarchyExec(const NodeArrayHandle& nodes, CellLocatorBoundingIntervalHierarchyExec(const NodeArrayHandle& nodes,
const CellIdArrayHandle& cellIds, const CellIdArrayHandle& cellIds,
const CellSetType& cellSet, const CellSetType& cellSet,
const vtkm::cont::ArrayHandleVirtualCoordinates& coords, const vtkm::cont::ArrayHandleVirtualCoordinates& coords,
DeviceAdapter) DeviceAdapter)
: Nodes(nodes.PrepareForInput(DeviceAdapter())) : Nodes(nodes.PrepareForInput(DeviceAdapter()))
, CellIds(cellIds.PrepareForInput(DeviceAdapter())) , CellIds(cellIds.PrepareForInput(DeviceAdapter()))
, CellSet(cellSet.PrepareForInput(DeviceAdapter(), FromType(), ToType()))
, Coords(coords.PrepareForInput(DeviceAdapter()))
{ {
CellSet = cellSet.PrepareForInput(DeviceAdapter(), FromType(), ToType());
Coords = coords.PrepareForInput(DeviceAdapter());
} }
VTKM_EXEC VTKM_EXEC
@ -109,7 +134,7 @@ private:
{ {
VTKM_ASSERT(state == FindCellState::EnterNode); VTKM_ASSERT(state == FindCellState::EnterNode);
const vtkm::cont::BoundingIntervalHierarchyNode& node = this->Nodes.Get(nodeIndex); const vtkm::exec::CellLocatorBoundingIntervalHierarchyNode& node = this->Nodes.Get(nodeIndex);
if (node.ChildIndex < 0) if (node.ChildIndex < 0)
{ {
@ -129,9 +154,11 @@ private:
VTKM_ASSERT(state == FindCellState::AscendFromNode); VTKM_ASSERT(state == FindCellState::AscendFromNode);
vtkm::Id childNodeIndex = nodeIndex; vtkm::Id childNodeIndex = nodeIndex;
const vtkm::cont::BoundingIntervalHierarchyNode& childNode = this->Nodes.Get(childNodeIndex); const vtkm::exec::CellLocatorBoundingIntervalHierarchyNode& childNode =
this->Nodes.Get(childNodeIndex);
nodeIndex = childNode.ParentIndex; nodeIndex = childNode.ParentIndex;
const vtkm::cont::BoundingIntervalHierarchyNode& parentNode = this->Nodes.Get(nodeIndex); const vtkm::exec::CellLocatorBoundingIntervalHierarchyNode& parentNode =
this->Nodes.Get(nodeIndex);
if (parentNode.ChildIndex == childNodeIndex) if (parentNode.ChildIndex == childNodeIndex)
{ {
@ -152,7 +179,7 @@ private:
{ {
VTKM_ASSERT(state == FindCellState::DescendLeftChild); VTKM_ASSERT(state == FindCellState::DescendLeftChild);
const vtkm::cont::BoundingIntervalHierarchyNode& node = this->Nodes.Get(nodeIndex); const vtkm::exec::CellLocatorBoundingIntervalHierarchyNode& node = this->Nodes.Get(nodeIndex);
const vtkm::FloatDefault& coordinate = point[node.Dimension]; const vtkm::FloatDefault& coordinate = point[node.Dimension];
if (coordinate <= node.Node.LMax) if (coordinate <= node.Node.LMax)
{ {
@ -174,7 +201,7 @@ private:
{ {
VTKM_ASSERT(state == FindCellState::DescendRightChild); VTKM_ASSERT(state == FindCellState::DescendRightChild);
const vtkm::cont::BoundingIntervalHierarchyNode& node = this->Nodes.Get(nodeIndex); const vtkm::exec::CellLocatorBoundingIntervalHierarchyNode& node = this->Nodes.Get(nodeIndex);
const vtkm::FloatDefault& coordinate = point[node.Dimension]; const vtkm::FloatDefault& coordinate = point[node.Dimension];
if (coordinate >= node.Node.RMin) if (coordinate >= node.Node.RMin)
{ {
@ -191,16 +218,17 @@ private:
VTKM_EXEC vtkm::Id FindInLeaf(const vtkm::Vec<vtkm::FloatDefault, 3>& point, VTKM_EXEC vtkm::Id FindInLeaf(const vtkm::Vec<vtkm::FloatDefault, 3>& point,
vtkm::Vec<vtkm::FloatDefault, 3>& parametric, vtkm::Vec<vtkm::FloatDefault, 3>& parametric,
const vtkm::cont::BoundingIntervalHierarchyNode& node, const vtkm::exec::CellLocatorBoundingIntervalHierarchyNode& node,
const vtkm::exec::FunctorBase& worklet) const const vtkm::exec::FunctorBase& worklet) const
{ {
using IndicesType = typename CellSetPortal::IndicesType; using IndicesType = typename CellSetPortal::IndicesType;
for (vtkm::Id i = node.Leaf.Start; i < node.Leaf.Start + node.Leaf.Size; ++i) for (vtkm::Id i = node.Leaf.Start; i < node.Leaf.Start + node.Leaf.Size; ++i)
{ {
vtkm::Id cellId = CellIds.Get(i); vtkm::Id cellId = this->CellIds.Get(i);
IndicesType cellPointIndices = CellSet.GetIndices(cellId); IndicesType cellPointIndices = this->CellSet.GetIndices(cellId);
vtkm::VecFromPortalPermute<IndicesType, CoordsPortal> cellPoints(&cellPointIndices, Coords); vtkm::VecFromPortalPermute<IndicesType, CoordsPortal> cellPoints(&cellPointIndices,
if (IsPointInCell(point, parametric, CellSet.GetCellShape(cellId), cellPoints, worklet)) this->Coords);
if (IsPointInCell(point, parametric, this->CellSet.GetCellShape(cellId), cellPoints, worklet))
{ {
return cellId; return cellId;
} }
@ -235,10 +263,10 @@ private:
CellIdPortal CellIds; CellIdPortal CellIds;
CellSetPortal CellSet; CellSetPortal CellSet;
CoordsPortal Coords; CoordsPortal Coords;
}; // class BoundingIntervalHierarchyExec }; // class CellLocatorBoundingIntervalHierarchyExec
} // namespace exec } // namespace exec
} // namespace vtkm } // namespace vtkm
#endif //vtk_m_cont_BoundingIntervalHierarchyExec_h #endif //vtk_m_cont_CellLocatorBoundingIntervalHierarchyExec_h

@ -31,9 +31,9 @@
#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/BoundingIntervalHierarchyNode.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h> #include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/cuda/DeviceAdapterCuda.h> #include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h>
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/WorkletMapField.h> #include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/WorkletMapTopology.h> #include <vtkm/worklet/WorkletMapTopology.h>
@ -533,7 +533,7 @@ struct TreeLevelAdder : public vtkm::worklet::WorkletMapField
BoundingIntervalHierarchyPortal& treePortal, BoundingIntervalHierarchyPortal& treePortal,
NextParentPortal& nextParentPortal) const NextParentPortal& nextParentPortal) const
{ {
vtkm::cont::BoundingIntervalHierarchyNode node; vtkm::exec::CellLocatorBoundingIntervalHierarchyNode node;
node.ParentIndex = parentIndex; node.ParentIndex = parentIndex;
if (count > this->MaxLeafSize) if (count > this->MaxLeafSize)
{ {

@ -20,7 +20,7 @@
#include <vtkm/cont/Algorithm.h> #include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayHandleConcatenate.h> #include <vtkm/cont/ArrayHandleConcatenate.h>
#include <vtkm/cont/BoundingIntervalHierarchy.hxx> #include <vtkm/cont/CellLocatorBoundingIntervalHierarchy.hxx>
#include <vtkm/cont/DataSetBuilderUniform.h> #include <vtkm/cont/DataSetBuilderUniform.h>
#include <vtkm/cont/Timer.h> #include <vtkm/cont/Timer.h>
#include <vtkm/cont/internal/DeviceAdapterTag.h> #include <vtkm/cont/internal/DeviceAdapterTag.h>
@ -79,7 +79,8 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet,
std::cout << "Using numPlanes: " << numPlanes << "\n"; std::cout << "Using numPlanes: " << numPlanes << "\n";
std::cout << "Building Bounding Interval Hierarchy Tree" << std::endl; std::cout << "Building Bounding Interval Hierarchy Tree" << std::endl;
vtkm::cont::BoundingIntervalHierarchy bih = vtkm::cont::BoundingIntervalHierarchy(numPlanes, 5); vtkm::cont::CellLocatorBoundingIntervalHierarchy bih =
vtkm::cont::CellLocatorBoundingIntervalHierarchy(numPlanes, 5);
bih.SetCellSet(cellSet); bih.SetCellSet(cellSet);
bih.SetCoordinates(dataSet.GetCoordinateSystem()); bih.SetCoordinates(dataSet.GetCoordinateSystem());
bih.Update(); bih.Update();