From a6725b3acd4b9305fca1798d87d3bd05e07945dd Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Thu, 18 Feb 2021 17:25:11 -0700 Subject: [PATCH] Remove use of deprecated ImplicitFunctions with virtual methods Unfortunately, this introduces a backward-incompatible change with the filters that use ImplicitFunctions. Before, they would get an ImplicitFunctionHandle. This class is deprecated, and there is no easy way to get back the actual type of implicit function stored in it. --- benchmarking/BenchmarkFieldAlgorithms.cxx | 53 +++---------------- .../redistribute_points/RedistributePoints.h | 2 +- vtkm/ImplicitFunction.h | 10 ++++ vtkm/filter/ClipWithImplicitFunction.h | 11 ++-- vtkm/filter/ExtractGeometry.h | 11 ++-- vtkm/filter/ExtractGeometry.hxx | 4 +- vtkm/filter/ExtractPoints.h | 14 ++--- ...UnitTestClipWithImplicitFunctionFilter.cxx | 4 +- .../testing/UnitTestExtractGeometryFilter.cxx | 8 +-- .../testing/UnitTestExtractPointsFilter.cxx | 10 ++-- vtkm/worklet/Clip.h | 18 ++++--- vtkm/worklet/ExtractGeometry.h | 24 ++++----- vtkm/worklet/ExtractPoints.h | 14 ++--- vtkm/worklet/testing/UnitTestClipping.cxx | 17 +++--- vtkm/worklet/testing/UnitTestContour.cxx | 3 +- .../testing/UnitTestExtractGeometry.cxx | 6 +-- .../worklet/testing/UnitTestExtractPoints.cxx | 45 +++++++--------- 17 files changed, 106 insertions(+), 148 deletions(-) diff --git a/benchmarking/BenchmarkFieldAlgorithms.cxx b/benchmarking/BenchmarkFieldAlgorithms.cxx index 2f3df1fe1..a7f50a59c 100644 --- a/benchmarking/BenchmarkFieldAlgorithms.cxx +++ b/benchmarking/BenchmarkFieldAlgorithms.cxx @@ -8,13 +8,13 @@ // PURPOSE. See the above copyright notice for more information. //============================================================================ +#include #include #include #include #include #include -#include #include #include #include @@ -259,7 +259,7 @@ public: ScalarType& val, const FunctionType& function) const { - val = function->Value(point); + val = function.Value(point); } }; @@ -275,7 +275,7 @@ public: const FType1& function1, const FType2& function2) const { - val = function1->Value(point) + function2->Value(point); + val = function1.Value(point) + function2.Value(point); } }; @@ -818,8 +818,6 @@ void BenchImplicitFunction(::benchmark::State& state) state.SetLabel(desc.str()); } - vtkm::cont::Token token; - auto handle = vtkm::cont::make_ImplicitFunctionHandle(data.Sphere1); EvalWorklet eval; vtkm::cont::Timer timer{ device }; @@ -829,7 +827,7 @@ void BenchImplicitFunction(::benchmark::State& state) { (void)_; timer.Start(); - invoker(eval, data.Points, data.Result, handle); + invoker(eval, data.Points, data.Result, data.Sphere1); timer.Stop(); state.SetIterationTime(timer.GetElapsedTime()); @@ -851,8 +849,6 @@ void BenchVirtualImplicitFunction(::benchmark::State& state) state.SetLabel(desc.str()); } - vtkm::cont::Token token; - auto sphere = vtkm::cont::make_ImplicitFunctionHandle(data.Sphere1); EvalWorklet eval; vtkm::cont::Timer timer{ device }; @@ -862,7 +858,7 @@ void BenchVirtualImplicitFunction(::benchmark::State& state) { (void)_; timer.Start(); - invoker(eval, data.Points, data.Result, sphere); + invoker(eval, data.Points, data.Result, data.Sphere1); timer.Stop(); state.SetIterationTime(timer.GetElapsedTime()); @@ -884,9 +880,6 @@ void Bench2ImplicitFunctions(::benchmark::State& state) state.SetLabel(desc.str()); } - vtkm::cont::Token token; - auto h1 = vtkm::cont::make_ImplicitFunctionHandle(data.Sphere1); - auto h2 = vtkm::cont::make_ImplicitFunctionHandle(data.Sphere2); EvalWorklet eval; vtkm::cont::Timer timer{ device }; @@ -896,7 +889,7 @@ void Bench2ImplicitFunctions(::benchmark::State& state) { (void)_; timer.Start(); - invoker(eval, data.Points, data.Result, h1, h2); + invoker(eval, data.Points, data.Result, data.Sphere1, data.Sphere2); timer.Stop(); state.SetIterationTime(timer.GetElapsedTime()); @@ -904,40 +897,6 @@ void Bench2ImplicitFunctions(::benchmark::State& state) } VTKM_BENCHMARK(Bench2ImplicitFunctions); -void Bench2VirtualImplicitFunctions(::benchmark::State& state) -{ - using EvalWorklet = Evaluate2ImplicitFunctions; - - const vtkm::cont::DeviceAdapterId device = Config.Device; - - auto data = MakeImplicitFunctionBenchData(); - - { - std::ostringstream desc; - desc << data.Points.GetNumberOfValues() << " points"; - state.SetLabel(desc.str()); - } - - vtkm::cont::Token token; - auto s1 = vtkm::cont::make_ImplicitFunctionHandle(data.Sphere1); - auto s2 = vtkm::cont::make_ImplicitFunctionHandle(data.Sphere2); - EvalWorklet eval; - - vtkm::cont::Timer timer{ device }; - vtkm::cont::Invoker invoker{ device }; - - for (auto _ : state) - { - (void)_; - timer.Start(); - invoker(eval, data.Points, data.Result, s1, s2); - timer.Stop(); - - state.SetIterationTime(timer.GetElapsedTime()); - } -} -VTKM_BENCHMARK(Bench2VirtualImplicitFunctions); - } // end anon namespace int main(int argc, char* argv[]) diff --git a/examples/redistribute_points/RedistributePoints.h b/examples/redistribute_points/RedistributePoints.h index 1585849f3..dd5839621 100644 --- a/examples/redistribute_points/RedistributePoints.h +++ b/examples/redistribute_points/RedistributePoints.h @@ -52,7 +52,7 @@ class Redistributor vtkm::filter::ExtractPoints extractor; extractor.SetCompactPoints(true); - extractor.SetImplicitFunction(vtkm::cont::make_ImplicitFunctionHandle(box)); + extractor.SetImplicitFunction(box); return extractor.Execute(input); } diff --git a/vtkm/ImplicitFunction.h b/vtkm/ImplicitFunction.h index d87fe2974..f855c7812 100644 --- a/vtkm/ImplicitFunction.h +++ b/vtkm/ImplicitFunction.h @@ -182,6 +182,11 @@ public: { } + VTKM_EXEC_CONT ImplicitFunctionValueFunctor(const FunctionType& function) + : Function(function) + { + } + VTKM_EXEC_CONT Scalar operator()(const Vector& point) const { return this->Function.Value(point); @@ -217,6 +222,11 @@ public: { } + VTKM_EXEC_CONT ImplicitFunctionGradientFunctor(const FunctionType& function) + : Function(function) + { + } + VTKM_EXEC_CONT Vector operator()(const Vector& point) const { return this->Function->Gradient(point); diff --git a/vtkm/filter/ClipWithImplicitFunction.h b/vtkm/filter/ClipWithImplicitFunction.h index bfae679d3..3b8acd967 100644 --- a/vtkm/filter/ClipWithImplicitFunction.h +++ b/vtkm/filter/ClipWithImplicitFunction.h @@ -12,7 +12,7 @@ #include -#include +#include #include #include #include @@ -31,14 +31,11 @@ class VTKM_FILTER_EXTRA_EXPORT ClipWithImplicitFunction : public vtkm::filter::FilterDataSet { public: - void SetImplicitFunction(const vtkm::cont::ImplicitFunctionHandle& func) - { - this->Function = func; - } + void SetImplicitFunction(const vtkm::ImplicitFunctionGeneral& func) { this->Function = func; } void SetInvertClip(bool invert) { this->Invert = invert; } - const vtkm::cont::ImplicitFunctionHandle& GetImplicitFunction() const { return this->Function; } + const vtkm::ImplicitFunctionGeneral& GetImplicitFunction() const { return this->Function; } template vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input, @@ -94,7 +91,7 @@ public: } private: - vtkm::cont::ImplicitFunctionHandle Function; + vtkm::ImplicitFunctionGeneral Function; vtkm::worklet::Clip Worklet; bool Invert = false; }; diff --git a/vtkm/filter/ExtractGeometry.h b/vtkm/filter/ExtractGeometry.h index dbd922166..a203aa1ce 100644 --- a/vtkm/filter/ExtractGeometry.h +++ b/vtkm/filter/ExtractGeometry.h @@ -13,7 +13,7 @@ #include -#include +#include #include #include @@ -47,12 +47,9 @@ public: VTKM_CONT ExtractGeometry(); // Set the volume of interest to extract - void SetImplicitFunction(const vtkm::cont::ImplicitFunctionHandle& func) - { - this->Function = func; - } + void SetImplicitFunction(const vtkm::ImplicitFunctionGeneral& func) { this->Function = func; } - const vtkm::cont::ImplicitFunctionHandle& GetImplicitFunction() const { return this->Function; } + const vtkm::ImplicitFunctionGeneral& GetImplicitFunction() const { return this->Function; } VTKM_CONT bool GetExtractInside() { return this->ExtractInside; } @@ -99,7 +96,7 @@ private: bool ExtractInside; bool ExtractBoundaryCells; bool ExtractOnlyBoundaryCells; - vtkm::cont::ImplicitFunctionHandle Function; + vtkm::ImplicitFunctionGeneral Function; vtkm::worklet::ExtractGeometry Worklet; }; diff --git a/vtkm/filter/ExtractGeometry.hxx b/vtkm/filter/ExtractGeometry.hxx index 6eeb47639..e86fb2a30 100644 --- a/vtkm/filter/ExtractGeometry.hxx +++ b/vtkm/filter/ExtractGeometry.hxx @@ -24,7 +24,7 @@ struct CallWorker vtkm::cont::DynamicCellSet& Output; vtkm::worklet::ExtractGeometry& Worklet; const vtkm::cont::CoordinateSystem& Coords; - const vtkm::cont::ImplicitFunctionHandle& Function; + const vtkm::ImplicitFunctionGeneral& Function; bool ExtractInside; bool ExtractBoundaryCells; bool ExtractOnlyBoundaryCells; @@ -32,7 +32,7 @@ struct CallWorker CallWorker(vtkm::cont::DynamicCellSet& output, vtkm::worklet::ExtractGeometry& worklet, const vtkm::cont::CoordinateSystem& coords, - const vtkm::cont::ImplicitFunctionHandle& function, + const vtkm::ImplicitFunctionGeneral& function, bool extractInside, bool extractBoundaryCells, bool extractOnlyBoundaryCells) diff --git a/vtkm/filter/ExtractPoints.h b/vtkm/filter/ExtractPoints.h index 30fc8ea26..7fdb52cf0 100644 --- a/vtkm/filter/ExtractPoints.h +++ b/vtkm/filter/ExtractPoints.h @@ -11,7 +11,12 @@ #ifndef vtk_m_filter_ExtractPoints_h #define vtk_m_filter_ExtractPoints_h +#include + +#ifndef VTKM_NO_DEPRECATED_VIRTUAL #include +#endif //VTKM_NO_DEPRECATED_VIRTUAL + #include #include #include @@ -43,12 +48,9 @@ public: void SetCompactPoints(bool value) { this->CompactPoints = value; } /// Set the volume of interest to extract - void SetImplicitFunction(const vtkm::cont::ImplicitFunctionHandle& func) - { - this->Function = func; - } + void SetImplicitFunction(const vtkm::ImplicitFunctionGeneral& func) { this->Function = func; } - const vtkm::cont::ImplicitFunctionHandle& GetImplicitFunction() const { return this->Function; } + const vtkm::ImplicitFunctionGeneral& GetImplicitFunction() const { return this->Function; } VTKM_CONT bool GetExtractInside() { return this->ExtractInside; } @@ -71,7 +73,7 @@ public: private: bool ExtractInside; - vtkm::cont::ImplicitFunctionHandle Function; + vtkm::ImplicitFunctionGeneral Function; bool CompactPoints; vtkm::filter::CleanGrid Compactor; diff --git a/vtkm/filter/testing/UnitTestClipWithImplicitFunctionFilter.cxx b/vtkm/filter/testing/UnitTestClipWithImplicitFunctionFilter.cxx index 9d9c81bae..3df13612f 100644 --- a/vtkm/filter/testing/UnitTestClipWithImplicitFunctionFilter.cxx +++ b/vtkm/filter/testing/UnitTestClipWithImplicitFunctionFilter.cxx @@ -50,7 +50,7 @@ void TestClipStructured() vtkm::FloatDefault radius(0.5); vtkm::filter::ClipWithImplicitFunction clip; - clip.SetImplicitFunction(vtkm::cont::make_ImplicitFunctionHandle(vtkm::Sphere(center, radius))); + clip.SetImplicitFunction(vtkm::Sphere(center, radius)); clip.SetFieldsToPass("scalars"); vtkm::cont::DataSet outputData = clip.Execute(ds); @@ -87,7 +87,7 @@ void TestClipStructuredInverted() vtkm::FloatDefault radius(0.5); vtkm::filter::ClipWithImplicitFunction clip; - clip.SetImplicitFunction(vtkm::cont::make_ImplicitFunctionHandle(vtkm::Sphere(center, radius))); + clip.SetImplicitFunction(vtkm::Sphere(center, radius)); bool invert = true; clip.SetInvertClip(invert); clip.SetFieldsToPass("scalars"); diff --git a/vtkm/filter/testing/UnitTestExtractGeometryFilter.cxx b/vtkm/filter/testing/UnitTestExtractGeometryFilter.cxx index f0901faf2..5ca1588aa 100644 --- a/vtkm/filter/testing/UnitTestExtractGeometryFilter.cxx +++ b/vtkm/filter/testing/UnitTestExtractGeometryFilter.cxx @@ -29,7 +29,7 @@ public: // Implicit function vtkm::Vec3f minPoint(1.f, 1.f, 1.f); vtkm::Vec3f maxPoint(3.f, 3.f, 3.f); - auto box = vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint); + vtkm::Box box(minPoint, maxPoint); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractGeometry extractGeometry; @@ -56,7 +56,7 @@ public: // Implicit function vtkm::Vec3f minPoint(1.f, 1.f, 1.f); vtkm::Vec3f maxPoint(3.f, 3.f, 3.f); - auto box = vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint); + vtkm::Box box(minPoint, maxPoint); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractGeometry extractGeometry; @@ -83,7 +83,7 @@ public: // Implicit function vtkm::Vec3f minPoint(0.5f, 0.5f, 0.5f); vtkm::Vec3f maxPoint(3.5f, 3.5f, 3.5f); - auto box = vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint); + vtkm::Box box(minPoint, maxPoint); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractGeometry extractGeometry; @@ -109,7 +109,7 @@ public: // Implicit function vtkm::Vec3f minPoint(0.5f, 0.5f, 0.5f); vtkm::Vec3f maxPoint(3.5f, 3.5f, 3.5f); - auto box = vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint); + vtkm::Box box(minPoint, maxPoint); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractGeometry extractGeometry; diff --git a/vtkm/filter/testing/UnitTestExtractPointsFilter.cxx b/vtkm/filter/testing/UnitTestExtractPointsFilter.cxx index 1db88dc8a..9a2a3fe6f 100644 --- a/vtkm/filter/testing/UnitTestExtractPointsFilter.cxx +++ b/vtkm/filter/testing/UnitTestExtractPointsFilter.cxx @@ -29,7 +29,7 @@ public: // Implicit function vtkm::Vec3f minPoint(1.f, 1.f, 1.f); vtkm::Vec3f maxPoint(3.f, 3.f, 3.f); - auto box = vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint); + vtkm::Box box(minPoint, maxPoint); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractPoints extractPoints; @@ -59,7 +59,7 @@ public: // Implicit function vtkm::Vec3f minPoint(1.f, 1.f, 1.f); vtkm::Vec3f maxPoint(3.f, 3.f, 3.f); - auto box = vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint); + vtkm::Box box(minPoint, maxPoint); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractPoints extractPoints; @@ -91,7 +91,7 @@ public: // Implicit function vtkm::Vec3f center(2.f, 2.f, 2.f); vtkm::FloatDefault radius(1.8f); - auto sphere = vtkm::cont::make_ImplicitFunctionHandle(center, radius); + vtkm::Sphere sphere(center, radius); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractPoints extractPoints; @@ -110,7 +110,7 @@ public: // Implicit function vtkm::Vec3f minPoint(0.f, 0.f, 0.f); vtkm::Vec3f maxPoint(1.f, 1.f, 1.f); - auto box = vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint); + vtkm::Box box(minPoint, maxPoint); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractPoints extractPoints; @@ -129,7 +129,7 @@ public: // Implicit function vtkm::Vec3f minPoint(0.f, 0.f, 0.f); vtkm::Vec3f maxPoint(1.f, 1.f, 1.f); - auto box = vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint); + vtkm::Box box(minPoint, maxPoint); // Setup and run filter to extract by volume of interest vtkm::filter::ExtractPoints extractPoints; diff --git a/vtkm/worklet/Clip.h b/vtkm/worklet/Clip.h index 34d3d50ef..7e20b22a3 100644 --- a/vtkm/worklet/Clip.h +++ b/vtkm/worklet/Clip.h @@ -26,10 +26,11 @@ #include #include #include -#include #include #include +#include + #include #include @@ -695,14 +696,14 @@ public: return output; } - template + template class ClipWithImplicitFunction { public: VTKM_CONT ClipWithImplicitFunction(Clip* clipper, const DynamicCellSet& cellSet, - const vtkm::cont::ImplicitFunctionHandle& function, + const ImplicitFunction& function, const bool invert, vtkm::cont::CellSetExplicit<>* result) : Clipper(clipper) @@ -718,7 +719,8 @@ public: { // Evaluate the implicit function on the input coordinates using // ArrayHandleTransform - vtkm::cont::ArrayHandleTransform + vtkm::cont::ArrayHandleTransform> clipScalars(handle, this->Function); // Clip at locations where the implicit function evaluates to 0 @@ -728,20 +730,20 @@ public: private: Clip* Clipper; const DynamicCellSet* CellSet; - vtkm::cont::ImplicitFunctionHandle Function; + ImplicitFunction Function; bool Invert; vtkm::cont::CellSetExplicit<>* Result; }; - template + template vtkm::cont::CellSetExplicit<> Run(const vtkm::cont::DynamicCellSetBase& cellSet, - const vtkm::cont::ImplicitFunctionHandle& clipFunction, + const ImplicitFunction& clipFunction, const vtkm::cont::CoordinateSystem& coords, const bool invert) { vtkm::cont::CellSetExplicit<> output; - ClipWithImplicitFunction> clip( + ClipWithImplicitFunction, ImplicitFunction> clip( this, cellSet, clipFunction, invert, &output); CastAndCall(coords, clip); diff --git a/vtkm/worklet/ExtractGeometry.h b/vtkm/worklet/ExtractGeometry.h index 58698a49d..0af09ef4c 100644 --- a/vtkm/worklet/ExtractGeometry.h +++ b/vtkm/worklet/ExtractGeometry.h @@ -19,7 +19,8 @@ #include #include #include -#include + +#include namespace vtkm { @@ -50,11 +51,11 @@ public: { } - template + template VTKM_EXEC bool operator()(vtkm::Id numIndices, const ConnectivityInVec& connectivityIn, const InVecFieldPortalType& coordinates, - const vtkm::ImplicitFunction* function) const + const ImplicitFunction& function) const { // Count points inside/outside volume of interest vtkm::IdComponent inCnt = 0; @@ -64,7 +65,7 @@ public: { vtkm::Id ptId = connectivityIn[static_cast(indx)]; vtkm::Vec coordinate = coordinates.Get(ptId); - vtkm::FloatDefault value = function->Value(coordinate); + vtkm::FloatDefault value = function.Value(coordinate); if (value <= 0) inCnt++; if (value >= 0) @@ -130,14 +131,13 @@ public: //////////////////////////////////////////////////////////////////////////////////// // Extract cells by implicit function permutes input data - template - vtkm::cont::CellSetPermutation Run( - const CellSetType& cellSet, - const vtkm::cont::CoordinateSystem& coordinates, - const vtkm::cont::ImplicitFunctionHandle& implicitFunction, - bool extractInside, - bool extractBoundaryCells, - bool extractOnlyBoundaryCells) + template + vtkm::cont::CellSetPermutation Run(const CellSetType& cellSet, + const vtkm::cont::CoordinateSystem& coordinates, + const ImplicitFunction& implicitFunction, + bool extractInside, + bool extractBoundaryCells, + bool extractOnlyBoundaryCells) { // Worklet output will be a boolean passFlag array vtkm::cont::ArrayHandle passFlags; diff --git a/vtkm/worklet/ExtractPoints.h b/vtkm/worklet/ExtractPoints.h index 169559faa..9fab54962 100644 --- a/vtkm/worklet/ExtractPoints.h +++ b/vtkm/worklet/ExtractPoints.h @@ -18,7 +18,8 @@ #include #include #include -#include + +#include namespace vtkm { @@ -46,11 +47,12 @@ public: { } - VTKM_EXEC - bool operator()(const vtkm::Vec3f_64& coordinate, const vtkm::ImplicitFunction* function) const + template + VTKM_EXEC bool operator()(const vtkm::Vec3f_64& coordinate, + const ImplicitFunction& function) const { bool pass = passValue; - vtkm::Float64 value = function->Value(coordinate); + vtkm::Float64 value = function.Value(coordinate); if (value > 0) { pass = failValue; @@ -81,10 +83,10 @@ public: //////////////////////////////////////////////////////////////////////////////////// // Extract points by implicit function - template + template vtkm::cont::CellSetSingleType<> Run(const CellSetType& cellSet, const CoordinateType& coordinates, - const vtkm::cont::ImplicitFunctionHandle& implicitFunction, + const ImplicitFunction& implicitFunction, bool extractInside) { // Worklet output will be a boolean passFlag array diff --git a/vtkm/worklet/testing/UnitTestClipping.cxx b/vtkm/worklet/testing/UnitTestClipping.cxx index de288e9b4..608884f36 100644 --- a/vtkm/worklet/testing/UnitTestClipping.cxx +++ b/vtkm/worklet/testing/UnitTestClipping.cxx @@ -18,9 +18,10 @@ #include #include #include -#include #include +#include + #include using Coord3D = vtkm::Vec3f; @@ -234,11 +235,8 @@ void TestClippingWithImplicitFunction() bool invertClip = false; vtkm::worklet::Clip clip; - vtkm::cont::CellSetExplicit<> outputCellSet = - clip.Run(ds.GetCellSet(), - vtkm::cont::make_ImplicitFunctionHandle(center, radius), - ds.GetCoordinateSystem("coords"), - invertClip); + vtkm::cont::CellSetExplicit<> outputCellSet = clip.Run( + ds.GetCellSet(), vtkm::Sphere(center, radius), ds.GetCoordinateSystem("coords"), invertClip); auto coordsIn = ds.GetCoordinateSystem("coords").GetDataAsMultiplexer(); vtkm::cont::ArrayHandle coords = clip.ProcessPointField(coordsIn); @@ -293,11 +291,8 @@ void TestClippingWithImplicitFunctionInverted() bool invertClip = true; vtkm::worklet::Clip clip; - vtkm::cont::CellSetExplicit<> outputCellSet = - clip.Run(ds.GetCellSet(), - vtkm::cont::make_ImplicitFunctionHandle(center, radius), - ds.GetCoordinateSystem("coords"), - invertClip); + vtkm::cont::CellSetExplicit<> outputCellSet = clip.Run( + ds.GetCellSet(), vtkm::Sphere(center, radius), ds.GetCoordinateSystem("coords"), invertClip); auto coordsIn = ds.GetCoordinateSystem("coords").GetDataAsMultiplexer(); vtkm::cont::ArrayHandle coords = clip.ProcessPointField(coordsIn); diff --git a/vtkm/worklet/testing/UnitTestContour.cxx b/vtkm/worklet/testing/UnitTestContour.cxx index e6dc2f374..8a166874b 100644 --- a/vtkm/worklet/testing/UnitTestContour.cxx +++ b/vtkm/worklet/testing/UnitTestContour.cxx @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -366,7 +365,7 @@ void TestContourClipped() vtkm::Plane plane(vtkm::make_Vec(0.51, 0.51, 0.51), vtkm::make_Vec(1, 1, 1)); vtkm::filter::ClipWithImplicitFunction clip; - clip.SetImplicitFunction(vtkm::cont::make_ImplicitFunctionHandle(plane)); + clip.SetImplicitFunction(plane); vtkm::cont::DataSet clipped = clip.Execute(dataSet); vtkm::cont::CellSetExplicit<> cellSet; diff --git a/vtkm/worklet/testing/UnitTestExtractGeometry.cxx b/vtkm/worklet/testing/UnitTestExtractGeometry.cxx index daef863dd..483f39769 100644 --- a/vtkm/worklet/testing/UnitTestExtractGeometry.cxx +++ b/vtkm/worklet/testing/UnitTestExtractGeometry.cxx @@ -75,7 +75,7 @@ public: vtkm::cont::DynamicCellSet outCellSet = extractGeometry.Run(cellSet, dataset.GetCoordinateSystem("coordinates"), - vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint), + vtkm::Box(minPoint, maxPoint), extractInside, extractBoundaryCells, extractOnlyBoundaryCells); @@ -183,7 +183,7 @@ public: vtkm::cont::DynamicCellSet outCellSet = extractGeometry.Run(cellSet, dataset.GetCoordinateSystem("coords"), - vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint), + vtkm::Box(minPoint, maxPoint), extractInside, extractBoundaryCells, extractOnlyBoundaryCells); @@ -223,7 +223,7 @@ public: vtkm::cont::DynamicCellSet outCellSet = extractGeometry.Run(cellSet, dataset.GetCoordinateSystem("coords"), - vtkm::cont::make_ImplicitFunctionHandle(center, radius), + vtkm::Sphere(center, radius), extractInside, extractBoundaryCells, extractOnlyBoundaryCells); diff --git a/vtkm/worklet/testing/UnitTestExtractPoints.cxx b/vtkm/worklet/testing/UnitTestExtractPoints.cxx index c3b973f0e..dd007dfe5 100644 --- a/vtkm/worklet/testing/UnitTestExtractPoints.cxx +++ b/vtkm/worklet/testing/UnitTestExtractPoints.cxx @@ -64,11 +64,10 @@ public: // Output data set with cell set containing extracted points vtkm::worklet::ExtractPoints extractPoints; - OutCellSetType outCellSet = - extractPoints.Run(dataset.GetCellSet(), - dataset.GetCoordinateSystem("coords"), - vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint), - extractInside); + OutCellSetType outCellSet = extractPoints.Run(dataset.GetCellSet(), + dataset.GetCoordinateSystem("coords"), + vtkm::Box(minPoint, maxPoint), + extractInside); outDataSet.SetCellSet(outCellSet); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 27), @@ -95,11 +94,10 @@ public: // Output data set with cell set containing extracted points vtkm::worklet::ExtractPoints extractPoints; - OutCellSetType outCellSet = - extractPoints.Run(dataset.GetCellSet(), - dataset.GetCoordinateSystem("coords"), - vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint), - extractInside); + OutCellSetType outCellSet = extractPoints.Run(dataset.GetCellSet(), + dataset.GetCoordinateSystem("coords"), + vtkm::Box(minPoint, maxPoint), + extractInside); outDataSet.SetCellSet(outCellSet); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 98), @@ -126,11 +124,10 @@ public: // Output data set with cell set containing extracted points vtkm::worklet::ExtractPoints extractPoints; - OutCellSetType outCellSet = - extractPoints.Run(dataset.GetCellSet(), - dataset.GetCoordinateSystem("coords"), - vtkm::cont::make_ImplicitFunctionHandle(center, radius), - extractInside); + OutCellSetType outCellSet = extractPoints.Run(dataset.GetCellSet(), + dataset.GetCoordinateSystem("coords"), + vtkm::Sphere(center, radius), + extractInside); outDataSet.SetCellSet(outCellSet); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 27), @@ -157,11 +154,10 @@ public: // Output data set with cell set containing extracted points vtkm::worklet::ExtractPoints extractPoints; - OutCellSetType outCellSet = - extractPoints.Run(dataset.GetCellSet(), - dataset.GetCoordinateSystem("coordinates"), - vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint), - extractInside); + OutCellSetType outCellSet = extractPoints.Run(dataset.GetCellSet(), + dataset.GetCoordinateSystem("coordinates"), + vtkm::Box(minPoint, maxPoint), + extractInside); outDataSet.SetCellSet(outCellSet); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 8), @@ -188,11 +184,10 @@ public: // Output data set with cell set containing extracted points vtkm::worklet::ExtractPoints extractPoints; - OutCellSetType outCellSet = - extractPoints.Run(dataset.GetCellSet(), - dataset.GetCoordinateSystem("coordinates"), - vtkm::cont::make_ImplicitFunctionHandle(minPoint, maxPoint), - extractInside); + OutCellSetType outCellSet = extractPoints.Run(dataset.GetCellSet(), + dataset.GetCoordinateSystem("coordinates"), + vtkm::Box(minPoint, maxPoint), + extractInside); outDataSet.SetCellSet(outCellSet); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 3),