From d7d5da4fa58df649aeea9518d483db7aa17f7098 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 4 Sep 2017 10:16:51 -0400 Subject: [PATCH] More changes to Neighborhood code to make it more easy to use. These changes allow other worklets to be able to call neighborhood worklets. --- vtkm/exec/arg/FetchTagArrayNeighborhoodIn.h | 4 ++-- .../exec/arg/ThreadIndicesPointNeighborhood.h | 21 ++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/vtkm/exec/arg/FetchTagArrayNeighborhoodIn.h b/vtkm/exec/arg/FetchTagArrayNeighborhoodIn.h index 59c02fa7e..2d57e77fe 100644 --- a/vtkm/exec/arg/FetchTagArrayNeighborhoodIn.h +++ b/vtkm/exec/arg/FetchTagArrayNeighborhoodIn.h @@ -46,7 +46,7 @@ template struct Neighborhood { VTKM_EXEC - Neighborhood(ExecObjectType portal, const vtkm::exec::arg::BoundaryState& boundary) + Neighborhood(const ExecObjectType& portal, const vtkm::exec::arg::BoundaryState& boundary) : Boundary(&boundary) , Portal(portal) { @@ -83,7 +83,7 @@ template struct Neighborhood { VTKM_EXEC - Neighborhood(vtkm::internal::ArrayPortalUniformPointCoordinates portal, + Neighborhood(const vtkm::internal::ArrayPortalUniformPointCoordinates& portal, const vtkm::exec::arg::BoundaryState& boundary) : Boundary(&boundary) , Portal(portal) diff --git a/vtkm/exec/arg/ThreadIndicesPointNeighborhood.h b/vtkm/exec/arg/ThreadIndicesPointNeighborhood.h index 276bb0b0b..ed289776f 100644 --- a/vtkm/exec/arg/ThreadIndicesPointNeighborhood.h +++ b/vtkm/exec/arg/ThreadIndicesPointNeighborhood.h @@ -266,7 +266,26 @@ public: NeighborhoodSize) , InputIndex(outToIn.Get(outIndex)) , OutputIndex(outIndex) - , VisitIndex(static_cast(visit.Get(this->OutputIndex))) + , VisitIndex(static_cast(visit.Get(outIndex))) + , GlobalThreadIndexOffset(globalThreadIndexOffset) + { + } + + template + VTKM_EXEC ThreadIndicesPointNeighborhood( + const vtkm::Id& outIndex, + const vtkm::Id& inIndex, + const vtkm::IdComponent& visitIndex, + const vtkm::exec::ConnectivityStructured& connectivity, + vtkm::Id globalThreadIndexOffset = 0) + : State(detail::To3D(connectivity.FlatToLogicalToIndex(inIndex)), + detail::To3D(connectivity.GetPointDimensions()), + NeighborhoodSize) + , InputIndex(inIndex) + , OutputIndex(outIndex) + , VisitIndex(visitIndex) , GlobalThreadIndexOffset(globalThreadIndexOffset) { }