From b56d1789b02f7b6c63994d7fee2c9b19e3274838 Mon Sep 17 00:00:00 2001 From: ayenpure Date: Wed, 29 Aug 2018 14:19:31 -0700 Subject: [PATCH] Fixing Point Locator interface. - Fixing the point locator interface to make it consistent with the CellLocator interface --- vtkm/cont/CMakeLists.txt | 1 + vtkm/cont/CellLocator.h | 4 ++-- vtkm/cont/PointLocator.h | 12 ++++++------ vtkm/cont/PointLocatorUniformGrid.h | 4 ++-- vtkm/cont/testing/TestingPointLocatorUniformGrid.h | 4 ++-- vtkm/exec/CMakeLists.txt | 1 + 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/vtkm/cont/CMakeLists.txt b/vtkm/cont/CMakeLists.txt index 3e907c258..0603e715d 100644 --- a/vtkm/cont/CMakeLists.txt +++ b/vtkm/cont/CMakeLists.txt @@ -54,6 +54,7 @@ set(headers CellLocator.h CellLocatorHelper.h CellLocatorTwoLevelUniformGrid.h + CellLocatorUniformGrid.h CellSet.h CellSetExplicit.h CellSetListTag.h diff --git a/vtkm/cont/CellLocator.h b/vtkm/cont/CellLocator.h index 4a77d18b8..f1468e2ba 100644 --- a/vtkm/cont/CellLocator.h +++ b/vtkm/cont/CellLocator.h @@ -34,8 +34,6 @@ namespace cont class CellLocator : public vtkm::cont::ExecutionObjectBase { -private: - using HandleType = vtkm::cont::VirtualObjectHandle; public: CellLocator() @@ -72,6 +70,8 @@ public: return PrepareForExecutionImpl(device).PrepareForExecution(device); } + using HandleType = vtkm::cont::VirtualObjectHandle; + protected: void SetDirty() { Dirty = true; } diff --git a/vtkm/cont/PointLocator.h b/vtkm/cont/PointLocator.h index cf5eff06e..8fa5e2b75 100644 --- a/vtkm/cont/PointLocator.h +++ b/vtkm/cont/PointLocator.h @@ -37,11 +37,11 @@ public: { } - vtkm::cont::CoordinateSystem GetCoords() const { return coordinates; } + vtkm::cont::CoordinateSystem GetCoordinates() const { return Coords; } - void SetCoords(const vtkm::cont::CoordinateSystem& coords) + void SetCoordinates(const vtkm::cont::CoordinateSystem& coords) { - coordinates = coords; + Coords = coords; dirty = true; } @@ -57,15 +57,15 @@ public: template VTKM_CONT const vtkm::exec::PointLocator* PrepareForExecution(DeviceAdapter device) const { - return PrepareForExecutionImp(device).PrepareForExecution(device); + return PrepareForExecutionImpl(device).PrepareForExecution(device); } using HandleType = vtkm::cont::VirtualObjectHandle; - VTKM_CONT virtual const HandleType PrepareForExecutionImp( + VTKM_CONT virtual const HandleType PrepareForExecutionImpl( vtkm::cont::DeviceAdapterId deviceId) const = 0; private: - vtkm::cont::CoordinateSystem coordinates; + vtkm::cont::CoordinateSystem Coords; bool dirty; }; diff --git a/vtkm/cont/PointLocatorUniformGrid.h b/vtkm/cont/PointLocatorUniformGrid.h index 57b0fd585..1de9d5fd4 100644 --- a/vtkm/cont/PointLocatorUniformGrid.h +++ b/vtkm/cont/PointLocatorUniformGrid.h @@ -95,7 +95,7 @@ public: using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; // Save training data points. - Algorithm::Copy(this->Self->GetCoords().GetData(), this->Self->coords); + Algorithm::Copy(this->Self->GetCoordinates().GetData(), this->Self->coords); // generate unique id for each input point vtkm::cont::ArrayHandleCounting pointCounting( @@ -159,7 +159,7 @@ public: }; VTKM_CONT - const HandleType PrepareForExecutionImp(vtkm::cont::DeviceAdapterId deviceId) const override + const HandleType PrepareForExecutionImpl(vtkm::cont::DeviceAdapterId deviceId) const override { const bool success = vtkm::cont::TryExecuteOnDevice(deviceId, PrepareForExecutionFunctor(), *this, ExecHandle); diff --git a/vtkm/cont/testing/TestingPointLocatorUniformGrid.h b/vtkm/cont/testing/TestingPointLocatorUniformGrid.h index 099b03e07..b2882ec7b 100644 --- a/vtkm/cont/testing/TestingPointLocatorUniformGrid.h +++ b/vtkm/cont/testing/TestingPointLocatorUniformGrid.h @@ -129,8 +129,8 @@ public: // { 0.0f, 0.0f, 0.0f }, { 10.0f, 10.0f, 10.0f }, { 5, 5, 5 }); vtkm::cont::PointLocatorUniformGrid locator( { 0.0f, 0.0f, 0.0f }, { 10.0f, 10.0f, 10.0f }, { 5, 5, 5 }); - locator.SetCoords(coord); - locator.Build(); + locator.SetCoordinates(coord); + locator.Update(); ///// randomly generate testing points///// std::vector> qcVec; diff --git a/vtkm/exec/CMakeLists.txt b/vtkm/exec/CMakeLists.txt index bc701d6a7..951e584d4 100644 --- a/vtkm/exec/CMakeLists.txt +++ b/vtkm/exec/CMakeLists.txt @@ -27,6 +27,7 @@ set(headers CellInside.h CellInterpolate.h CellLocator.h + CellLocatorUniformGrid.h CellMeasure.h ColorTable.h ConnectivityExplicit.h