From ea560e9486a0a70737e9a64869c43567d96a4ad5 Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Thu, 27 Oct 2022 09:19:14 -0600 Subject: [PATCH] Remove deprecated virtual methods Several revisions ago, the ability to use virtual methods in the execution environment was deprecated. Completely remove this functionality for the VTK-m 2.0 release. --- .gitlab/ci/config/initial_config.cmake | 3 - .gitlab/ci/rhel8.yml | 2 +- CMake/VTKmWrappers.cmake | 44 -- CMake/testing/VTKmCheckSourceInInstall.cmake | 23 - CMakeLists.txt | 7 - benchmarking/BenchmarkFieldAlgorithms.cxx | 89 ---- docs/HPCBuilds.md | 1 - docs/changelog/delete-deprecated.md | 7 + vtkm/CMakeLists.txt | 2 - vtkm/ImplicitFunction.h | 97 ---- vtkm/VecFromVirtPortal.h | 69 --- vtkm/VirtualObjectBase.h | 94 ---- vtkm/cont/ArrayHandleVirtual.cxx | 47 -- vtkm/cont/ArrayHandleVirtual.h | 285 ----------- vtkm/cont/ArrayHandleVirtual.hxx | 186 ------- vtkm/cont/ArrayHandleVirtualCoordinates.h | 191 -------- vtkm/cont/ArrayRangeComputeTemplate.h | 47 -- vtkm/cont/CMakeLists.txt | 27 -- vtkm/cont/CellLocator.cxx | 21 - vtkm/cont/CellLocator.h | 96 ---- vtkm/cont/CoordinateSystem.cxx | 21 - vtkm/cont/CoordinateSystem.h | 124 ----- vtkm/cont/ImplicitFunctionHandle.h | 264 ---------- vtkm/cont/PointLocator.cxx | 31 -- vtkm/cont/PointLocator.h | 88 ---- vtkm/cont/StorageVirtual.cxx | 223 --------- vtkm/cont/StorageVirtual.h | 302 ------------ vtkm/cont/StorageVirtual.hxx | 454 ------------------ vtkm/cont/VariantArrayHandle.h | 121 ----- vtkm/cont/VirtualObjectHandle.h | 183 ------- vtkm/cont/VirtualObjectHandle.hxx | 104 ---- vtkm/cont/arg/TransportTagAtomicArray.h | 45 -- vtkm/cont/arg/TypeCheckTagAtomicArray.h | 13 - vtkm/cont/cuda/DeviceAdapterCuda.h | 3 - vtkm/cont/cuda/internal/CMakeLists.txt | 6 - .../cuda/internal/VirtualObjectTransferCuda.h | 157 ------ vtkm/cont/internal/CMakeLists.txt | 9 - vtkm/cont/internal/CellLocatorBase.h | 113 ----- vtkm/cont/internal/PointLocatorBase.h | 110 ----- vtkm/cont/internal/TransferInfo.cxx | 69 --- vtkm/cont/internal/TransferInfo.h | 75 --- vtkm/cont/internal/VirtualObjectTransfer.cxx | 63 --- vtkm/cont/internal/VirtualObjectTransfer.h | 180 ------- .../VirtualObjectTransferInstantiate.h | 42 -- .../VirtualObjectTransferShareWithControl.h | 49 -- vtkm/cont/kokkos/DeviceAdapterKokkos.h | 3 - vtkm/cont/kokkos/internal/CMakeLists.txt | 6 - .../internal/VirtualObjectTransferKokkos.h | 122 ----- vtkm/cont/openmp/DeviceAdapterOpenMP.h | 3 - vtkm/cont/openmp/internal/CMakeLists.txt | 6 - .../internal/VirtualObjectTransferOpenMP.h | 47 -- vtkm/cont/serial/DeviceAdapterSerial.h | 3 - vtkm/cont/serial/internal/CMakeLists.txt | 6 - .../internal/VirtualObjectTransferSerial.h | 42 -- vtkm/cont/tbb/DeviceAdapterTBB.h | 3 - vtkm/cont/tbb/internal/CMakeLists.txt | 6 - .../tbb/internal/VirtualObjectTransferTBB.h | 44 -- vtkm/cont/testing/CMakeLists.txt | 7 - vtkm/cont/testing/TestingDeviceAdapter.h | 90 ---- .../testing/UnitTestArrayHandleVirtual.cxx | 267 ---------- .../UnitTestDeviceAdapterAlgorithmGeneral.cxx | 15 - .../cont/testing/UnitTestImplicitFunction.cxx | 32 -- .../testing/UnitTestVariantArrayHandle.cxx | 97 ---- .../testing/UnitTestVirtualObjectHandle.cxx | 215 --------- vtkm/exec/CMakeLists.txt | 7 - vtkm/exec/CellLocator.h | 69 --- vtkm/exec/PointLocator.h | 49 -- vtkm/filter/entity_extraction/ExtractPoints.h | 4 - vtkm/internal/ArrayPortalVirtual.h | 154 ------ vtkm/internal/CMakeLists.txt | 7 - vtkm/internal/Configure.h.in | 4 - vtkm/io/testing/UnitTestVTKDataSetWriter.cxx | 11 - 72 files changed, 8 insertions(+), 5498 deletions(-) create mode 100644 docs/changelog/delete-deprecated.md delete mode 100644 vtkm/VecFromVirtPortal.h delete mode 100644 vtkm/VirtualObjectBase.h delete mode 100644 vtkm/cont/ArrayHandleVirtual.cxx delete mode 100644 vtkm/cont/ArrayHandleVirtual.h delete mode 100644 vtkm/cont/ArrayHandleVirtual.hxx delete mode 100644 vtkm/cont/ArrayHandleVirtualCoordinates.h delete mode 100644 vtkm/cont/CellLocator.cxx delete mode 100644 vtkm/cont/CellLocator.h delete mode 100644 vtkm/cont/ImplicitFunctionHandle.h delete mode 100644 vtkm/cont/PointLocator.cxx delete mode 100644 vtkm/cont/PointLocator.h delete mode 100644 vtkm/cont/StorageVirtual.cxx delete mode 100644 vtkm/cont/StorageVirtual.h delete mode 100644 vtkm/cont/StorageVirtual.hxx delete mode 100644 vtkm/cont/VirtualObjectHandle.h delete mode 100644 vtkm/cont/VirtualObjectHandle.hxx delete mode 100644 vtkm/cont/cuda/internal/VirtualObjectTransferCuda.h delete mode 100644 vtkm/cont/internal/TransferInfo.cxx delete mode 100644 vtkm/cont/internal/TransferInfo.h delete mode 100644 vtkm/cont/internal/VirtualObjectTransfer.cxx delete mode 100644 vtkm/cont/internal/VirtualObjectTransfer.h delete mode 100644 vtkm/cont/internal/VirtualObjectTransferInstantiate.h delete mode 100644 vtkm/cont/internal/VirtualObjectTransferShareWithControl.h delete mode 100644 vtkm/cont/kokkos/internal/VirtualObjectTransferKokkos.h delete mode 100644 vtkm/cont/openmp/internal/VirtualObjectTransferOpenMP.h delete mode 100644 vtkm/cont/serial/internal/VirtualObjectTransferSerial.h delete mode 100644 vtkm/cont/tbb/internal/VirtualObjectTransferTBB.h delete mode 100644 vtkm/cont/testing/UnitTestArrayHandleVirtual.cxx delete mode 100644 vtkm/cont/testing/UnitTestVirtualObjectHandle.cxx delete mode 100644 vtkm/exec/CellLocator.h delete mode 100644 vtkm/exec/PointLocator.h delete mode 100644 vtkm/internal/ArrayPortalVirtual.h diff --git a/.gitlab/ci/config/initial_config.cmake b/.gitlab/ci/config/initial_config.cmake index f3a8c62f0..a0623dc12 100644 --- a/.gitlab/ci/config/initial_config.cmake +++ b/.gitlab/ci/config/initial_config.cmake @@ -53,9 +53,6 @@ foreach(option IN LISTS options) elseif(no_rendering STREQUAL option) set(VTKm_ENABLE_RENDERING "OFF" CACHE STRING "") - elseif(use_virtuals STREQUAL option) - set(VTKm_NO_DEPRECATED_VIRTUAL "OFF" CACHE STRING "") - elseif(no_testing STREQUAL option) set(VTKm_ENABLE_TESTING "OFF" CACHE STRING "") set(VTKm_ENABLE_TESTING_LIBRARY "OFF" CACHE STRING "") diff --git a/.gitlab/ci/rhel8.yml b/.gitlab/ci/rhel8.yml index 75c795acb..c17398b9c 100644 --- a/.gitlab/ci/rhel8.yml +++ b/.gitlab/ci/rhel8.yml @@ -13,7 +13,7 @@ build:rhel8: - .run_automatically variables: CMAKE_GENERATOR: "Unix Makefiles" - VTKM_SETTINGS: "serial+shared+64bit_floats+32bit_ids+use_virtuals" + VTKM_SETTINGS: "serial+shared+64bit_floats+32bit_ids" test:rhel8: tags: diff --git a/CMake/VTKmWrappers.cmake b/CMake/VTKmWrappers.cmake index 38956ac4d..505622f2d 100644 --- a/CMake/VTKmWrappers.cmake +++ b/CMake/VTKmWrappers.cmake @@ -368,12 +368,6 @@ function(vtkm_add_target_information uses_vtkm_target) endif() endforeach() - # set the required target properties - if(NOT VTKm_NO_DEPRECATED_VIRTUAL) - set_target_properties(${targets} PROPERTIES POSITION_INDEPENDENT_CODE ON) - set_target_properties(${targets} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) - endif() - if(VTKm_TI_DROP_UNUSED_SYMBOLS) foreach(target IN LISTS targets) vtkm_add_drop_unused_function_flags(${target}) @@ -386,44 +380,6 @@ function(vtkm_add_target_information uses_vtkm_target) set_source_files_properties(${VTKm_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "HIP") kokkos_compilation(SOURCE ${VTKm_TI_DEVICE_SOURCES}) endif() - - # Validate that following: - # - We are building with CUDA enabled. - # - We are building a VTK-m library or a library that wants cross library - # device calls. - # - # This is required as CUDA currently doesn't support device side calls across - # dynamic library boundaries. - if((NOT VTKm_NO_DEPRECATED_VIRTUAL) AND ((TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda))) - foreach(target IN LISTS targets) - get_target_property(lib_type ${target} TYPE) - if (TARGET vtkm::cuda) - get_target_property(requires_static vtkm::cuda requires_static_builds) - endif() - if (TARGET vtkm::kokkos) - get_target_property(requires_static vtkm::kokkos requires_static_builds) - endif() - - if(requires_static AND ${lib_type} STREQUAL "SHARED_LIBRARY" AND VTKm_TI_EXTENDS_VTKM) - #We provide different error messages based on if we are building VTK-m - #or being called by a consumer of VTK-m. We use PROJECT_NAME so that we - #produce the correct error message when VTK-m is a subdirectory include - #of another project - if(PROJECT_NAME STREQUAL "VTKm") - message(SEND_ERROR "${target} needs to be built STATIC as CUDA doesn't" - " support virtual methods across dynamic library boundaries. You" - " need to set the CMake option BUILD_SHARED_LIBS to `OFF` or" - " (better) turn VTKm_NO_DEPRECATED_VIRTUAL to `ON`.") - else() - message(SEND_ERROR "${target} needs to be built STATIC as CUDA doesn't" - " support virtual methods across dynamic library boundaries. You" - " should either explicitly call add_library with the `STATIC` keyword" - " or set the CMake option BUILD_SHARED_LIBS to `OFF` or" - " (better) turn VTKm_NO_DEPRECATED_VIRTUAL to `ON`.") - endif() - endif() - endforeach() - endif() endfunction() diff --git a/CMake/testing/VTKmCheckSourceInInstall.cmake b/CMake/testing/VTKmCheckSourceInInstall.cmake index c4b909a08..587021d83 100644 --- a/CMake/testing/VTKmCheckSourceInInstall.cmake +++ b/CMake/testing/VTKmCheckSourceInInstall.cmake @@ -112,29 +112,6 @@ function(do_verify root_dir prefix) thirdparty/diy/vtkmdiy/cmake/mpi_types.h thirdparty/lodepng/vtkmlodepng/lodepng.h thirdparty/loguru/vtkmloguru/loguru.hpp - - # Ignore deprecated virtual classes (which are not installed if VTKm_NO_DEPRECATED_VIRTUAL - # is on). These exceptions can be removed when these files are completely removed. - cont/ArrayHandleVirtual.h - cont/ArrayHandleVirtual.hxx - cont/ArrayHandleVirtualCoordinates.h - cont/CellLocator.h - cont/PointLocator.h - cont/StorageVirtual.h - cont/StorageVirtual.hxx - cont/VirtualObjectHandle.h - cont/cuda/internal/VirtualObjectTransferCuda.h - cont/internal/TransferInfo.h - cont/internal/VirtualObjectTransfer.h - cont/internal/VirtualObjectTransferInstantiate.h - cont/internal/VirtualObjectTransferShareWithControl.h - cont/kokkos/internal/VirtualObjectTransferKokkos.h - cont/openmp/internal/VirtualObjectTransferOpenMP.h - cont/serial/internal/VirtualObjectTransferSerial.h - cont/tbb/internal/VirtualObjectTransferTBB.h - exec/CellLocator.h - exec/PointLocator.h - internal/ArrayPortalVirtual.h ) string(REPLACE ":" ";" directory_exceptions "${DIR_EXCEPTIONS}") diff --git a/CMakeLists.txt b/CMakeLists.txt index 1abac4e37..cabba102e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,12 +177,6 @@ vtkm_option(VTKm_ENABLE_DEVELOPER_FLAGS "Enable compiler flags that are useful w # Some application might need not to install those, hence this option. vtkm_option(VTKm_NO_INSTALL_README_LICENSE "disable the installation of README and LICENSE files" OFF) -# We are in the process of deprecating the use of virtual methods because they -# are not well supported on many accelerators. Turn this option on to remove -# the code entirely. In VTK-m 2.0 virtual methods should be removed entirely -# and this option will be removed. -vtkm_option(VTKm_NO_DEPRECATED_VIRTUAL "Do not compile support of deprecated virtual methods" ON) - # In Python wheels, having SONAME suffixes just ends up duplicating files. # Allow VTK to turn off these symlinks for its wheel distribution. vtkm_option(VTKm_SKIP_LIBRARY_VERSIONS "Skip versioning VTK-m libraries" OFF) @@ -196,7 +190,6 @@ mark_as_advanced( VTKm_HIDE_PRIVATE_SYMBOLS VTKm_ENABLE_DEVELOPER_FLAGS VTKm_NO_INSTALL_README_LICENSE - VTKm_NO_DEPRECATED_VIRTUAL VTKm_SKIP_LIBRARY_VERSIONS ) diff --git a/benchmarking/BenchmarkFieldAlgorithms.cxx b/benchmarking/BenchmarkFieldAlgorithms.cxx index 13899d63c..1e878e999 100644 --- a/benchmarking/BenchmarkFieldAlgorithms.cxx +++ b/benchmarking/BenchmarkFieldAlgorithms.cxx @@ -19,10 +19,6 @@ #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif - #include #include @@ -420,20 +416,6 @@ void BenchBlackScholesStatic(::benchmark::State& state) }; VTKM_BENCHMARK_TEMPLATES(BenchBlackScholesStatic, ValueTypes); -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -template -void BenchBlackScholesDynamic(::benchmark::State& state) -{ - VTKM_DEPRECATED_SUPPRESS_BEGIN - BenchBlackScholesImpl impl{ state }; - impl.Run(vtkm::cont::make_ArrayHandleVirtual(impl.StockPrice), - vtkm::cont::make_ArrayHandleVirtual(impl.OptionStrike), - vtkm::cont::make_ArrayHandleVirtual(impl.OptionYears)); - VTKM_DEPRECATED_SUPPRESS_END -}; -VTKM_BENCHMARK_TEMPLATES(BenchBlackScholesDynamic, ValueTypes); -#endif //VTKM_NO_DEPRECATED_VIRTUAL - template void BenchBlackScholesMultiplexer0(::benchmark::State& state) { @@ -528,20 +510,6 @@ void BenchMathStatic(::benchmark::State& state) }; VTKM_BENCHMARK_TEMPLATES(BenchMathStatic, ValueTypes); -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -template -void BenchMathDynamic(::benchmark::State& state) -{ - VTKM_DEPRECATED_SUPPRESS_BEGIN - BenchMathImpl impl{ state }; - impl.Run(vtkm::cont::make_ArrayHandleVirtual(impl.InputHandle), - vtkm::cont::make_ArrayHandleVirtual(impl.TempHandle1), - vtkm::cont::make_ArrayHandleVirtual(impl.TempHandle2)); - VTKM_DEPRECATED_SUPPRESS_END -}; -VTKM_BENCHMARK_TEMPLATES(BenchMathDynamic, ValueTypes); -#endif //VTKM_NO_DEPRECATED_VIRTUAL - template void BenchMathMultiplexer0(::benchmark::State& state) { @@ -631,18 +599,6 @@ void BenchFusedMathStatic(::benchmark::State& state) }; VTKM_BENCHMARK_TEMPLATES(BenchFusedMathStatic, ValueTypes); -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -template -void BenchFusedMathDynamic(::benchmark::State& state) -{ - VTKM_DEPRECATED_SUPPRESS_BEGIN - BenchFusedMathImpl impl{ state }; - impl.Run(vtkm::cont::make_ArrayHandleVirtual(impl.InputHandle)); - VTKM_DEPRECATED_SUPPRESS_END -}; -VTKM_BENCHMARK_TEMPLATES(BenchFusedMathDynamic, ValueTypes); -#endif //VTKM_NO_DEPRECATED_VIRTUAL - template void BenchFusedMathMultiplexer0(::benchmark::State& state) { @@ -755,20 +711,6 @@ void BenchEdgeInterpStatic(::benchmark::State& state) }; VTKM_BENCHMARK_TEMPLATES(BenchEdgeInterpStatic, InterpValueTypes); -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -template -void BenchEdgeInterpDynamic(::benchmark::State& state) -{ - VTKM_DEPRECATED_SUPPRESS_BEGIN - BenchEdgeInterpImpl impl{ state }; - impl.Run(vtkm::cont::make_ArrayHandleVirtual(impl.EdgePairHandle), - vtkm::cont::make_ArrayHandleVirtual(impl.WeightHandle), - vtkm::cont::make_ArrayHandleVirtual(impl.FieldHandle)); - VTKM_DEPRECATED_SUPPRESS_END -}; -VTKM_BENCHMARK_TEMPLATES(BenchEdgeInterpDynamic, InterpValueTypes); -#endif //VTKM_NO_DEPRECATED_VIRTUAL - struct ImplicitFunctionBenchData { vtkm::cont::ArrayHandle Points; @@ -834,37 +776,6 @@ void BenchImplicitFunction(::benchmark::State& state) } VTKM_BENCHMARK(BenchImplicitFunction); -void BenchVirtualImplicitFunction(::benchmark::State& state) -{ - using EvalWorklet = EvaluateImplicitFunction; - - const vtkm::cont::DeviceAdapterId device = Config.Device; - - auto data = MakeImplicitFunctionBenchData(); - - { - std::ostringstream desc; - desc << data.Points.GetNumberOfValues() << " points"; - state.SetLabel(desc.str()); - } - - EvalWorklet eval; - - vtkm::cont::Timer timer{ device }; - vtkm::cont::Invoker invoker{ device }; - - for (auto _ : state) - { - (void)_; - timer.Start(); - invoker(eval, data.Points, data.Result, data.Sphere1); - timer.Stop(); - - state.SetIterationTime(timer.GetElapsedTime()); - } -} -VTKM_BENCHMARK(BenchVirtualImplicitFunction); - void Bench2ImplicitFunctions(::benchmark::State& state) { using EvalWorklet = Evaluate2ImplicitFunctions; diff --git a/docs/HPCBuilds.md b/docs/HPCBuilds.md index c6d678a19..2edec8a4d 100644 --- a/docs/HPCBuilds.md +++ b/docs/HPCBuilds.md @@ -89,7 +89,6 @@ ${cmake_build_dir}/bin/cmake -S ${vtkm_src_dir} -B ${vtkm_build_dir} \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF\ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON\ - -DVTKm_NO_DEPRECATED_VIRTUAL=ON \ -DVTKm_ENABLE_KOKKOS=ON \ -DVTKm_ENABLE_MPI=OFF\ -DVTKm_ENABLE_RENDERING=ON \ diff --git a/docs/changelog/delete-deprecated.md b/docs/changelog/delete-deprecated.md new file mode 100644 index 000000000..bfcaf864c --- /dev/null +++ b/docs/changelog/delete-deprecated.md @@ -0,0 +1,7 @@ +# Delete deprecated features + +With the major release of VTK-m 2.0, we are cleaning up the code by +removing deprecated features. For software using VTK-m 1.9, you should have +gotten deprecation warnings about any feature that is removed. Thus, to +ease porting to VTK-m 2.0, software should consider updating to VTK-m 1.9 +first. diff --git a/vtkm/CMakeLists.txt b/vtkm/CMakeLists.txt index c8c572ede..21dae3312 100644 --- a/vtkm/CMakeLists.txt +++ b/vtkm/CMakeLists.txt @@ -57,12 +57,10 @@ set(headers VecAxisAlignedPointCoordinates.h VecFromPortal.h VecFromPortalPermute.h - VecFromVirtPortal.h VectorAnalysis.h VecFlat.h VecTraits.h VecVariable.h - VirtualObjectBase.h UnaryPredicates.h UpperBound.h ) diff --git a/vtkm/ImplicitFunction.h b/vtkm/ImplicitFunction.h index 59472c211..364efcbab 100644 --- a/vtkm/ImplicitFunction.h +++ b/vtkm/ImplicitFunction.h @@ -20,39 +20,9 @@ // For interface class only. #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif // VTKM_NO_DEPRECATED_VIRTUAL - namespace vtkm { -//============================================================================ -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -VTKM_DEPRECATED_SUPPRESS_BEGIN -class VTKM_DEPRECATED(1.6, "ImplicitFunction with virtual methods no longer supported.") - VTKM_ALWAYS_EXPORT ImplicitFunction : public vtkm::VirtualObjectBase -{ -public: - using Scalar = vtkm::FloatDefault; - using Vector = vtkm::Vec; - - VTKM_EXEC_CONT virtual Scalar Value(const Vector& point) const = 0; - VTKM_EXEC_CONT virtual Vector Gradient(const Vector& point) const = 0; - - VTKM_EXEC_CONT Scalar Value(Scalar x, Scalar y, Scalar z) const - { - return this->Value(Vector(x, y, z)); - } - - VTKM_EXEC_CONT Vector Gradient(Scalar x, Scalar y, Scalar z) const - { - return this->Gradient(Vector(x, y, z)); - } -}; -VTKM_DEPRECATED_SUPPRESS_END -#endif // VTKM_NO_DEPRECATED_VIRTUAL - //============================================================================ namespace internal { @@ -93,73 +63,6 @@ public: } // namespace vtkm::internal -//============================================================================ -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -VTKM_DEPRECATED_SUPPRESS_BEGIN - -/// A helpful functor that calls the (virtual) value method of a given ImplicitFunction. Can be -/// passed to things that expect a functor instead of an ImplictFunction class (like an array -/// transform). -/// -class VTKM_DEPRECATED(1.6, - "Use ImplicitFunctionValueFunctor.") VTKM_ALWAYS_EXPORT ImplicitFunctionValue -{ -public: - using Scalar = vtkm::ImplicitFunction::Scalar; - using Vector = vtkm::ImplicitFunction::Vector; - - VTKM_EXEC_CONT ImplicitFunctionValue() - : Function(nullptr) - { - } - - VTKM_EXEC_CONT ImplicitFunctionValue(const ImplicitFunction* function) - : Function(function) - { - } - - VTKM_EXEC_CONT Scalar operator()(const Vector& point) const - { - return this->Function->Value(point); - } - -private: - const vtkm::ImplicitFunction* Function; -}; - -/// A helpful functor that calls the (virtual) gradient method of a given ImplicitFunction. Can be -/// passed to things that expect a functor instead of an ImplictFunction class (like an array -/// transform). -/// -class VTKM_DEPRECATED(1.6, "Use ImplicitFunctionGradientFunctor.") - VTKM_ALWAYS_EXPORT ImplicitFunctionGradient -{ -public: - using Scalar = vtkm::ImplicitFunction::Scalar; - using Vector = vtkm::ImplicitFunction::Vector; - - VTKM_EXEC_CONT ImplicitFunctionGradient() - : Function(nullptr) - { - } - - VTKM_EXEC_CONT ImplicitFunctionGradient(const ImplicitFunction* function) - : Function(function) - { - } - - VTKM_EXEC_CONT Vector operator()(const Vector& point) const - { - return this->Function->Gradient(point); - } - -private: - const vtkm::ImplicitFunction* Function; -}; - -VTKM_DEPRECATED_SUPPRESS_END -#endif // VTKM_NO_DEPRECATED_VIRTUAL - //============================================================================ /// A helpful functor that calls the value method of a given `ImplicitFunction`. Can be /// passed to things that expect a functor instead of an `ImplictFunction` class (like an array diff --git a/vtkm/VecFromVirtPortal.h b/vtkm/VecFromVirtPortal.h deleted file mode 100644 index d7d8845a7..000000000 --- a/vtkm/VecFromVirtPortal.h +++ /dev/null @@ -1,69 +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. -//============================================================================ -#ifndef vtk_m_VecFromVirtPortal_h -#define vtk_m_VecFromVirtPortal_h - -#include - -#include -#include - -namespace vtkm -{ - -/// \brief A short variable-length array from a window in an ArrayPortal. -/// -/// The \c VecFromPortal class is a Vec-like class that holds an array portal -/// and exposes a small window of that portal as if it were a \c Vec. -/// -template -class VTKM_ALWAYS_EXPORT VecFromVirtPortal -{ - using RefType = vtkm::internal::ArrayPortalValueReference>; - -public: - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - VecFromVirtPortal(const vtkm::ArrayPortalRef* portal, - vtkm::IdComponent numComponents, - vtkm::Id offset) - : Portal(portal) - , NumComponents(numComponents) - , Offset(offset) - { - } - - VTKM_EXEC_CONT - vtkm::IdComponent GetNumberOfComponents() const { return this->NumComponents; } - - template - VTKM_EXEC_CONT void CopyInto(vtkm::Vec& dest) const - { - vtkm::IdComponent numComponents = vtkm::Min(DestSize, this->NumComponents); - for (vtkm::IdComponent index = 0; index < numComponents; index++) - { - dest[index] = this->Portal->Get(index + this->Offset); - } - } - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - RefType operator[](vtkm::IdComponent index) const - { - return RefType(*this->Portal, index + this->Offset); - } - -private: - const vtkm::ArrayPortalRef* Portal = nullptr; - vtkm::IdComponent NumComponents = 0; - vtkm::Id Offset = 0; -}; -} -#endif diff --git a/vtkm/VirtualObjectBase.h b/vtkm/VirtualObjectBase.h deleted file mode 100644 index c5b7bcb1f..000000000 --- a/vtkm/VirtualObjectBase.h +++ /dev/null @@ -1,94 +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. -//============================================================================ -#ifndef vtk_m_VirtualObjectBase_h -#define vtk_m_VirtualObjectBase_h - -#include -#include - -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -// Do not include this class at all if not compiling virtual methods. - -// This is a deprecated class. Don't warn about deprecation while implementing -// deprecated functionality. -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ - -/// \brief Base class for virtual objects that work in the execution environment -/// -/// Any class built in VTK-m that has virtual methods and is intended to work in both the control -/// and execution environment should inherit from \c VirtualObjectBase. Hierarchies under \c -/// VirtualObjectBase can be used in conjunction with \c VirtualObjectHandle to transfer from the -/// control environment (where they are set up) to the execution environment (where they are used). -/// -/// In addition to inheriting from \c VirtualObjectBase, virtual objects have to satisfy 2 other -/// conditions to work correctly. First, they have to be a plain old data type that can be copied -/// with \c memcpy (with the exception of the virtual table, which \c VirtualObjectHandle will take -/// care of). Second, if the object changes its state in the control environment, it should call -/// \c Modified on itself so the \c VirtualObjectHandle will know it update the object in the -/// execution environment. -/// -class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED( - 1.7, - "Virtual methods are no longer supported in the execution environment.") VirtualObjectBase -{ -public: - VTKM_EXEC_CONT virtual ~VirtualObjectBase() noexcept - { - // This must not be defaulted, since defaulted virtual destructors are - // troublesome with CUDA __host__ __device__ markup. - } - - VTKM_EXEC_CONT void Modified() { this->ModifiedCount++; } - - VTKM_EXEC_CONT vtkm::Id GetModifiedCount() const { return this->ModifiedCount; } - -protected: - VTKM_EXEC_CONT VirtualObjectBase() - : ModifiedCount(0) - { - } - - VTKM_EXEC_CONT VirtualObjectBase(const VirtualObjectBase& other) - { //we implement this as we need a copy constructor with cuda markup - //but using =default causes warnings with CUDA 9 - this->ModifiedCount = other.ModifiedCount; - } - - VTKM_EXEC_CONT VirtualObjectBase(VirtualObjectBase&& other) - : ModifiedCount(other.ModifiedCount) - { - } - - VTKM_EXEC_CONT VirtualObjectBase& operator=(const VirtualObjectBase&) - { - this->Modified(); - return *this; - } - - VTKM_EXEC_CONT VirtualObjectBase& operator=(VirtualObjectBase&&) - { - this->Modified(); - return *this; - } - -private: - vtkm::Id ModifiedCount; -}; - -} // namespace vtkm - -VTKM_DEPRECATED_SUPPRESS_END - -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -#endif //vtk_m_VirtualObjectBase_h diff --git a/vtkm/cont/ArrayHandleVirtual.cxx b/vtkm/cont/ArrayHandleVirtual.cxx deleted file mode 100644 index 062573a68..000000000 --- a/vtkm/cont/ArrayHandleVirtual.cxx +++ /dev/null @@ -1,47 +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. -//============================================================================ -#define vtk_m_cont_ArrayHandleVirtual_cxx -#include - -namespace vtkm -{ -namespace cont -{ - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -#define VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(T) \ - template class VTKM_CONT_EXPORT ArrayHandle; \ - template class VTKM_CONT_EXPORT ArrayHandleVirtual; \ - template class VTKM_CONT_EXPORT ArrayHandle, StorageTagVirtual>; \ - template class VTKM_CONT_EXPORT ArrayHandleVirtual>; \ - template class VTKM_CONT_EXPORT ArrayHandle, StorageTagVirtual>; \ - template class VTKM_CONT_EXPORT ArrayHandleVirtual>; \ - template class VTKM_CONT_EXPORT ArrayHandle, StorageTagVirtual>; \ - template class VTKM_CONT_EXPORT ArrayHandleVirtual> - -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(char); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::Int8); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::UInt8); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::Int16); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::UInt16); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::Int32); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::UInt32); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::Int64); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::UInt64); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::Float32); -VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(vtkm::Float64); - -#undef VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE - -VTKM_DEPRECATED_SUPPRESS_END - -} -} //namespace vtkm::cont diff --git a/vtkm/cont/ArrayHandleVirtual.h b/vtkm/cont/ArrayHandleVirtual.h deleted file mode 100644 index eaca10347..000000000 --- a/vtkm/cont/ArrayHandleVirtual.h +++ /dev/null @@ -1,285 +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. -//============================================================================ -#ifndef vtk_m_cont_ArrayHandleVirtual_h -#define vtk_m_cont_ArrayHandleVirtual_h - -#include - -#include -#include -#include -#include - -#include - -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "ArrayHandleVirtual is removed. Do not include ArrayHandleVirtual.h" -#endif - -namespace vtkm -{ -namespace cont -{ - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -template -VTKM_ARRAY_HANDLE_DEPRECATED(T, vtkm::cont::StorageTagVirtual); - -template -class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6) ArrayHandleVirtual - : public vtkm::cont::ArrayHandle -{ - using StorageType = vtkm::cont::internal::Storage; - -public: - VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleVirtual, - (ArrayHandleVirtual), - (vtkm::cont::ArrayHandle)); - - ///Construct a valid ArrayHandleVirtual from an existing ArrayHandle - ///that doesn't derive from ArrayHandleVirtual. - ///Note left non-explicit to allow: - /// - /// std::vector> vectorOfArrays; - /// //Make basic array. - /// vtkm::cont::ArrayHandle basicArray; - /// //Fill basicArray... - /// vectorOfArrays.push_back(basicArray); - /// - /// // Make fancy array. - /// vtkm::cont::ArrayHandleCounting fancyArray(-1.0, 0.1, ARRAY_SIZE); - /// vectorOfArrays.push_back(fancyArray); - template - ArrayHandleVirtual(const vtkm::cont::ArrayHandle& ah) - : Superclass(StorageType(ah)) - { - using is_base = std::is_base_of; - static_assert(!is_base::value, "Wrong specialization for ArrayHandleVirtual selected"); - } - - /// Returns true if this array matches the type passed in. - /// - template - VTKM_CONT bool IsType() const - { - VTKM_IS_ARRAY_HANDLE(ArrayHandleType); - - //We need to determine if we are checking that `ArrayHandleType` - //is a virtual array handle since that is an easy check. - //Or if we have to go ask the storage if they are holding - // - using ST = typename ArrayHandleType::StorageTag; - using is_base = std::is_same; - - //Determine if the Value type of the virtual and ArrayHandleType - //are the same. This an easy compile time check, and doesn't need - // to be done at runtime. - using VT = typename ArrayHandleType::ValueType; - using same_value_type = std::is_same; - - return this->IsSameType(same_value_type{}, is_base{}); - } - - /// Returns this array cast to the given \c ArrayHandle type. Throws \c - /// ErrorBadType if the cast does not work. Use \c IsType - /// to check if the cast can happen. - /// - template - VTKM_CONT ArrayHandleType Cast() const - { - VTKM_IS_ARRAY_HANDLE(ArrayHandleType); - //We need to determine if we are checking that `ArrayHandleType` - //is a virtual array handle since that is an easy check. - //Or if we have to go ask the storage if they are holding - // - using ST = typename ArrayHandleType::StorageTag; - using is_base = std::is_same; - - //Determine if the Value type of the virtual and ArrayHandleType - //are the same. This an easy compile time check, and doesn't need - // to be done at runtime. - using VT = typename ArrayHandleType::ValueType; - using same_value_type = std::is_same; - - return this->CastToType(same_value_type{}, is_base{}); - } - - /// Returns a new instance of an ArrayHandleVirtual with the same storage - /// - VTKM_CONT ArrayHandleVirtual NewInstance() const - { - return ArrayHandleVirtual(this->GetStorage().NewInstance()); - } - -private: - template - inline bool IsSameType(std::false_type, std::true_type) const - { - return false; - } - template - inline bool IsSameType(std::false_type, std::false_type) const - { - return false; - } - - template - inline bool IsSameType(std::true_type vtkmNotUsed(valueTypesMatch), - std::true_type vtkmNotUsed(inheritsFromArrayHandleVirtual)) const - { - //The type being past has no requirements in being the most derived type - //so the typeid info won't match but dynamic_cast will work - auto casted = dynamic_cast(this); - return casted != nullptr; - } - - template - inline bool IsSameType(std::true_type vtkmNotUsed(valueTypesMatch), - std::false_type vtkmNotUsed(notFromArrayHandleVirtual)) const - { - auto* storage = this->GetStorage().GetStorageVirtual(); - if (!storage) - { - return false; - } - using S = typename ArrayHandleType::StorageTag; - return storage->template IsType>(); - } - - template - inline ArrayHandleType CastToType(std::false_type vtkmNotUsed(valueTypesMatch), - std::true_type vtkmNotUsed(notFromArrayHandleVirtual)) const - { - VTKM_LOG_CAST_FAIL(*this, ArrayHandleType); - throwFailedDynamicCast("ArrayHandleVirtual", vtkm::cont::TypeToString()); - return ArrayHandleType{}; - } - - template - inline ArrayHandleType CastToType(std::false_type vtkmNotUsed(valueTypesMatch), - std::false_type vtkmNotUsed(notFromArrayHandleVirtual)) const - { - VTKM_LOG_CAST_FAIL(*this, ArrayHandleType); - throwFailedDynamicCast("ArrayHandleVirtual", vtkm::cont::TypeToString()); - return ArrayHandleType{}; - } - - template - inline ArrayHandleType CastToType( - std::true_type vtkmNotUsed(valueTypesMatch), - std::true_type vtkmNotUsed(inheritsFromArrayHandleVirtual)) const - { - //The type being passed has no requirements in being the most derived type - //so the typeid info won't match but dynamic_cast will work - const ArrayHandleType* derived = dynamic_cast(this); - if (!derived) - { - VTKM_LOG_CAST_FAIL(*this, ArrayHandleType); - throwFailedDynamicCast("ArrayHandleVirtual", vtkm::cont::TypeToString()); - } - VTKM_LOG_CAST_SUCC(*this, derived); - return *derived; - } - - template - ArrayHandleType CastToType(std::true_type vtkmNotUsed(valueTypesMatch), - std::false_type vtkmNotUsed(notFromArrayHandleVirtual)) const; -}; - - -//============================================================================= -/// A convenience function for creating an ArrayHandleVirtual. -template -VTKM_CONT vtkm::cont::ArrayHandleVirtual make_ArrayHandleVirtual( - const vtkm::cont::ArrayHandle& ah) -{ - return vtkm::cont::ArrayHandleVirtual(ah); -} - -//============================================================================= -// Free function casting helpers - -/// Returns true if \c virtHandle matches the type of ArrayHandleType. -/// -template -VTKM_CONT inline bool IsType( - const vtkm::cont::ArrayHandle& virtHandle) -{ - return static_cast>(virtHandle) - .template IsType(); -} - -/// Returns \c virtHandle cast to the given \c ArrayHandle type. Throws \c -/// ErrorBadType if the cast does not work. Use \c IsType -/// to check if the cast can happen. -/// -template -VTKM_CONT inline ArrayHandleType Cast( - const vtkm::cont::ArrayHandle& virtHandle) -{ - return static_cast>(virtHandle) - .template Cast(); -} -//============================================================================= -// Specializations of serialization related classes -/// @cond SERIALIZATION -template -struct SerializableTypeString> -{ - static VTKM_CONT const std::string& Get() - { - static std::string name = "AH_Virtual<" + SerializableTypeString::Get() + ">"; - return name; - } -}; - -template -struct SerializableTypeString> - : public SerializableTypeString> -{ -}; - -#ifndef vtk_m_cont_ArrayHandleVirtual_cxx - -#define VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(T) \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandleVirtual; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle, StorageTagVirtual>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandleVirtual>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle, StorageTagVirtual>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandleVirtual>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle, StorageTagVirtual>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandleVirtual> - -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(char); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::Int8); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::UInt8); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::Int16); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::UInt16); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::Int32); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::UInt32); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::Int64); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::UInt64); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::Float32); -VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::Float64); - -#undef VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT - -#endif //vtk_m_cont_ArrayHandleVirtual_cxx -VTKM_DEPRECATED_SUPPRESS_END -} -} //namespace vtkm::cont - -/// @endcond SERIALIZATION - -#endif //vtk_m_cont_ArrayHandleVirtual_h diff --git a/vtkm/cont/ArrayHandleVirtual.hxx b/vtkm/cont/ArrayHandleVirtual.hxx deleted file mode 100644 index d96e59ba0..000000000 --- a/vtkm/cont/ArrayHandleVirtual.hxx +++ /dev/null @@ -1,186 +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. -//============================================================================ -#ifndef vtk_m_cont_ArrayHandleVirtual_hxx -#define vtk_m_cont_ArrayHandleVirtual_hxx - -#include -#include - -VTKM_DEPRECATED_SUPPRESS_BEGIN -namespace vtkm -{ -namespace cont -{ - -template -template -ArrayHandleType inline ArrayHandleVirtual::CastToType( - std::true_type vtkmNotUsed(valueTypesMatch), - std::false_type vtkmNotUsed(notFromArrayHandleVirtual)) const -{ - auto* storage = this->GetStorage().GetStorageVirtual(); - if (!storage) - { - VTKM_LOG_CAST_FAIL(*this, ArrayHandleType); - throwFailedDynamicCast("ArrayHandleVirtual", vtkm::cont::TypeToString()); - } - using S = typename ArrayHandleType::StorageTag; - const auto* castStorage = - storage->template Cast>(); - return castStorage->GetHandle(); -} -} -} // namespace vtkm::cont -VTKM_DEPRECATED_SUPPRESS_END - - -#include -#include - -//============================================================================= -// Specializations of serialization related classes -/// @cond SERIALIZATION -VTKM_DEPRECATED_SUPPRESS_BEGIN -namespace mangled_diy_namespace -{ - -template -struct Serialization> -{ - - static VTKM_CONT void save(vtkmdiy::BinaryBuffer& bb, - const vtkm::cont::ArrayHandleVirtual& obj) - { - vtkm::cont::ArrayHandle array; - if (obj.template IsType()) - { - array = obj.template Cast(); - } - else - { - vtkm::Id size = obj.GetNumberOfValues(); - array.Allocate(size); - auto src = obj.ReadPortal(); - auto dest = array.WritePortal(); - for (vtkm::IdComponent index = 0; index < size; ++index) - { - dest.Set(index, src.Get(index)); - } - } - vtkmdiy::save(bb, array); - } - - static VTKM_CONT void load(BinaryBuffer& bb, vtkm::cont::ArrayHandleVirtual& obj) - { - vtkm::cont::ArrayHandle array; - vtkmdiy::load(bb, array); - obj = std::move(vtkm::cont::ArrayHandleVirtual{ array }); - } -}; - -template -struct IntAnySerializer -{ - using CountingType = vtkm::cont::ArrayHandleCounting; - using ConstantType = vtkm::cont::ArrayHandleConstant; - using BasicType = vtkm::cont::ArrayHandle; - - static VTKM_CONT void save(vtkmdiy::BinaryBuffer& bb, - const vtkm::cont::ArrayHandleVirtual& obj) - { - if (obj.template IsType()) - { - vtkmdiy::save(bb, vtkm::cont::SerializableTypeString::Get()); - - using S = typename CountingType::StorageTag; - const vtkm::cont::internal::detail::StorageVirtual* storage = - obj.GetStorage().GetStorageVirtual(); - auto* castStorage = storage->Cast>(); - vtkmdiy::save(bb, castStorage->GetHandle()); - } - else if (obj.template IsType()) - { - vtkmdiy::save(bb, vtkm::cont::SerializableTypeString::Get()); - - using S = typename ConstantType::StorageTag; - const vtkm::cont::internal::detail::StorageVirtual* storage = - obj.GetStorage().GetStorageVirtual(); - auto* castStorage = storage->Cast>(); - vtkmdiy::save(bb, castStorage->GetHandle()); - } - else - { - vtkmdiy::save(bb, vtkm::cont::SerializableTypeString::Get()); - BasicType array; - vtkm::Id size = obj.GetNumberOfValues(); - array.Allocate(size); - auto src = obj.ReadPortal(); - auto dest = array.WritePortal(); - for (vtkm::IdComponent index = 0; index < size; ++index) - { - dest.Set(index, src.Get(index)); - } - vtkmdiy::save(bb, array); - } - } - - static VTKM_CONT void load(BinaryBuffer& bb, vtkm::cont::ArrayHandleVirtual& obj) - { - std::string typeString; - vtkmdiy::load(bb, typeString); - - if (typeString == vtkm::cont::SerializableTypeString::Get()) - { - CountingType array; - vtkmdiy::load(bb, array); - obj = std::move(vtkm::cont::ArrayHandleVirtual{ array }); - } - else if (typeString == vtkm::cont::SerializableTypeString::Get()) - { - ConstantType array; - vtkmdiy::load(bb, array); - obj = std::move(vtkm::cont::ArrayHandleVirtual{ array }); - } - else - { - vtkm::cont::ArrayHandle array; - vtkmdiy::load(bb, array); - obj = std::move(vtkm::cont::ArrayHandleVirtual{ array }); - } - } -}; - - -template <> -struct Serialization> - : public IntAnySerializer -{ -}; -template <> -struct Serialization> - : public IntAnySerializer -{ -}; -template <> -struct Serialization> - : public IntAnySerializer -{ -}; - -template -struct Serialization> - : public Serialization> -{ -}; - -} // mangled_diy_namespace -VTKM_DEPRECATED_SUPPRESS_END - -#endif diff --git a/vtkm/cont/ArrayHandleVirtualCoordinates.h b/vtkm/cont/ArrayHandleVirtualCoordinates.h deleted file mode 100644 index bebb5b7f2..000000000 --- a/vtkm/cont/ArrayHandleVirtualCoordinates.h +++ /dev/null @@ -1,191 +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. -//============================================================================ -#ifndef vtk_m_cont_ArrayHandleVirtualCoordinates_h -#define vtk_m_cont_ArrayHandleVirtualCoordinates_h - -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "ArrayHandleVirtualCoordiantes is removed. Do not include ArrayHandleVirtualCoordinates.h" -#endif - -namespace vtkm -{ -namespace cont -{ - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -/// ArrayHandleVirtualCoordinates is a specialization of ArrayHandle. -class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6, "Virtual ArrayHandles are being phased out.") - ArrayHandleVirtualCoordinates final : public vtkm::cont::ArrayHandleVirtual -{ -public: - VTKM_ARRAY_HANDLE_SUBCLASS_NT(ArrayHandleVirtualCoordinates, - (vtkm::cont::ArrayHandleVirtual)); - - template - explicit ArrayHandleVirtualCoordinates(const vtkm::cont::ArrayHandle& ah) - : vtkm::cont::ArrayHandleVirtual(vtkm::cont::make_ArrayHandleCast(ah)) - { - } -}; - -template -void CastAndCall(const vtkm::cont::ArrayHandleVirtualCoordinates& coords, - Functor&& f, - Args&&... args) -{ - using HandleType = ArrayHandleUniformPointCoordinates; - if (coords.IsType()) - { - HandleType uniform = coords.Cast(); - f(uniform, std::forward(args)...); - } - else - { - f(coords, std::forward(args)...); - } -} - - -template <> -struct SerializableTypeString -{ - static VTKM_CONT const std::string Get() { return "AH_VirtualCoordinates"; } -}; - -VTKM_DEPRECATED_SUPPRESS_END - -} // namespace cont -} // namespace vtkm - -//============================================================================= -// Specializations of serialization related classes -/// @cond SERIALIZATION -namespace mangled_diy_namespace -{ - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -template <> -struct Serialization -{ -private: - using Type = vtkm::cont::ArrayHandleVirtualCoordinates; - using BaseType = vtkm::cont::ArrayHandle; - - using BasicCoordsType = vtkm::cont::ArrayHandle; - using RectilinearCoordsArrayType = - vtkm::cont::ArrayHandleCartesianProduct, - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle>; - -public: - static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& baseObj) - { - Type obj(baseObj); - const vtkm::cont::internal::detail::StorageVirtual* storage = - obj.GetStorage().GetStorageVirtual(); - if (obj.IsType()) - { - using HandleType = vtkm::cont::ArrayHandleUniformPointCoordinates; - using T = typename HandleType::ValueType; - using S = typename HandleType::StorageTag; - auto array = storage->Cast>(); - vtkmdiy::save(bb, vtkm::cont::SerializableTypeString::Get()); - vtkmdiy::save(bb, array->GetHandle()); - } - else if (obj.IsType()) - { - using HandleType = RectilinearCoordsArrayType; - using T = typename HandleType::ValueType; - using S = typename HandleType::StorageTag; - auto array = storage->Cast>(); - vtkmdiy::save(bb, vtkm::cont::SerializableTypeString::Get()); - vtkmdiy::save(bb, array->GetHandle()); - } - else - { - using HandleType = BasicCoordsType; - using T = typename HandleType::ValueType; - using S = typename HandleType::StorageTag; - HandleType array; - if (obj.IsType()) - { - // If the object actually is a BasicCoordsType, just save it. - array = - storage->Cast>()->GetHandle(); - } - else - { - // Give up and deep copy data. - vtkm::Id size = obj.GetNumberOfValues(); - array.Allocate(size); - auto src = obj.ReadPortal(); - auto dest = array.WritePortal(); - for (vtkm::IdComponent index = 0; index < size; ++index) - { - dest.Set(index, src.Get(index)); - } - } - vtkmdiy::save(bb, vtkm::cont::SerializableTypeString::Get()); - vtkmdiy::save(bb, array); - } - } - - static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj) - { - std::string typeString; - vtkmdiy::load(bb, typeString); - - if (typeString == - vtkm::cont::SerializableTypeString::Get()) - { - vtkm::cont::ArrayHandleUniformPointCoordinates array; - vtkmdiy::load(bb, array); - obj = vtkm::cont::ArrayHandleVirtualCoordinates(array); - } - else if (typeString == vtkm::cont::SerializableTypeString::Get()) - { - RectilinearCoordsArrayType array; - vtkmdiy::load(bb, array); - obj = vtkm::cont::ArrayHandleVirtualCoordinates(array); - } - else if (typeString == vtkm::cont::SerializableTypeString::Get()) - { - BasicCoordsType array; - vtkmdiy::load(bb, array); - obj = vtkm::cont::ArrayHandleVirtualCoordinates(array); - } - else - { - throw vtkm::cont::ErrorBadType( - "Error deserializing ArrayHandleVirtualCoordinates. TypeString: " + typeString); - } - } -}; - -VTKM_DEPRECATED_SUPPRESS_END - -} // diy -/// @endcond SERIALIZATION - -#endif // vtk_m_cont_ArrayHandleVirtualCoordinates_h diff --git a/vtkm/cont/ArrayRangeComputeTemplate.h b/vtkm/cont/ArrayRangeComputeTemplate.h index cd67d327d..2e593e1aa 100644 --- a/vtkm/cont/ArrayRangeComputeTemplate.h +++ b/vtkm/cont/ArrayRangeComputeTemplate.h @@ -17,10 +17,6 @@ #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif - #include namespace vtkm @@ -100,49 +96,6 @@ inline vtkm::cont::ArrayHandle ArrayRangeComputeImpl( } // namespace detail -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -VTKM_DEPRECATED_SUPPRESS_BEGIN -VTKM_CONT -inline vtkm::cont::ArrayHandle ArrayRangeCompute( - const vtkm::cont::ArrayHandleVirtual& input, - vtkm::cont::DeviceAdapterId device) -{ - using UniformHandleType = ArrayHandleUniformPointCoordinates; - using RectilinearHandleType = - vtkm::cont::ArrayHandleCartesianProduct, - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle>; - - if (input.IsType()) - { - using T = typename UniformHandleType::ValueType; - using S = typename UniformHandleType::StorageTag; - const vtkm::cont::internal::detail::StorageVirtual* storage = - input.GetStorage().GetStorageVirtual(); - const auto* castStorage = - storage->Cast>(); - - return ArrayRangeCompute(castStorage->GetHandle(), device); - } - else if (input.IsType()) - { - using T = typename RectilinearHandleType::ValueType; - using S = typename RectilinearHandleType::StorageTag; - const vtkm::cont::internal::detail::StorageVirtual* storage = - input.GetStorage().GetStorageVirtual(); - const auto* castStorage = - storage->Cast>(); - - return ArrayRangeCompute(castStorage->GetHandle(), device); - } - else - { - return detail::ArrayRangeComputeImpl(input, device); - } -} -VTKM_DEPRECATED_SUPPRESS_END -#endif //VTKM_NO_DEPRECATED_VIRTUAL - template inline vtkm::cont::ArrayHandle ArrayRangeCompute( const ArrayHandleType& input, diff --git a/vtkm/cont/CMakeLists.txt b/vtkm/cont/CMakeLists.txt index 84f9ab0a0..485c8ae2e 100644 --- a/vtkm/cont/CMakeLists.txt +++ b/vtkm/cont/CMakeLists.txt @@ -102,7 +102,6 @@ set(headers Field.h FieldRangeCompute.h FieldRangeGlobalCompute.h - ImplicitFunctionHandle.h Initialize.h Invoker.h Logging.h @@ -133,7 +132,6 @@ set(template_sources ArrayRangeCompute.hxx # Deprecated, replaced with ArrayRangeComputeTemplate.h CellSetExplicit.hxx ParticleArrayCopy.hxx - VirtualObjectHandle.hxx ) set(sources @@ -215,31 +213,6 @@ set(device_sources Timer.cxx ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - ArrayHandleVirtual.h - ArrayHandleVirtualCoordinates.h - CellLocator.h - PointLocator.h - StorageVirtual.h - VirtualObjectHandle.h - ) - - set(template_sources ${template_sources} - ArrayHandleVirtual.hxx - StorageVirtual.hxx - ) - - set(device_sources ${device_sources} - ArrayHandleVirtual.cxx - CellLocator.cxx - internal/TransferInfo.cxx - internal/VirtualObjectTransfer.cxx - PointLocator.cxx - StorageVirtual.cxx - ) -endif() - #----------------------------------------------------------------------------- # Set up default types, which can be custom configured by other build systems. vtkm_get_kit_name(kit_name kit_dir) diff --git a/vtkm/cont/CellLocator.cxx b/vtkm/cont/CellLocator.cxx deleted file mode 100644 index 146290e45..000000000 --- a/vtkm/cont/CellLocator.cxx +++ /dev/null @@ -1,21 +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. -//============================================================================ - -#include - -namespace vtkm -{ -namespace cont -{ -VTKM_DEPRECATED_SUPPRESS_BEGIN -CellLocator::~CellLocator() = default; -VTKM_DEPRECATED_SUPPRESS_END -} -} diff --git a/vtkm/cont/CellLocator.h b/vtkm/cont/CellLocator.h deleted file mode 100644 index a4c6596dc..000000000 --- a/vtkm/cont/CellLocator.h +++ /dev/null @@ -1,96 +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. -//============================================================================ -#ifndef vtk_m_cont_CellLocator_h -#define vtk_m_cont_CellLocator_h - -#include - -#include -#include -#include -#include -#include - -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "CellLocator with virtual methods is removed. Do not include CellLocator.h" -#endif - -namespace vtkm -{ -namespace cont -{ - -class VTKM_CONT_EXPORT VTKM_DEPRECATED(1.6, - "CellLocator with virtual methods no longer supported. Use " - "CellLocatorGeneral or CellLocatorChooser.") CellLocator - : public vtkm::cont::ExecutionObjectBase -{ - VTKM_DEPRECATED_SUPPRESS_BEGIN - -public: - virtual ~CellLocator(); - - const vtkm::cont::UnknownCellSet& GetCellSet() const { return this->CellSet; } - - void SetCellSet(const vtkm::cont::UnknownCellSet& cellSet) - { - this->CellSet = cellSet; - this->SetModified(); - } - - const vtkm::cont::CoordinateSystem& GetCoordinates() const { return this->Coords; } - - void SetCoordinates(const vtkm::cont::CoordinateSystem& coords) - { - this->Coords = coords; - this->SetModified(); - } - - void Update() - { - if (this->Modified) - { - this->Build(); - this->Modified = false; - } - } - - VTKM_CONT virtual const vtkm::exec::CellLocator* PrepareForExecution( - vtkm::cont::DeviceAdapterId device, - vtkm::cont::Token& token) const = 0; - - VTKM_CONT - VTKM_DEPRECATED(1.6, "PrepareForExecution now requires a vtkm::cont::Token object.") - const vtkm::exec::CellLocator* PrepareForExecution(vtkm::cont::DeviceAdapterId device) const - { - vtkm::cont::Token token; - return this->PrepareForExecution(device, token); - } - -protected: - void SetModified() { this->Modified = true; } - bool GetModified() const { return this->Modified; } - - //This is going to need a TryExecute - VTKM_CONT virtual void Build() = 0; - -private: - vtkm::cont::UnknownCellSet CellSet; - vtkm::cont::CoordinateSystem Coords; - bool Modified = true; -}; -VTKM_DEPRECATED_SUPPRESS_END - -} // namespace cont -} // namespace vtkm - -#endif // vtk_m_cont_CellLocator_h diff --git a/vtkm/cont/CoordinateSystem.cxx b/vtkm/cont/CoordinateSystem.cxx index 6e63b5037..44badd57b 100644 --- a/vtkm/cont/CoordinateSystem.cxx +++ b/vtkm/cont/CoordinateSystem.cxx @@ -17,20 +17,6 @@ namespace vtkm namespace cont { -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -namespace detail -{ - -VTKM_DEPRECATED_SUPPRESS_BEGIN -vtkm::cont::ArrayHandleVirtualCoordinates CoordDataDepWrapper::ToArray() const -{ - return this->AsArrayHandle(); -} -VTKM_DEPRECATED_SUPPRESS_END - -} // namespace detail -#endif //VTKM_NO_DEPRECATED_VIRTUAL - VTKM_CONT CoordinateSystem::CoordinateSystem() : Superclass() { @@ -55,19 +41,12 @@ CoordinateSystem::CoordinateSystem(std::string name, { } -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -VTKM_CONT vtkm::cont::detail::CoordDataDepWrapper CoordinateSystem::GetData() const -{ - return vtkm::cont::detail::CoordDataDepWrapper(this->Superclass::GetData()); -} -#else //!VTKM_NO_DEPRECATED_VIRTUAL VTKM_CONT vtkm::cont::UncertainArrayHandle CoordinateSystem::GetData() const { return vtkm::cont::UncertainArrayHandle( this->Superclass::GetData()); } -#endif //!VTKM_NO_DEPRECATED_VIRTUAL VTKM_CONT vtkm::cont::CoordinateSystem::MultiplexerArrayType diff --git a/vtkm/cont/CoordinateSystem.h b/vtkm/cont/CoordinateSystem.h index 5e11ab937..7f1a2ff06 100644 --- a/vtkm/cont/CoordinateSystem.h +++ b/vtkm/cont/CoordinateSystem.h @@ -18,113 +18,11 @@ #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif - namespace vtkm { namespace cont { -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -namespace detail -{ - -// CoordinateSystem::GetData used to return an ArrayHandleVirtualCoordinates. -// That behavior is deprecated, and CoordianteSystem::GetData now returns am -// UncertainArrayHandle similar (although slightly different than) its superclass. -// This wrapper class supports the old deprecated behavior until it is no longer -// supported. Once the behavior is removed (probably when -// ArrayHandleVirtualCoordinates is removed), then this class should be removed. -class VTKM_ALWAYS_EXPORT CoordDataDepWrapper - : public vtkm::cont::UncertainArrayHandle -{ - using Superclass = - vtkm::cont::UncertainArrayHandle; - - VTKM_DEPRECATED_SUPPRESS_BEGIN - VTKM_CONT_EXPORT VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates ToArray() const; - VTKM_DEPRECATED_SUPPRESS_END - -public: - using Superclass::Superclass; - - // Make the return also behave as ArrayHandleVirtualCoordiantes - VTKM_DEPRECATED_SUPPRESS_BEGIN - - VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - operator vtkm::cont::ArrayHandleVirtualCoordinates() const - { - return this->ToArray(); - } - - VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - operator vtkm::cont::ArrayHandle() const - { - return this->ToArray(); - } - - using ValueType VTKM_DEPRECATED( - 1.6, - "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") = vtkm::Vec3f; - - VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - ArrayHandleVirtualCoordinates::ReadPortalType ReadPortal() const - { - return this->ToArray().ReadPortal(); - } - - VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - ArrayHandleVirtualCoordinates::WritePortalType WritePortal() const - { - return this->ToArray().WritePortal(); - } - - template - VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - typename ArrayHandleVirtualCoordinates::ReadPortalType - PrepareForInput(Device device, vtkm::cont::Token& token) const - { - return this->ToArray().PrepareForInput(device, token); - } - - template - VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - typename ArrayHandleVirtualCoordinates::WritePortalType - PrepareForInPlace(Device device, vtkm::cont::Token& token) const - { - return this->ToArray().PrepareForInPlace(device, token); - } - - template - VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - typename ArrayHandleVirtualCoordinates::WritePortalType - PrepareForOutput(vtkm::Id numberOfValues, Device device, vtkm::cont::Token& token) const - { - return this->ToArray().PrepareForOutput(numberOfValues, device, token); - } - - VTKM_DEPRECATED_SUPPRESS_END -}; - -} // namespace detail - -VTKM_DEPRECATED_SUPPRESS_BEGIN -VTKM_CONT VTKM_DEPRECATED( - 1.6, - "CoordinateSystem::GetData() now returns an " - "UncertainArrayHandle.") inline void printSummary_ArrayHandle(const detail::CoordDataDepWrapper& - array, - std::ostream& out, - bool full = false) -{ - vtkm::cont::ArrayHandleVirtualCoordinates coordArray = array; - vtkm::cont::printSummary_ArrayHandle(coordArray, out, full); -} -VTKM_DEPRECATED_SUPPRESS_END -#endif //VTKM_NO_DEPRECATED_VIRTUAL - class VTKM_CONT_EXPORT CoordinateSystem : public vtkm::cont::Field { using Superclass = vtkm::cont::Field; @@ -152,12 +50,8 @@ public: VTKM_CONT vtkm::Id GetNumberOfPoints() const { return this->GetNumberOfValues(); } -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - VTKM_CONT detail::CoordDataDepWrapper GetData() const; -#else VTKM_CONT vtkm::cont::UncertainArrayHandle GetData() const; -#endif private: #ifdef VTKM_USE_DOUBLE_PRECISION @@ -275,14 +169,6 @@ struct DynamicTransformTraits using DynamicTag = vtkm::cont::internal::DynamicTransformTagCastAndCall; }; -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -template <> -struct DynamicTransformTraits -{ - using DynamicTag = vtkm::cont::internal::DynamicTransformTagCastAndCall; -}; -#endif //VTKM_NO_DEPRECATED_VIRTUAL - } // namespace internal } // namespace cont @@ -294,16 +180,6 @@ struct DynamicTransformTraits namespace mangled_diy_namespace { -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -template <> -struct Serialization - : public Serialization< - vtkm::cont::UncertainArrayHandle, - VTKM_DEFAULT_STORAGE_LIST>> -{ -}; -#endif //VTKM_NO_DEPRECATED_VIRTUAL - template <> struct Serialization : Serialization { diff --git a/vtkm/cont/ImplicitFunctionHandle.h b/vtkm/cont/ImplicitFunctionHandle.h deleted file mode 100644 index d3284a735..000000000 --- a/vtkm/cont/ImplicitFunctionHandle.h +++ /dev/null @@ -1,264 +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. -//============================================================================ -#ifndef vtk_m_cont_ImplicitFunctionHandle_h -#define vtk_m_cont_ImplicitFunctionHandle_h - -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "ImplicitFunction with virtual methods is removed. Do not include ImplicitFunctionHeader.h" -#endif - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ -namespace cont -{ - -namespace detail -{ - -// Wrong namespace, but it's only for deprecated code. -template -class VTKM_ALWAYS_EXPORT ImplicitFunctionBaseExecWrapper : public vtkm::ImplicitFunction -{ - FunctionType Function; - -public: - VTKM_CONT ImplicitFunctionBaseExecWrapper(const FunctionType& function) - : Function(function) - { - } - - VTKM_EXEC_CONT virtual ~ImplicitFunctionBaseExecWrapper() noexcept override - { - // This must not be defaulted, since defaulted virtual destructors are - // troublesome with CUDA __host__ __device__ markup. - } - - VTKM_EXEC_CONT virtual Scalar Value(const Vector& point) const override - { - return this->Function.Value(point); - } - - VTKM_EXEC_CONT virtual Vector Gradient(const Vector& point) const override - { - return this->Function.Gradient(point); - } -}; - -} // vtkm::cont::detail - -class VTKM_DEPRECATED(1.6, - "ImplicitFunctions with virtual methods are no longer supported. " - "Use vtkm::ImplicitFunctionX classes directly.") VTKM_ALWAYS_EXPORT - ImplicitFunctionHandle : public vtkm::cont::VirtualObjectHandle -{ -private: - using Superclass = vtkm::cont::VirtualObjectHandle; - -public: - ImplicitFunctionHandle() = default; - - template ::value>::type> - explicit ImplicitFunctionHandle(VirtualDerivedType* function, - bool acquireOwnership = true, - DeviceAdapterList devices = DeviceAdapterList()) - : Superclass(function, acquireOwnership, devices) - { - } - - template - explicit ImplicitFunctionHandle( - vtkm::internal::ImplicitFunctionBase* function, - bool acquireOwnership = true, - DeviceAdapterList devices = DeviceAdapterList()) - : Superclass(new detail::ImplicitFunctionBaseExecWrapper( - *reinterpret_cast(function)), - true, - devices) - { - if (acquireOwnership) - { - delete function; - } - } - - template - VTKM_CONT void Reset(vtkm::internal::ImplicitFunctionBase* function, - bool acquireOwnership = true, - DeviceAdapterList devices = DeviceAdapterList{}) - { - this->Reset(new detail::ImplicitFunctionBaseExecWrapper( - *reinterpret_cast(function)), - true, - devices); - if (acquireOwnership) - { - delete function; - } - } - - template ::value>::type> - VTKM_CONT void Reset(VirtualDerivedType* derived, - bool acquireOwnership = true, - DeviceAdapterList devices = DeviceAdapterList()) - { - this->Superclass::Reset(derived, acquireOwnership, devices); - } -}; - -template -VTKM_DEPRECATED(1.6, - "ImplicitFunctions with virtual methods are no longer supported. " - "Use vtkm::ImplicitFunctionX classes directly.") -VTKM_CONT ImplicitFunctionHandle - make_ImplicitFunctionHandle(ImplicitFunctionType&& func, - DeviceAdapterList devices = DeviceAdapterList()) -{ - using IFType = typename std::remove_reference::type; - return ImplicitFunctionHandle( - new IFType(std::forward(func)), true, devices); -} - -template -VTKM_DEPRECATED(1.6, - "ImplicitFunctions with virtual methods are no longer supported. " - "Use vtkm::ImplicitFunctionX classes directly.") -VTKM_CONT ImplicitFunctionHandle make_ImplicitFunctionHandle(Args&&... args) -{ - return ImplicitFunctionHandle(new ImplicitFunctionType(std::forward(args)...), - true, - VTKM_DEFAULT_DEVICE_ADAPTER_LIST()); -} - -template -VTKM_CONT ImplicitFunctionHandle make_ImplicitFunctionHandle(Args&&... args) -{ - return ImplicitFunctionHandle( - new ImplicitFunctionType(std::forward(args)...), true, DeviceAdapterList()); -} - -//============================================================================ -/// A helpful wrapper that returns a functor that calls the (virtual) value method of a given -/// ImplicitFunction. Can be passed to things that expect a functor instead of an ImplictFunction -/// class (like an array transform). -/// -class VTKM_DEPRECATED(1.6, - "ImplicitFunctions with virtual methods are no longer supported. " - "Use vtkm::ImplicitFunctionValueFunctor.") - VTKM_ALWAYS_EXPORT ImplicitFunctionValueHandle : public vtkm::cont::ExecutionAndControlObjectBase -{ - vtkm::cont::ImplicitFunctionHandle Handle; - -public: - ImplicitFunctionValueHandle() = default; - - ImplicitFunctionValueHandle(const ImplicitFunctionHandle& handle) - : Handle(handle) - { - } - - template - explicit ImplicitFunctionValueHandle(ImplicitFunctionType* function, - bool acquireOwnership = true, - DeviceAdapterList devices = DeviceAdapterList()) - : Handle(function, acquireOwnership, devices) - { - } - - VTKM_CONT const vtkm::cont::ImplicitFunctionHandle& GetHandle() const { return this->Handle; } - - VTKM_CONT - vtkm::ImplicitFunctionValue PrepareForExecution(vtkm::cont::DeviceAdapterId device, - vtkm::cont::Token& token) const - { - return vtkm::ImplicitFunctionValue(this->Handle.PrepareForExecution(device, token)); - } - - VTKM_CONT vtkm::ImplicitFunctionValue PrepareForControl() const - { - return vtkm::ImplicitFunctionValue(this->Handle.PrepareForControl()); - } -}; - -template -VTKM_DEPRECATED(1.6, - "ImplicitFunctions with virtual methods are no longer supported. " - "Use vtkm::ImplicitFunctionValueFunctor.") -VTKM_CONT ImplicitFunctionValueHandle - make_ImplicitFunctionValueHandle(ImplicitFunctionType&& func, - DeviceAdapterList devices = DeviceAdapterList()) -{ - using IFType = typename std::remove_reference::type; - return ImplicitFunctionValueHandle( - new IFType(std::forward(func)), true, devices); -} - -template -VTKM_DEPRECATED(1.6, - "ImplicitFunctions with virtual methods are no longer supported. " - "Use vtkm::ImplicitFunctionValueFunctor.") -VTKM_CONT ImplicitFunctionValueHandle make_ImplicitFunctionValueHandle(Args&&... args) -{ - return ImplicitFunctionValueHandle(new ImplicitFunctionType(std::forward(args)...), - true, - VTKM_DEFAULT_DEVICE_ADAPTER_LIST()); -} - -template -VTKM_DEPRECATED(1.6, - "ImplicitFunctions with virtual methods are no longer supported. " - "Use vtkm::ImplicitFunctionValueFunctor.") -VTKM_CONT ImplicitFunctionValueHandle make_ImplicitFunctionValueHandle(Args&&... args) -{ - return ImplicitFunctionValueHandle( - new ImplicitFunctionType(std::forward(args)...), true, DeviceAdapterList()); -} -} -} // vtkm::cont - -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -// Cuda seems to have a bug where it expects the template class VirtualObjectTransfer -// to be instantiated in a consistent order among all the translation units of an -// executable. Failing to do so results in random crashes and incorrect results. -// We workaroud this issue by explicitly instantiating VirtualObjectTransfer for -// all the implicit functions here. -#ifdef VTKM_CUDA -#include -VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( - vtkm::cont::detail::ImplicitFunctionBaseExecWrapper); -VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( - vtkm::cont::detail::ImplicitFunctionBaseExecWrapper); -VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( - vtkm::cont::detail::ImplicitFunctionBaseExecWrapper); -VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( - vtkm::cont::detail::ImplicitFunctionBaseExecWrapper); -VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( - vtkm::cont::detail::ImplicitFunctionBaseExecWrapper); -#endif -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -VTKM_DEPRECATED_SUPPRESS_END - -#endif // vtk_m_cont_ImplicitFunctionHandle_h diff --git a/vtkm/cont/PointLocator.cxx b/vtkm/cont/PointLocator.cxx deleted file mode 100644 index 483dc25cd..000000000 --- a/vtkm/cont/PointLocator.cxx +++ /dev/null @@ -1,31 +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 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2019 UT-Battelle, LLC. -// Copyright 2019 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. -//============================================================================ - -#include - -namespace vtkm -{ -namespace cont -{ -VTKM_DEPRECATED_SUPPRESS_BEGIN -PointLocator::~PointLocator() = default; -VTKM_DEPRECATED_SUPPRESS_BEGIN -} -} diff --git a/vtkm/cont/PointLocator.h b/vtkm/cont/PointLocator.h deleted file mode 100644 index e8d24fbe4..000000000 --- a/vtkm/cont/PointLocator.h +++ /dev/null @@ -1,88 +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. -//============================================================================ -#ifndef vtk_m_cont_PointLocator_h -#define vtk_m_cont_PointLocator_h - -#include -#include - -#include -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "PointLocator with virtual methods is removed. Do not include PointLocator.h" -#endif - -namespace vtkm -{ -namespace cont -{ - -class VTKM_CONT_EXPORT VTKM_DEPRECATED(1.6, "PointLocator with virtual methods no longer supported") - PointLocator : public vtkm::cont::ExecutionObjectBase -{ - VTKM_DEPRECATED_SUPPRESS_BEGIN - -public: - virtual ~PointLocator(); - - PointLocator() - : Modified(true) - { - } - - vtkm::cont::CoordinateSystem GetCoordinates() const { return this->Coords; } - - void SetCoordinates(const vtkm::cont::CoordinateSystem& coords) - { - this->Coords = coords; - this->SetModified(); - } - - void Update() - { - if (this->Modified) - { - Build(); - this->Modified = false; - } - } - - VTKM_CONT virtual const vtkm::exec::PointLocator* PrepareForExecution( - vtkm::cont::DeviceAdapterId device, - vtkm::cont::Token& token) const = 0; - - VTKM_CONT - VTKM_DEPRECATED(1.6, "PrepareForExecution now requires a vtkm::cont::Token object") - const vtkm::exec::PointLocator* PrepareForExecution(vtkm::cont::DeviceAdapterId device) const - { - vtkm::cont::Token token; - return this->PrepareForExecution(device, token); - } - -protected: - void SetModified() { this->Modified = true; } - - bool GetModified() const { return this->Modified; } - - virtual void Build() = 0; - -private: - vtkm::cont::CoordinateSystem Coords; - bool Modified; -}; -VTKM_DEPRECATED_SUPPRESS_END - -} // namespace vtkm::cont -} // namespace vtkm - -#endif // vtk_m_cont_PointLocator_h diff --git a/vtkm/cont/StorageVirtual.cxx b/vtkm/cont/StorageVirtual.cxx deleted file mode 100644 index d1174b5bc..000000000 --- a/vtkm/cont/StorageVirtual.cxx +++ /dev/null @@ -1,223 +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. -//============================================================================ -#define vtk_m_cont_StorageVirtual_cxx -#include - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ -namespace detail -{ - - -//-------------------------------------------------------------------- -StorageVirtual::StorageVirtual(const StorageVirtual& src) - : DeviceUpToDate(src.DeviceUpToDate) - , DeviceTransferState(src.DeviceTransferState) -{ -} - -//-------------------------------------------------------------------- -StorageVirtual::StorageVirtual(StorageVirtual&& src) noexcept - : DeviceUpToDate(src.DeviceUpToDate) - , DeviceTransferState(std::move(src.DeviceTransferState)) -{ -} - -//-------------------------------------------------------------------- -StorageVirtual& StorageVirtual::operator=(const StorageVirtual& src) -{ - this->DeviceUpToDate = src.DeviceUpToDate; - this->DeviceTransferState = src.DeviceTransferState; - return *this; -} - -//-------------------------------------------------------------------- -StorageVirtual& StorageVirtual::operator=(StorageVirtual&& src) noexcept -{ - this->DeviceUpToDate = src.DeviceUpToDate; - this->DeviceTransferState = std::move(src.DeviceTransferState); - return *this; -} - -//-------------------------------------------------------------------- -StorageVirtual::~StorageVirtual() {} - -//-------------------------------------------------------------------- -void StorageVirtual::DropExecutionPortal() -{ - this->DeviceTransferState->releaseDevice(); - this->DeviceUpToDate = false; -} - -//-------------------------------------------------------------------- -void StorageVirtual::DropAllPortals() -{ - this->DeviceTransferState->releaseAll(); - this->DeviceUpToDate = false; -} - -//-------------------------------------------------------------------- -std::unique_ptr StorageVirtual::NewInstance() const -{ - return this->MakeNewInstance(); -} - -//-------------------------------------------------------------------- -const vtkm::internal::PortalVirtualBase* StorageVirtual::PrepareForInput( - vtkm::cont::DeviceAdapterId devId) const -{ - if (devId == vtkm::cont::DeviceAdapterTagUndefined()) - { - throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_UNDEFINED"); - } - - const bool needsUpload = !(this->DeviceTransferState->valid(devId) && this->DeviceUpToDate); - - if (needsUpload) - { //Either transfer state is pointing to another device, or has - //had the execution resources released. Either way we - //need to re-transfer the execution information - auto* payload = this->DeviceTransferState.get(); - this->TransferPortalForInput(*payload, devId); - this->DeviceUpToDate = true; - } - return this->DeviceTransferState->devicePtr(); -} - -//-------------------------------------------------------------------- -const vtkm::internal::PortalVirtualBase* StorageVirtual::PrepareForOutput( - vtkm::Id numberOfValues, - vtkm::cont::DeviceAdapterId devId) -{ - if (devId == vtkm::cont::DeviceAdapterTagUndefined()) - { - throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_UNDEFINED"); - } - - const bool needsUpload = !(this->DeviceTransferState->valid(devId) && this->DeviceUpToDate); - if (needsUpload) - { - this->TransferPortalForOutput( - *(this->DeviceTransferState), OutputMode::WRITE, numberOfValues, devId); - this->DeviceUpToDate = true; - } - return this->DeviceTransferState->devicePtr(); -} - -//-------------------------------------------------------------------- -const vtkm::internal::PortalVirtualBase* StorageVirtual::PrepareForInPlace( - vtkm::cont::DeviceAdapterId devId) -{ - if (devId == vtkm::cont::DeviceAdapterTagUndefined()) - { - throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_UNDEFINED"); - } - - const bool needsUpload = !(this->DeviceTransferState->valid(devId) && this->DeviceUpToDate); - if (needsUpload) - { - vtkm::Id numberOfValues = this->GetNumberOfValues(); - this->TransferPortalForOutput( - *(this->DeviceTransferState), OutputMode::READ_WRITE, numberOfValues, devId); - this->DeviceUpToDate = true; - } - return this->DeviceTransferState->devicePtr(); -} - -//-------------------------------------------------------------------- -const vtkm::internal::PortalVirtualBase* StorageVirtual::WritePortal() -{ - //we need to prepare for input and grab the host ptr - auto* payload = this->DeviceTransferState.get(); - this->ControlPortalForOutput(*payload); - - this->DeviceUpToDate = false; - return this->DeviceTransferState->hostPtr(); -} - -//-------------------------------------------------------------------- -const vtkm::internal::PortalVirtualBase* StorageVirtual::ReadPortal() const -{ - //we need to prepare for input and grab the host ptr - vtkm::cont::internal::TransferInfoArray* payload = this->DeviceTransferState.get(); - this->ControlPortalForInput(*payload); - - return this->DeviceTransferState->hostPtr(); -} - -//-------------------------------------------------------------------- -DeviceAdapterId StorageVirtual::GetDeviceAdapterId() const noexcept -{ - return this->DeviceTransferState->deviceId(); -} - -//-------------------------------------------------------------------- -void StorageVirtual::ControlPortalForOutput(vtkm::cont::internal::TransferInfoArray&) -{ - throw vtkm::cont::ErrorBadValue( - "StorageTagVirtual by default doesn't support control side writes."); -} - -//-------------------------------------------------------------------- -void StorageVirtual::TransferPortalForOutput(vtkm::cont::internal::TransferInfoArray&, - OutputMode, - vtkm::Id, - vtkm::cont::DeviceAdapterId) -{ - throw vtkm::cont::ErrorBadValue("StorageTagVirtual by default doesn't support exec side writes."); -} - -#define VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(T) \ - template class VTKM_CONT_EXPORT ArrayTransferVirtual; \ - template class VTKM_CONT_EXPORT ArrayTransferVirtual>; \ - template class VTKM_CONT_EXPORT ArrayTransferVirtual>; \ - template class VTKM_CONT_EXPORT ArrayTransferVirtual> - -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(char); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::Int8); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::UInt8); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::Int16); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::UInt16); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::Int32); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::UInt32); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::Int64); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::UInt64); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::Float32); -VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE(vtkm::Float64); - -#undef VTK_M_ARRAY_TRANSFER_VIRTUAL_INSTANTIATE - -#define VTK_M_STORAGE_VIRTUAL_INSTANTIATE(T) \ - template class VTKM_CONT_EXPORT StorageVirtualImpl; \ - template class VTKM_CONT_EXPORT StorageVirtualImpl, VTKM_DEFAULT_STORAGE_TAG>; \ - template class VTKM_CONT_EXPORT StorageVirtualImpl, VTKM_DEFAULT_STORAGE_TAG>; \ - template class VTKM_CONT_EXPORT StorageVirtualImpl, VTKM_DEFAULT_STORAGE_TAG> - -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(char); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::Int8); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::UInt8); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::Int16); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::UInt16); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::Int32); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::UInt32); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::Int64); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::UInt64); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::Float32); -VTK_M_STORAGE_VIRTUAL_INSTANTIATE(vtkm::Float64); - -#undef VTK_M_STORAGE_VIRTUAL_INSTANTIATE -} -} -} -} // namespace vtkm::cont::internal::detail diff --git a/vtkm/cont/StorageVirtual.h b/vtkm/cont/StorageVirtual.h deleted file mode 100644 index a2a609244..000000000 --- a/vtkm/cont/StorageVirtual.h +++ /dev/null @@ -1,302 +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. -//============================================================================ -#ifndef vtk_m_cont_StorageVirtual_h -#define vtk_m_cont_StorageVirtual_h - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "ArrayHandleVirtual is removed. Do not include StorageVirtual.h" -#endif - -namespace vtkm -{ -namespace cont -{ - -struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6) StorageTagVirtual -{ -}; - -namespace internal -{ - -namespace detail -{ - -class VTKM_CONT_EXPORT StorageVirtual -{ -public: - /// \brief construct storage that VTK-m is responsible for - StorageVirtual() = default; - StorageVirtual(const StorageVirtual& src); - StorageVirtual(StorageVirtual&& src) noexcept; - StorageVirtual& operator=(const StorageVirtual& src); - StorageVirtual& operator=(StorageVirtual&& src) noexcept; - - virtual ~StorageVirtual(); - - /// Releases any resources being used in the execution environment (that are - /// not being shared by the control environment). - /// - /// Only needs to overridden by subclasses such as Zip that have member - /// variables that themselves have execution memory - virtual void ReleaseResourcesExecution() = 0; - - /// Releases all resources in both the control and execution environments. - /// - /// Only needs to overridden by subclasses such as Zip that have member - /// variables that themselves have execution memory - virtual void ReleaseResources() = 0; - - /// Returns the number of entries in the array. - /// - virtual vtkm::Id GetNumberOfValues() const = 0; - - /// \brief Allocates an array large enough to hold the given number of values. - /// - /// The allocation may be done on an already existing array, but can wipe out - /// any data already in the array. This method can throw - /// ErrorBadAllocation if the array cannot be allocated or - /// ErrorBadValue if the allocation is not feasible (for example, the - /// array storage is read-only). - /// - virtual void Allocate(vtkm::Id numberOfValues) = 0; - - /// \brief Reduces the size of the array without changing its values. - /// - /// This method allows you to resize the array without reallocating it. The - /// number of entries in the array is changed to \c numberOfValues. The data - /// in the array (from indices 0 to \c numberOfValues - 1) are the same, but - /// \c numberOfValues must be equal or less than the preexisting size - /// (returned from GetNumberOfValues). That is, this method can only be used - /// to shorten the array, not lengthen. - virtual void Shrink(vtkm::Id numberOfValues) = 0; - - /// Determines if storage types matches the type passed in. - /// - template - bool IsType() const - { //needs optimizations based on platform. !OSX can use typeid - return nullptr != dynamic_cast(this); - } - - /// \brief Create a new storage of the same type as this storage. - /// - /// This method creates a new storage that is the same type as this one and - /// returns a unique_ptr for it. This method is convenient when - /// creating output arrays that should be the same type as some input array. - /// - std::unique_ptr NewInstance() const; - - template - const DerivedStorage* Cast() const - { - const DerivedStorage* derived = dynamic_cast(this); - if (!derived) - { - VTKM_LOG_CAST_FAIL(*this, DerivedStorage); - throwFailedDynamicCast("StorageVirtual", vtkm::cont::TypeToString()); - } - VTKM_LOG_CAST_SUCC(*this, derived); - return derived; - } - - const vtkm::internal::PortalVirtualBase* PrepareForInput(vtkm::cont::DeviceAdapterId devId) const; - - const vtkm::internal::PortalVirtualBase* PrepareForOutput(vtkm::Id numberOfValues, - vtkm::cont::DeviceAdapterId devId); - - const vtkm::internal::PortalVirtualBase* PrepareForInPlace(vtkm::cont::DeviceAdapterId devId); - - //This needs to cause a host side sync! - //This needs to work before we execute on a device - const vtkm::internal::PortalVirtualBase* WritePortal(); - - //This needs to cause a host side sync! - //This needs to work before we execute on a device - const vtkm::internal::PortalVirtualBase* ReadPortal() const; - - /// Returns the DeviceAdapterId for the current device. If there is no device - /// with an up-to-date copy of the data, VTKM_DEVICE_ADAPTER_UNDEFINED is - /// returned. - DeviceAdapterId GetDeviceAdapterId() const noexcept; - - - enum struct OutputMode - { - WRITE, - READ_WRITE - }; - -protected: - /// Drop the reference to the execution portal. The underlying array handle might still be - /// managing data on the execution side, but our references might be out of date, so drop - /// them and refresh them later if necessary. - void DropExecutionPortal(); - - /// Drop the reference to all portals. The underlying array handle might still be managing data, - /// but our references might be out of date, so drop them and refresh them later if necessary. - void DropAllPortals(); - -private: - //Memory management routines - // virtual void DoAllocate(vtkm::Id numberOfValues) = 0; - // virtual void DoShrink(vtkm::Id numberOfValues) = 0; - - //RTTI routines - virtual std::unique_ptr MakeNewInstance() const = 0; - - //Portal routines - virtual void ControlPortalForInput(vtkm::cont::internal::TransferInfoArray& payload) const = 0; - virtual void ControlPortalForOutput(vtkm::cont::internal::TransferInfoArray& payload); - - - virtual void TransferPortalForInput(vtkm::cont::internal::TransferInfoArray& payload, - vtkm::cont::DeviceAdapterId devId) const = 0; - virtual void TransferPortalForOutput(vtkm::cont::internal::TransferInfoArray& payload, - OutputMode mode, - vtkm::Id numberOfValues, - vtkm::cont::DeviceAdapterId devId); - - //This might need to exist in TransferInfoArray - mutable bool DeviceUpToDate = false; - std::shared_ptr DeviceTransferState = - std::make_shared(); -}; - -template -class VTKM_ALWAYS_EXPORT StorageVirtualImpl final - : public vtkm::cont::internal::detail::StorageVirtual -{ -public: - VTKM_CONT - explicit StorageVirtualImpl(const vtkm::cont::ArrayHandle& ah); - - explicit StorageVirtualImpl(vtkm::cont::ArrayHandle&& ah) noexcept; - - VTKM_CONT - ~StorageVirtualImpl() override = default; - - const vtkm::cont::ArrayHandle& GetHandle() const { return this->Handle; } - - vtkm::Id GetNumberOfValues() const override { return this->Handle.GetNumberOfValues(); } - - void ReleaseResourcesExecution() override; - void ReleaseResources() override; - - void Allocate(vtkm::Id numberOfValues) override; - void Shrink(vtkm::Id numberOfValues) override; - -private: - std::unique_ptr MakeNewInstance() const override - { - return std::unique_ptr( - new StorageVirtualImpl{ vtkm::cont::ArrayHandle{} }); - } - - - void ControlPortalForInput(vtkm::cont::internal::TransferInfoArray& payload) const override; - void ControlPortalForOutput(vtkm::cont::internal::TransferInfoArray& payload) override; - - void TransferPortalForInput(vtkm::cont::internal::TransferInfoArray& payload, - vtkm::cont::DeviceAdapterId devId) const override; - - void TransferPortalForOutput(vtkm::cont::internal::TransferInfoArray& payload, - OutputMode mode, - vtkm::Id numberOfValues, - vtkm::cont::DeviceAdapterId devId) override; - - vtkm::cont::ArrayHandle Handle; -}; - -} // namespace detail - -VTKM_DEPRECATED_SUPPRESS_BEGIN -template -class VTKM_ALWAYS_EXPORT Storage -{ -public: - using ValueType = T; - - using PortalType = vtkm::ArrayPortalRef; - using PortalConstType = vtkm::ArrayPortalRef; - - Storage() = default; - - // Should never really be used, but just in case. - Storage(const Storage&) = default; - - template - Storage(const vtkm::cont::ArrayHandle& srcArray) - : VirtualStorage(std::make_shared>(srcArray)) - { - } - - ~Storage() = default; - - PortalType GetPortal() - { - return make_ArrayPortalRef( - reinterpret_cast*>(this->VirtualStorage->WritePortal()), - this->GetNumberOfValues()); - } - - PortalConstType GetPortalConst() const - { - return make_ArrayPortalRef( - reinterpret_cast*>(this->VirtualStorage->ReadPortal()), - this->GetNumberOfValues()); - } - - vtkm::Id GetNumberOfValues() const { return this->VirtualStorage->GetNumberOfValues(); } - - void Allocate(vtkm::Id numberOfValues); - - void Shrink(vtkm::Id numberOfValues); - - void ReleaseResources(); - - Storage NewInstance() const; - - const detail::StorageVirtual* GetStorageVirtual() const { return this->VirtualStorage.get(); } - detail::StorageVirtual* GetStorageVirtual() { return this->VirtualStorage.get(); } - -private: - std::shared_ptr VirtualStorage; - - Storage(std::shared_ptr virtualStorage) - : VirtualStorage(virtualStorage) - { - } - - VTKM_STORAGE_OLD_STYLE; -}; -VTKM_DEPRECATED_SUPPRESS_END - -} // namespace internal -} -} // namespace vtkm::cont - -#ifndef vtk_m_cont_StorageVirtual_hxx -#include -#endif - -#endif diff --git a/vtkm/cont/StorageVirtual.hxx b/vtkm/cont/StorageVirtual.hxx deleted file mode 100644 index 9ac534818..000000000 --- a/vtkm/cont/StorageVirtual.hxx +++ /dev/null @@ -1,454 +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. -//============================================================================ -#ifndef vtk_m_cont_StorageVirtual_hxx -#define vtk_m_cont_StorageVirtual_hxx - -#include -#include -#include - -#include -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif - -// This is a deprecated class. Don't warn about deprecation while implementing -// deprecated functionality. -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ -namespace cont -{ -namespace detail -{ -template -struct TransferToDevice -{ - template - inline bool operator()(DeviceAdapterTag devId, Payload&& payload, Args&&... args) const - { - using TransferType = cont::internal::VirtualObjectTransfer; - using shared_memory_transfer = - std::is_base_of, - TransferType>; - - return this->Transfer( - devId, shared_memory_transfer{}, std::forward(payload), std::forward(args)...); - } - - template - inline bool Transfer(DeviceAdapterTag devId, - std::true_type, - Payload&& payload, - Args&&... args) const - { //shared memory transfer so we just need - auto smp_ptr = new DerivedPortal(std::forward(args)...); - auto host = std::unique_ptr(smp_ptr); - payload.updateDevice(devId, std::move(host), smp_ptr, nullptr); - - return true; - } - - template - inline bool Transfer(DeviceAdapterTag devId, - std::false_type, - Payload&& payload, - Args&&... args) const - { //separate memory transfer - //construct all new transfer payload - using TransferType = cont::internal::VirtualObjectTransfer; - - auto host = std::unique_ptr(new DerivedPortal(std::forward(args)...)); - auto transfer = std::make_shared(host.get()); - auto device = transfer->PrepareForExecution(true); - - payload.updateDevice(devId, std::move(host), device, std::static_pointer_cast(transfer)); - - return true; - } -}; -} // namespace detail - -template -inline void make_transferToDevice(vtkm::cont::DeviceAdapterId devId, Args&&... args) -{ - vtkm::cont::TryExecuteOnDevice( - devId, detail::TransferToDevice{}, std::forward(args)...); -} - -template -inline void make_hostPortal(Payload&& payload, Args&&... args) -{ - auto host = std::unique_ptr(new DerivedPortal(std::forward(args)...)); - payload.updateHost(std::move(host)); -} - -namespace internal -{ -namespace detail -{ - -VTKM_CONT -template -StorageVirtualImpl::StorageVirtualImpl(const vtkm::cont::ArrayHandle& ah) - : vtkm::cont::internal::detail::StorageVirtual() - , Handle(ah) -{ -} - -VTKM_CONT -template -StorageVirtualImpl::StorageVirtualImpl(vtkm::cont::ArrayHandle&& ah) noexcept - : vtkm::cont::internal::detail::StorageVirtual() - , Handle(std::move(ah)) -{ -} - -/// release execution side resources -template -void StorageVirtualImpl::ReleaseResourcesExecution() -{ - this->DropExecutionPortal(); - this->Handle.ReleaseResourcesExecution(); -} - -/// release control side resources -template -void StorageVirtualImpl::ReleaseResources() -{ - this->DropAllPortals(); - this->Handle.ReleaseResources(); -} - -template -void StorageVirtualImpl::Allocate(vtkm::Id numberOfValues) -{ - this->DropAllPortals(); - this->Handle.Allocate(numberOfValues); -} - -template -void StorageVirtualImpl::Shrink(vtkm::Id numberOfValues) -{ - this->DropAllPortals(); - this->Handle.Allocate(numberOfValues, vtkm::CopyFlag::On); -} - -struct PortalWrapperToDevice -{ - template - inline bool operator()(DeviceAdapterTag device, - Handle&& handle, - vtkm::cont::internal::TransferInfoArray& payload) const - { - vtkm::cont::Token token; - auto portal = handle.PrepareForInput(device, token); - using DerivedPortal = vtkm::ArrayPortalWrapper; - vtkm::cont::detail::TransferToDevice transfer; - return transfer(device, payload, portal); - } - template - inline bool operator()(DeviceAdapterTag device, - Handle&& handle, - vtkm::Id numberOfValues, - vtkm::cont::internal::TransferInfoArray& payload, - vtkm::cont::internal::detail::StorageVirtual::OutputMode mode) const - { - using ACCESS_MODE = vtkm::cont::internal::detail::StorageVirtual::OutputMode; - if (mode == ACCESS_MODE::WRITE) - { - vtkm::cont::Token token; - auto portal = handle.PrepareForOutput(numberOfValues, device, token); - using DerivedPortal = vtkm::ArrayPortalWrapper; - vtkm::cont::detail::TransferToDevice transfer; - return transfer(device, payload, portal); - } - else - { - vtkm::cont::Token token; - auto portal = handle.PrepareForInPlace(device, token); - using DerivedPortal = vtkm::ArrayPortalWrapper; - vtkm::cont::detail::TransferToDevice transfer; - return transfer(device, payload, portal); - } - } -}; - -template -void StorageVirtualImpl::ControlPortalForInput( - vtkm::cont::internal::TransferInfoArray& payload) const -{ - auto portal = this->Handle.ReadPortal(); - using DerivedPortal = vtkm::ArrayPortalWrapper; - vtkm::cont::make_hostPortal(payload, portal); -} - -template -inline void make_writableHostPortal(std::true_type, - vtkm::cont::internal::TransferInfoArray& payload, - HandleType& handle) -{ - auto portal = handle.WritePortal(); - using DerivedPortal = vtkm::ArrayPortalWrapper; - vtkm::cont::make_hostPortal(payload, portal); -} -template -inline void make_writableHostPortal(std::false_type, - vtkm::cont::internal::TransferInfoArray& payload, - HandleType&) -{ - payload.updateHost(nullptr); - throw vtkm::cont::ErrorBadValue( - "ArrayHandleAny was bound to an ArrayHandle that doesn't support output."); -} - -template -void StorageVirtualImpl::ControlPortalForOutput( - vtkm::cont::internal::TransferInfoArray& payload) -{ - using HT = vtkm::cont::ArrayHandle; - constexpr auto isWritable = typename vtkm::cont::internal::IsWritableArrayHandle::type{}; - - detail::make_writableHostPortal(isWritable, payload, this->Handle); -} - -template -void StorageVirtualImpl::TransferPortalForInput( - vtkm::cont::internal::TransferInfoArray& payload, - vtkm::cont::DeviceAdapterId devId) const -{ - vtkm::cont::TryExecuteOnDevice(devId, detail::PortalWrapperToDevice(), this->Handle, payload); -} - - -template -void StorageVirtualImpl::TransferPortalForOutput( - vtkm::cont::internal::TransferInfoArray& payload, - vtkm::cont::internal::detail::StorageVirtual::OutputMode mode, - vtkm::Id numberOfValues, - vtkm::cont::DeviceAdapterId devId) -{ - vtkm::cont::TryExecuteOnDevice( - devId, detail::PortalWrapperToDevice(), this->Handle, numberOfValues, payload, mode); -} -} // namespace detail - -VTKM_DEPRECATED_SUPPRESS_BEGIN -template -void Storage::Allocate(vtkm::Id numberOfValues) -{ - if (this->VirtualStorage) - { - this->VirtualStorage->Allocate(numberOfValues); - } - else if (numberOfValues != 0) - { - throw vtkm::cont::ErrorBadAllocation("Attempted to allocate memory in a virtual array that " - "does not have an underlying concrete array."); - } - else - { - // Allocating a non-existing array to 0 is OK. - } -} - -template -void Storage::Shrink(vtkm::Id numberOfValues) -{ - if (this->VirtualStorage) - { - this->VirtualStorage->Shrink(numberOfValues); - } - else if (numberOfValues != 0) - { - throw vtkm::cont::ErrorBadAllocation( - "Attempted to shrink a virtual array that does not have an underlying concrete array."); - } - else - { - // Shrinking a non-existing array to 0 is OK. - } -} - -template -void Storage::ReleaseResources() -{ - if (this->VirtualStorage) - { - this->VirtualStorage->ReleaseResources(); - } - else - { - // No concrete array, nothing allocated, nothing to do. - } -} - -template -Storage Storage::NewInstance() - const -{ - if (this->GetStorageVirtual()) - { - return Storage(this->GetStorageVirtual()->NewInstance()); - } - else - { - return Storage(); - } -} - -namespace detail -{ - -template -class VTKM_ALWAYS_EXPORT ArrayTransferVirtual -{ - using StorageType = vtkm::cont::internal::Storage; - vtkm::cont::internal::detail::StorageVirtual* Storage; - -public: - using ValueType = T; - - using PortalControl = typename StorageType::PortalType; - using PortalConstControl = typename StorageType::PortalConstType; - - using PortalExecution = vtkm::ArrayPortalRef; - using PortalConstExecution = vtkm::ArrayPortalRef; - - VTKM_CONT ArrayTransferVirtual(StorageType* storage) - : Storage(storage->GetStorageVirtual()) - { - } - - VTKM_CONT vtkm::Id GetNumberOfValues() const { return this->Storage->GetNumberOfValues(); } - - VTKM_CONT PortalConstExecution PrepareForInput(vtkm::cont::DeviceAdapterId device) - { - return vtkm::make_ArrayPortalRef(static_cast*>( - this->Storage->PrepareForInput(device)), - this->GetNumberOfValues()); - } - - VTKM_CONT PortalExecution PrepareForOutput(vtkm::Id numberOfValues, - vtkm::cont::DeviceAdapterId device) - { - return make_ArrayPortalRef(static_cast*>( - this->Storage->PrepareForOutput(numberOfValues, device)), - numberOfValues); - } - - VTKM_CONT PortalExecution PrepareForInPlace(vtkm::cont::DeviceAdapterId device) - { - return vtkm::make_ArrayPortalRef(static_cast*>( - this->Storage->PrepareForInPlace(device)), - this->GetNumberOfValues()); - } - - VTKM_CONT - void RetrieveOutputData(StorageType* vtkmNotUsed(storage)) const - { - // Implementation of this method should be unnecessary. The internal array handles should - // automatically retrieve the output data as necessary. - } - - VTKM_CONT void Shrink(vtkm::Id numberOfValues) { this->Storage->Shrink(numberOfValues); } - - VTKM_CONT void ReleaseResources() { this->Storage->ReleaseResourcesExecution(); } -}; - -#ifndef vtk_m_cont_StorageVirtual_cxx - -#define VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(T) \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayTransferVirtual; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayTransferVirtual>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayTransferVirtual>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayTransferVirtual> - -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(char); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::Int8); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::UInt8); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::Int16); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::UInt16); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::Int32); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::UInt32); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::Int64); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::UInt64); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::Float32); -VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT(vtkm::Float64); - -#undef VTK_M_ARRAY_TRANSFER_VIRTUAL_EXPORT - -#define VTK_M_STORAGE_VIRTUAL_EXPORT(T) \ - extern template class VTKM_CONT_TEMPLATE_EXPORT StorageVirtualImpl; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT \ - StorageVirtualImpl, VTKM_DEFAULT_STORAGE_TAG>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT \ - StorageVirtualImpl, VTKM_DEFAULT_STORAGE_TAG>; \ - extern template class VTKM_CONT_TEMPLATE_EXPORT \ - StorageVirtualImpl, VTKM_DEFAULT_STORAGE_TAG> - -VTK_M_STORAGE_VIRTUAL_EXPORT(char); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::Int8); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::UInt8); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::Int16); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::UInt16); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::Int32); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::UInt32); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::Int64); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::UInt64); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::Float32); -VTK_M_STORAGE_VIRTUAL_EXPORT(vtkm::Float64); - -#undef VTK_M_STORAGE_VIRTUAL_EXPORT - -#endif //!vtk_m_cont_StorageVirtual_cxx -} // namespace detail - -template -struct ArrayTransfer : detail::ArrayTransferVirtual -{ - using Superclass = detail::ArrayTransferVirtual; - - VTKM_CONT ArrayTransfer(vtkm::cont::internal::Storage* storage) - : Superclass(storage) - { - } - - VTKM_CONT typename Superclass::PortalConstExecution PrepareForInput(bool vtkmNotUsed(updateData), - vtkm::cont::Token&) - { - return this->Superclass::PrepareForInput(Device()); - } - - VTKM_CONT typename Superclass::PortalExecution PrepareForOutput(vtkm::Id numberOfValues, - vtkm::cont::Token&) - { - return this->Superclass::PrepareForOutput(numberOfValues, Device()); - } - - VTKM_CONT typename Superclass::PortalExecution PrepareForInPlace(bool vtkmNotUsed(updateData), - vtkm::cont::Token&) - { - return this->Superclass::PrepareForInPlace(Device()); - } -}; -VTKM_DEPRECATED_SUPPRESS_END -} -} -} // namespace vtkm::cont::internal - -VTKM_DEPRECATED_SUPPRESS_END - -#endif // vtk_m_cont_StorageVirtual_hxx diff --git a/vtkm/cont/VariantArrayHandle.h b/vtkm/cont/VariantArrayHandle.h index 6a583c26a..001a76720 100644 --- a/vtkm/cont/VariantArrayHandle.h +++ b/vtkm/cont/VariantArrayHandle.h @@ -27,10 +27,6 @@ #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL - namespace vtkm { namespace cont @@ -52,78 +48,6 @@ inline void EmitVariantArrayHandleHDeprecationWarning() // deprecated functionality. VTKM_DEPRECATED_SUPPRESS_BEGIN -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -namespace internal -{ -namespace variant -{ - -struct ForceCastToVirtual -{ - template - VTKM_CONT typename std::enable_if::value>::type - operator()(const vtkm::cont::ArrayHandle& input, - vtkm::cont::ArrayHandleVirtual& output) const - { // ValueTypes match - output = vtkm::cont::make_ArrayHandleVirtual(input); - } - - template - VTKM_CONT typename std::enable_if::value>::type - operator()(const vtkm::cont::ArrayHandle& input, - vtkm::cont::ArrayHandleVirtual& output) const - { // ValueTypes do not match - this->ValidateWidthAndCast(input, output); - } - -private: - template ::NUM_COMPONENTS, - vtkm::IdComponent DSize = vtkm::VecTraits::NUM_COMPONENTS> - VTKM_CONT typename std::enable_if::type ValidateWidthAndCast( - const InputType& input, - vtkm::cont::ArrayHandleVirtual& output) const - { // number of components match - auto casted = vtkm::cont::make_ArrayHandleCast(input); - output = vtkm::cont::make_ArrayHandleVirtual(casted); - } - - template ::NUM_COMPONENTS, - vtkm::IdComponent DSize = vtkm::VecTraits::NUM_COMPONENTS> - VTKM_CONT typename std::enable_if::type ValidateWidthAndCast( - const ArrayHandleBase&, - ArrayHandleBase&) const - { // number of components do not match - std::ostringstream str; - str << "VariantArrayHandle::AsVirtual: Cannot cast from " << vtkm::cont::TypeToString() - << " to " << vtkm::cont::TypeToString() - << "; " - "number of components must match exactly."; - throw vtkm::cont::ErrorBadType(str.str()); - } -}; - -template -struct NoCastStorageTransformImpl -{ - using type = S; -}; -template -struct NoCastStorageTransformImpl> -{ - using type = S; -}; -template -using NoCastStorageTransform = typename NoCastStorageTransformImpl::type; - -} -} // namespace internal::variant -#endif //VTKM_NO_DEPRECATED_VIRTUAL - /// \brief VariantArrayHandle superclass holding common operations. /// /// `VariantArrayHandleCommon` is a superclass to all `VariantArrayHandleBase` @@ -174,34 +98,6 @@ public: std::forward(args)...); } -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - /// Returns this array cast to a `ArrayHandleVirtual` of the given type. - /// This will perform type conversions as necessary, and will log warnings - /// if the conversion is lossy. - /// - /// This method internally uses `CastAndCall`. A custom storage tag list may - /// be specified in the second template parameter, which will be passed to - /// the CastAndCall. You can also specify a list of types to try as the optional - /// third template argument. - /// - template > - VTKM_CONT VTKM_DEPRECATED(1.6, "ArrayHandleVirtual is no longer supported.") - vtkm::cont::ArrayHandleVirtual AsVirtual() const - { - VTKM_IS_LIST(StorageList); - VTKM_IS_LIST(TypeList); - // Remove cast storage from storage list because we take care of casting elsewhere - using CleanStorageList = - vtkm::ListTransform; - vtkm::cont::internal::variant::ForceCastToVirtual caster; - vtkm::cont::ArrayHandleVirtual output; - this->CastAndCall(caster, output); - return output; - } -#endif //VTKM_NO_DEPRECATED_VIRTUAL - /// Returns this array cast to a `ArrayHandleMultiplexer` of the given type. /// This will attempt to cast the internal array to each supported type of /// the multiplexer. If none are supported, an invalid ArrayHandleMultiplexer @@ -333,23 +229,6 @@ public: } -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - /// Returns this array cast to a \c ArrayHandleVirtual of the given type. - /// This will perform type conversions as necessary, and will log warnings - /// if the conversion is lossy. - /// - /// This method internally uses CastAndCall. A custom storage tag list may - /// be specified in the second template parameter, which will be passed to - /// the CastAndCall. - /// - template - VTKM_CONT VTKM_DEPRECATED(1.6, "ArrayHandleVirtual is no longer suported.") - vtkm::cont::ArrayHandleVirtual AsVirtual() const - { - return this->Superclass::AsVirtual(); - } -#endif //VTKM_NO_DEPRECATED_VIRTUAL - /// Changes the types to try casting to when resolving this variant array, /// which is specified with a list tag like those in TypeList.h. Since C++ /// does not allow you to actually change the template arguments, this method diff --git a/vtkm/cont/VirtualObjectHandle.h b/vtkm/cont/VirtualObjectHandle.h deleted file mode 100644 index 55a724b8d..000000000 --- a/vtkm/cont/VirtualObjectHandle.h +++ /dev/null @@ -1,183 +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. -//============================================================================ -#ifndef vtk_m_cont_VirtualObjectHandle_h -#define vtk_m_cont_VirtualObjectHandle_h - -#include -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -// This is a deprecated class. Don't warn about deprecation while implementing -// deprecated functionality. -VTKM_DEPRECATED_SUPPRESS_BEGIN - -#include -#include - -namespace vtkm -{ -namespace cont -{ - -namespace internal -{ -struct CreateTransferInterface -{ - template - VTKM_CONT inline void operator()(DeviceAdapter device, - internal::TransferState* transfers, - const VirtualDerivedType* virtualObject) const - { - using TransferImpl = TransferInterfaceImpl; - auto i = static_cast(device.GetValue()); - transfers->DeviceTransferState[i].reset(new TransferImpl(virtualObject)); - } -}; -} - -/// \brief Implements VTK-m's execution side Virtual Methods functionality. -/// -/// The template parameter \c VirtualBaseType is the base class that acts as the -/// interface. This base clase must inherit from \c vtkm::VirtualObjectBase. See the -/// documentation of that class to see the other requirements. -/// -/// A derived object can be bound to the handle either during construction or using the \c Reset -/// function on previously constructed handles. These function accept a control side pointer to -/// the derived class object, a boolean flag stating if the handle should acquire ownership of -/// the object (i.e. manage the lifetime), and a type-list of device adapter tags where the object -/// is expected to be used. -/// -/// To get an execution side pointer call the \c PrepareForExecution function. The device adapter -/// passed to this function should be one of the device in the list passed during the set up of -/// the handle. -/// -/// -/// \sa vtkm::VirtualObjectBase -/// -template -class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED( - 1.7, - "Virtual methods are no longer supported in the execution environment.") VirtualObjectHandle - : public vtkm::cont::ExecutionAndControlObjectBase -{ - VTKM_STATIC_ASSERT_MSG((std::is_base_of::value), - "All virtual objects must be subclass of vtkm::VirtualObjectBase."); - -public: - VTKM_CONT VirtualObjectHandle() - : Internals(std::make_shared()) - { - } - - template - VTKM_CONT explicit VirtualObjectHandle(VirtualDerivedType* derived, - bool acquireOwnership = true, - DeviceAdapterList devices = DeviceAdapterList()) - : Internals(std::make_shared()) - { - this->Reset(derived, acquireOwnership, devices); - } - - /// Get if in a valid state (a target is bound) - VTKM_CONT bool GetValid() const { return this->Internals->HostPtr() != nullptr; } - - - /// Get if this handle owns the control side target object - VTKM_CONT bool OwnsObject() const { return this->Internals->WillReleaseHostPointer(); } - - /// Get the control side pointer to the virtual object - VTKM_CONT VirtualBaseType* Get() const - { - return static_cast(this->Internals->HostPtr()); - } - - /// Reset the underlying derived type object - template - VTKM_CONT void Reset(VirtualDerivedType* derived, - bool acquireOwnership = true, - DeviceAdapterList devices = DeviceAdapterList()) - { - VTKM_DEPRECATED_SUPPRESS_BEGIN - VTKM_STATIC_ASSERT_MSG((std::is_base_of::value), - "Tried to bind a type that is not a subclass of the base class."); - - if (acquireOwnership) - { - auto deleter = [](void* p) { delete static_cast(p); }; - this->Internals->UpdateHost(derived, deleter); - } - else - { - this->Internals->UpdateHost(derived, nullptr); - } - - if (derived) - { - vtkm::cont::internal::ForEachValidDevice( - devices, internal::CreateTransferInterface(), this->Internals.get(), derived); - } - VTKM_DEPRECATED_SUPPRESS_END - } - - /// Release all host and execution side resources - VTKM_CONT void ReleaseResources() { this->Internals->ReleaseResources(); } - - /// Release all the execution side resources - VTKM_CONT void ReleaseExecutionResources() { this->Internals->ReleaseExecutionResources(); } - - /// Get a valid \c VirtualBaseType* with the current control side state for \c deviceId. - /// VirtualObjectHandle and the returned pointer are analogous to ArrayHandle and Portal - /// The returned pointer will be invalidated if: - /// 1. A new pointer is requested for a different deviceId - /// 2. VirtualObjectHandle is destroyed - /// 3. Reset or ReleaseResources is called - /// - VTKM_CONT const VirtualBaseType* PrepareForExecution(vtkm::cont::DeviceAdapterId deviceId, - vtkm::cont::Token&) const - { - const bool validId = this->Internals->DeviceIdIsValid(deviceId); - if (!validId) - { //can't be reached since DeviceIdIsValid will through an exception - //if deviceId is not valid - return nullptr; - } - - return static_cast(this->Internals->PrepareForExecution(deviceId)); - } - - VTKM_CONT - VTKM_DEPRECATED(1.6, "PrepareForExecution now requires a vtkm::cont::Token object.") - const VirtualBaseType* PrepareForExecution(vtkm::cont::DeviceAdapterId deviceId) const - { - vtkm::cont::Token token; - return this->PrepareForExecution(deviceId, token); - } - - /// Used as part of the \c ExecutionAndControlObjectBase interface. Returns the same pointer - /// as \c Get. - VTKM_CONT const VirtualBaseType* PrepareForControl() const { return this->Get(); } - -private: - std::shared_ptr Internals; -}; -} -} // vtkm::cont - -VTKM_DEPRECATED_SUPPRESS_END - - -#endif // vtk_m_cont_VirtualObjectHandle_h diff --git a/vtkm/cont/VirtualObjectHandle.hxx b/vtkm/cont/VirtualObjectHandle.hxx deleted file mode 100644 index a51999872..000000000 --- a/vtkm/cont/VirtualObjectHandle.hxx +++ /dev/null @@ -1,104 +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. -//============================================================================ -#ifndef vtk_m_cont_VirtualObjectHandle_hxx -#define vtk_m_cont_VirtualObjectHandle_hxx - -#include - -#include -#include -#include - -#include -#include - -namespace vtkm -{ -namespace cont -{ - -template -VirtualObjectHandle::VirtualObjectHandle() - : Internals(std::make_shared()) -{ -} - -template -template -VirtualObjectHandle::VirtualObjectHandle(VirtualDerivedType* derived, - bool acquireOwnership, - DeviceAdapterList devices) - : Internals(std::make_shared()) -{ - this->Reset(derived, acquireOwnership, devices); -} - -template -bool VirtualObjectHandle::GetValid() const -{ - return this->Internals->HostPtr() != nullptr; -} - -template -bool VirtualObjectHandle::OwnsObject() const -{ - return this->Internals->WillReleaseHostPointer(); -} - -template -VirtualBaseType* VirtualObjectHandle::Get() -{ - return static_cast(this->Internals->HostPtr()); -} - -/// Reset the underlying derived type object -template -template -void VirtualObjectHandle::Reset(VirtualDerivedType* derived, - bool acquireOwnership, - DeviceAdapterList devices) -{ - VTKM_STATIC_ASSERT_MSG((std::is_base_of::value), - "Tried to bind a type that is not a subclass of the base class."); - - if (acquireOwnership) - { - // auto deleter = [](void* p) { delete static_cast(p); }; - this->Internals->UpdateHost(derived, nullptr); - } - else - { - this->Internals->UpdateHost(derived, nullptr); - } - - if (derived) - { - vtkm::cont::internal::ForEachValidDevice( - devices, internal::CreateTransferInterface(), this->Internals.get(), derived); - } -} - -template -const VirtualBaseType* VirtualObjectHandle::PrepareForExecution( - vtkm::cont::DeviceAdapterId deviceId) const -{ - const bool validId = this->Internals->DeviceIdIsValid(deviceId); - if (!validId) - { //can't be reached since DeviceIdIsValid will through an exception - //if deviceId is not valid - return nullptr; - } - - return static_cast(this->Internals->PrepareForExecution(deviceId)); -} -} -} // vtkm::cont - -#endif // vtk_m_cont_VirtualObjectHandle_h diff --git a/vtkm/cont/arg/TransportTagAtomicArray.h b/vtkm/cont/arg/TransportTagAtomicArray.h index c17c5cba4..5ae6740cd 100644 --- a/vtkm/cont/arg/TransportTagAtomicArray.h +++ b/vtkm/cont/arg/TransportTagAtomicArray.h @@ -14,12 +14,6 @@ #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#include -#endif - - #include #include @@ -67,45 +61,6 @@ struct Transport -struct Transport, - Device> -{ - using ExecObjectType = vtkm::exec::AtomicArrayExecutionObject; - using ExecType = vtkm::cont::AtomicArray; - - template - VTKM_CONT ExecObjectType - operator()(vtkm::cont::ArrayHandle& array, - const InputDomainType&, - vtkm::Id, - vtkm::Id) const - { - using ArrayHandleType = vtkm::cont::ArrayHandle; - const bool is_type = vtkm::cont::IsType(array); - if (!is_type) - { -#if defined(VTKM_ENABLE_LOGGING) - VTKM_LOG_CAST_FAIL(array, ArrayHandleType); -#endif - throw vtkm::cont::ErrorBadValue("Arrays being used as atomic's must always have storage that " - "is of the type StorageTagBasic."); - } - - ArrayHandleType handle = vtkm::cont::Cast(array); - - // Note: we ignore the size of the domain because the randomly accessed - // array might not have the same size depending on how the user is using - // the array. - ExecType obj(handle); - return obj.PrepareForExecution(Device()); - } -}; -VTKM_DEPRECATED_SUPPRESS_END -#endif //VTKM_NO_DEPRECATED_VIRTUAL } } } // namespace vtkm::cont::arg diff --git a/vtkm/cont/arg/TypeCheckTagAtomicArray.h b/vtkm/cont/arg/TypeCheckTagAtomicArray.h index 1b4989c70..d7bc9746b 100644 --- a/vtkm/cont/arg/TypeCheckTagAtomicArray.h +++ b/vtkm/cont/arg/TypeCheckTagAtomicArray.h @@ -17,10 +17,6 @@ #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL - namespace vtkm { namespace cont @@ -46,15 +42,6 @@ struct TypeCheck::value; }; -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -VTKM_DEPRECATED_SUPPRESS_BEGIN -template -struct TypeCheck> -{ - static constexpr bool value = vtkm::ListHas::value; -}; -VTKM_DEPRECATED_SUPPRESS_END -#endif //VTKM_NO_DEPRECATED_VIRTUAL } } } // namespace vtkm::cont::arg diff --git a/vtkm/cont/cuda/DeviceAdapterCuda.h b/vtkm/cont/cuda/DeviceAdapterCuda.h index 4a905cf5f..8c7298391 100644 --- a/vtkm/cont/cuda/DeviceAdapterCuda.h +++ b/vtkm/cont/cuda/DeviceAdapterCuda.h @@ -23,9 +23,6 @@ #include #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL #else // !VTKM_CUDA diff --git a/vtkm/cont/cuda/internal/CMakeLists.txt b/vtkm/cont/cuda/internal/CMakeLists.txt index 0c53cdc4a..5a55f36e3 100644 --- a/vtkm/cont/cuda/internal/CMakeLists.txt +++ b/vtkm/cont/cuda/internal/CMakeLists.txt @@ -21,12 +21,6 @@ set(headers ThrustExceptionHandler.h ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - VirtualObjectTransferCuda.h - ) -endif() - vtkm_declare_headers(${headers}) diff --git a/vtkm/cont/cuda/internal/VirtualObjectTransferCuda.h b/vtkm/cont/cuda/internal/VirtualObjectTransferCuda.h deleted file mode 100644 index 1b84e7e2f..000000000 --- a/vtkm/cont/cuda/internal/VirtualObjectTransferCuda.h +++ /dev/null @@ -1,157 +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. -//============================================================================ -#ifndef vtk_m_cont_cuda_internal_VirtualObjectTransferCuda_h -#define vtk_m_cont_cuda_internal_VirtualObjectTransferCuda_h - -#include -#include -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -namespace detail -{ - -#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -template -__global__ void ConstructVirtualObjectKernel(VirtualDerivedType* deviceObject, - const VirtualDerivedType* targetObject) -{ - // Use the "placement new" syntax to construct an object in pre-allocated memory - new (deviceObject) VirtualDerivedType(*targetObject); -} - -template -__global__ void UpdateVirtualObjectKernel(VirtualDerivedType* deviceObject, - const VirtualDerivedType* targetObject) -{ - *deviceObject = *targetObject; -} - -template -__global__ void DeleteVirtualObjectKernel(VirtualDerivedType* deviceObject) -{ - deviceObject->~VirtualDerivedType(); -} - -#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) -#pragma GCC diagnostic pop -#endif - -} // detail - -template -struct VirtualObjectTransfer -{ - VTKM_CONT VirtualObjectTransfer(const VirtualDerivedType* virtualObject) - : ControlObject(virtualObject) - , ExecutionObject(nullptr) - { - } - - VTKM_CONT ~VirtualObjectTransfer() { this->ReleaseResources(); } - - VirtualObjectTransfer(const VirtualObjectTransfer&) = delete; - void operator=(const VirtualObjectTransfer&) = delete; - - VTKM_CONT const VirtualDerivedType* PrepareForExecution(bool updateData) - { - if (this->ExecutionObject == nullptr) - { - // deviceTarget will hold a byte copy of the host object on the device. The virtual table - // will be wrong. - VirtualDerivedType* deviceTarget; - VTKM_CUDA_CALL(cudaMalloc(&deviceTarget, sizeof(VirtualDerivedType))); - VTKM_CUDA_CALL(cudaMemcpyAsync(deviceTarget, - this->ControlObject, - sizeof(VirtualDerivedType), - cudaMemcpyHostToDevice, - cudaStreamPerThread)); - - // Allocate memory for the object that will eventually be a correct copy on the device. - VTKM_CUDA_CALL(cudaMalloc(&this->ExecutionObject, sizeof(VirtualDerivedType))); - - // Initialize the device object - detail::ConstructVirtualObjectKernel<<<1, 1, 0, cudaStreamPerThread>>>(this->ExecutionObject, - deviceTarget); - VTKM_CUDA_CHECK_ASYNCHRONOUS_ERROR(); - - // Clean up intermediate copy - vtkm::cont::cuda::internal::CudaAllocator::FreeDeferred(deviceTarget, - sizeof(VirtualDerivedType)); - } - else if (updateData) - { - // deviceTarget will hold a byte copy of the host object on the device. The virtual table - // will be wrong. - VirtualDerivedType* deviceTarget; - VTKM_CUDA_CALL(cudaMalloc(&deviceTarget, sizeof(VirtualDerivedType))); - VTKM_CUDA_CALL(cudaMemcpyAsync(deviceTarget, - this->ControlObject, - sizeof(VirtualDerivedType), - cudaMemcpyHostToDevice, - cudaStreamPerThread)); - - // Initialize the device object - detail::UpdateVirtualObjectKernel<<<1, 1, 0, cudaStreamPerThread>>>(this->ExecutionObject, - deviceTarget); - VTKM_CUDA_CHECK_ASYNCHRONOUS_ERROR(); - - // Clean up intermediate copy - vtkm::cont::cuda::internal::CudaAllocator::FreeDeferred(deviceTarget, - sizeof(VirtualDerivedType)); - } - else - { - // Nothing to do. The device object is already up to date. - } - - return this->ExecutionObject; - } - - VTKM_CONT void ReleaseResources() - { - if (this->ExecutionObject != nullptr) - { - detail::DeleteVirtualObjectKernel<<<1, 1, 0, cudaStreamPerThread>>>(this->ExecutionObject); - vtkm::cont::cuda::internal::CudaAllocator::FreeDeferred(this->ExecutionObject, - sizeof(VirtualDerivedType)); - this->ExecutionObject = nullptr; - } - } - -private: - const VirtualDerivedType* ControlObject; - VirtualDerivedType* ExecutionObject; -}; -} -} -} // vtkm::cont::internal - -VTKM_DEPRECATED_SUPPRESS_END - -#endif // vtk_m_cont_cuda_internal_VirtualObjectTransferCuda_h diff --git a/vtkm/cont/internal/CMakeLists.txt b/vtkm/cont/internal/CMakeLists.txt index 18ba544b8..0e36b0e76 100644 --- a/vtkm/cont/internal/CMakeLists.txt +++ b/vtkm/cont/internal/CMakeLists.txt @@ -44,15 +44,6 @@ set(headers Variant.h ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - TransferInfo.h - VirtualObjectTransfer.h - VirtualObjectTransferInstantiate.h - VirtualObjectTransferShareWithControl.h - ) -endif() - vtkm_declare_headers(${headers}) # These source files are actually compiled in the parent directory. diff --git a/vtkm/cont/internal/CellLocatorBase.h b/vtkm/cont/internal/CellLocatorBase.h index 5f0f9b0f8..4c19df29d 100644 --- a/vtkm/cont/internal/CellLocatorBase.h +++ b/vtkm/cont/internal/CellLocatorBase.h @@ -17,13 +17,6 @@ #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -// To support deprecated implementation -#include -#include -#include -#endif //!VTKM_NO_DEPRECATED_VIRTUAL - namespace vtkm { namespace cont @@ -31,102 +24,6 @@ namespace cont namespace internal { -namespace detail -{ - -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -VTKM_DEPRECATED_SUPPRESS_BEGIN - -// Wrong namespace, but it's only for deprecated code. -template -class VTKM_ALWAYS_EXPORT CellLocatorBaseExecWrapper : public vtkm::exec::CellLocator -{ - LocatorType Locator; - -public: - VTKM_CONT CellLocatorBaseExecWrapper(const LocatorType& locator) - : Locator(locator) - { - } - - VTKM_EXEC_CONT virtual ~CellLocatorBaseExecWrapper() noexcept override - { - // This must not be defaulted, since defaulted virtual destructors are - // troublesome with CUDA __host__ __device__ markup. - } - - VTKM_EXEC vtkm::ErrorCode FindCell(const vtkm::Vec3f& point, - vtkm::Id& cellId, - vtkm::Vec3f& parametric) const override - { - return this->Locator.FindCell(point, cellId, parametric); - } -}; - -template -struct CellLocatorBaseWrapperPrepareForExecutionFunctor -{ - template - VTKM_CONT bool operator()(Device device, - vtkm::cont::VirtualObjectHandle& execHandle, - const LocatorType& locator, - vtkm::cont::Token& token) - { - auto execObject = locator.PrepareForExecution(device, token); - using WrapType = CellLocatorBaseExecWrapper; - execHandle.Reset(new WrapType(execObject)); - return true; - } -}; - -template -class VTKM_ALWAYS_EXPORT CellLocatorBaseWrapper : public vtkm::cont::CellLocator -{ - Derived Locator; - mutable vtkm::cont::VirtualObjectHandle ExecutionObjectHandle; - -public: - CellLocatorBaseWrapper() = default; - - CellLocatorBaseWrapper(const Derived& locator) - : Locator(locator) - { - this->SetCellSet(locator.GetCellSet()); - this->SetCoordinates(locator.GetCoordinates()); - } - - VTKM_CONT const vtkm::exec::CellLocator* PrepareForExecution( - vtkm::cont::DeviceAdapterId device, - vtkm::cont::Token& token) const override - { - bool success = - vtkm::cont::TryExecuteOnDevice(device, - CellLocatorBaseWrapperPrepareForExecutionFunctor{}, - this->ExecutionObjectHandle, - this->Locator, - token); - if (!success) - { - throwFailedRuntimeDeviceTransfer("CellLocatorUniformGrid", device); - } - return this->ExecutionObjectHandle.PrepareForExecution(device, token); - } - -private: - void Build() override - { - this->Locator.SetCellSet(this->GetCellSet()); - this->Locator.SetCoordinates(this->GetCoordinates()); - this->Locator.Update(); - } -}; - -VTKM_DEPRECATED_SUPPRESS_END -#endif //!VTKM_NO_DEPRECATED_VIRTUAL - - -} // namespace detail - /// \brief Base class for all `CellLocator` classes. /// /// `CellLocatorBase` uses the curiously recurring template pattern (CRTP). Subclasses @@ -141,16 +38,6 @@ class VTKM_ALWAYS_EXPORT CellLocatorBase : public vtkm::cont::ExecutionObjectBas mutable bool Modified = true; public: -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - VTKM_DEPRECATED_SUPPRESS_BEGIN - // Support deprecated classes - operator detail::CellLocatorBaseWrapper() const - { - return detail::CellLocatorBaseWrapper(reinterpret_cast(*this)); - } - VTKM_DEPRECATED_SUPPRESS_END -#endif //!VTKM_NO_DEPRECATED_VIRTUAL - const vtkm::cont::UnknownCellSet& GetCellSet() const { return this->CellSet; } void SetCellSet(const vtkm::cont::UnknownCellSet& cellSet) diff --git a/vtkm/cont/internal/PointLocatorBase.h b/vtkm/cont/internal/PointLocatorBase.h index 2330f35cb..5df672708 100644 --- a/vtkm/cont/internal/PointLocatorBase.h +++ b/vtkm/cont/internal/PointLocatorBase.h @@ -16,12 +16,6 @@ #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#include -#include -#endif //!VTKM_NO_DEPRECATED_VIRTUAL - namespace vtkm { namespace cont @@ -29,100 +23,6 @@ namespace cont namespace internal { -namespace detail -{ - -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -VTKM_DEPRECATED_SUPPRESS_BEGIN - -// Wrong namespace, but it's only for deprecated code. -template -class VTKM_ALWAYS_EXPORT PointLocatorBaseExecWrapper : public vtkm::exec::PointLocator -{ - LocatorType Locator; - -public: - VTKM_CONT PointLocatorBaseExecWrapper(const LocatorType& locator) - : Locator(locator) - { - } - - VTKM_EXEC_CONT virtual ~PointLocatorBaseExecWrapper() noexcept override - { - // This must not be defaulted, since defaulted virtual destructors are - // troublesome with CUDA __host__ __device__ markup. - } - - VTKM_EXEC void FindNearestNeighbor(const vtkm::Vec3f& queryPoint, - vtkm::Id& pointId, - vtkm::FloatDefault& distanceSquared) const override - { - return this->Locator.FindNearestNeighbor(queryPoint, pointId, distanceSquared); - } -}; - -template -struct PointLocatorBaseWrapperPrepareForExecutionFunctor -{ - template - VTKM_CONT bool operator()(Device device, - vtkm::cont::VirtualObjectHandle& execHandle, - const LocatorType& locator, - vtkm::cont::Token& token) - { - auto execObject = locator.PrepareForExecution(device, token); - using WrapType = PointLocatorBaseExecWrapper; - execHandle.Reset(new WrapType(execObject)); - return true; - } -}; - -template -class VTKM_ALWAYS_EXPORT PointLocatorBaseWrapper : public vtkm::cont::PointLocator -{ - Derived Locator; - mutable vtkm::cont::VirtualObjectHandle ExecutionObjectHandle; - -public: - PointLocatorBaseWrapper() = default; - - PointLocatorBaseWrapper(const Derived& locator) - : Locator(locator) - { - this->SetCoordinates(locator.GetCoordinates()); - } - - VTKM_CONT const vtkm::exec::PointLocator* PrepareForExecution( - vtkm::cont::DeviceAdapterId device, - vtkm::cont::Token& token) const override - { - const bool success = - vtkm::cont::TryExecuteOnDevice(device, - PointLocatorBaseWrapperPrepareForExecutionFunctor{}, - this->ExecutionObjectHandle, - this->Locator, - token); - if (!success) - { - throwFailedRuntimeDeviceTransfer("PointLocatorWrapper", device); - } - return this->ExecutionObjectHandle.PrepareForExecution(device, token); - } - -private: - void Build() override - { - this->Locator.SetCoordinates(this->GetCoordinates()); - this->Locator.Update(); - } -}; - -VTKM_DEPRECATED_SUPPRESS_END -#endif //!VTKM_NO_DEPRECATED_VIRTUAL - - -} // namespace detail - /// \brief Base class for all `PointLocator` classes. /// /// `PointLocatorBase` uses the curiously recurring template pattern (CRTP). Subclasses @@ -133,16 +33,6 @@ template class VTKM_ALWAYS_EXPORT PointLocatorBase : public vtkm::cont::ExecutionObjectBase { public: -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - VTKM_DEPRECATED_SUPPRESS_BEGIN - // Support deprecated classes - operator detail::PointLocatorBaseWrapper() const - { - return detail::PointLocatorBaseWrapper(reinterpret_cast(*this)); - } - VTKM_DEPRECATED_SUPPRESS_END -#endif //!VTKM_NO_DEPRECATED_VIRTUAL - vtkm::cont::CoordinateSystem GetCoordinates() const { return this->Coords; } void SetCoordinates(const vtkm::cont::CoordinateSystem& coords) { diff --git a/vtkm/cont/internal/TransferInfo.cxx b/vtkm/cont/internal/TransferInfo.cxx deleted file mode 100644 index 4eeab9e74..000000000 --- a/vtkm/cont/internal/TransferInfo.cxx +++ /dev/null @@ -1,69 +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. -//============================================================================ -#include - -#include - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -bool TransferInfoArray::valid(vtkm::cont::DeviceAdapterId devId) const noexcept -{ - return this->DeviceId == devId; -} - -void TransferInfoArray::updateHost( - std::unique_ptr&& host) noexcept -{ - this->Host = std::move(host); -} - -void TransferInfoArray::updateDevice(vtkm::cont::DeviceAdapterId devId, - std::unique_ptr&& hostCopy, - const vtkm::internal::PortalVirtualBase* device, - const std::shared_ptr& deviceState) noexcept -{ - this->HostCopyOfDevice = std::move(hostCopy); - this->DeviceId = devId; - this->Device = device; - this->DeviceTransferState = deviceState; -} - -void TransferInfoArray::releaseDevice() -{ - this->DeviceId = vtkm::cont::DeviceAdapterTagUndefined{}; - this->Device = nullptr; //The device transfer state own this pointer - if (this->DeviceTransferState == nullptr) - { //When the DeviceTransferState is a nullptr it means that - //that the device and host share memory. In that case we need to free - //the host copy - this->HostCopyOfDevice.reset(nullptr); - } - else - { - //The DeviceTransferState holds ownership of HostCopyOfDevice so we only - //need to delete DeviceTransferState, as it will do the rest - this->DeviceTransferState = nullptr; //release the device transfer state - this->HostCopyOfDevice.release(); - } -} - -void TransferInfoArray::releaseAll() -{ - this->Host.release(); //we own this pointer so release it - this->releaseDevice(); -} -} -} -} diff --git a/vtkm/cont/internal/TransferInfo.h b/vtkm/cont/internal/TransferInfo.h deleted file mode 100644 index 4d4b22f7b..000000000 --- a/vtkm/cont/internal/TransferInfo.h +++ /dev/null @@ -1,75 +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. -//============================================================================ -#ifndef vtk_m_cont_internal_TransferInfo_h -#define vtk_m_cont_internal_TransferInfo_h - -#include - -#include -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -#include -#include -#include - -// This is a deprecated class. Don't warn about deprecation while implementing -// deprecated functionality. -VTKM_DEPRECATED_SUPPRESS_BEGIN - -#include - -namespace vtkm -{ - -namespace internal -{ -class PortalVirtualBase; -} - -namespace cont -{ -namespace internal -{ - -struct VTKM_CONT_EXPORT TransferInfoArray -{ - bool valid(vtkm::cont::DeviceAdapterId tagValue) const noexcept; - - void updateHost(std::unique_ptr&& host) noexcept; - void updateDevice( - vtkm::cont::DeviceAdapterId id, - std::unique_ptr&& host_copy, //NOT the same as host version - const vtkm::internal::PortalVirtualBase* device, - const std::shared_ptr& state) noexcept; - void releaseDevice(); - void releaseAll(); - - const vtkm::internal::PortalVirtualBase* hostPtr() noexcept { return this->Host.get(); } - const vtkm::internal::PortalVirtualBase* devicePtr() const noexcept { return this->Device; } - vtkm::cont::DeviceAdapterId deviceId() const noexcept { return this->DeviceId; } - - std::shared_ptr& state() noexcept { return this->DeviceTransferState; } - -private: - vtkm::cont::DeviceAdapterId DeviceId = vtkm::cont::DeviceAdapterTagUndefined{}; - std::unique_ptr Host = nullptr; - std::unique_ptr HostCopyOfDevice = nullptr; - const vtkm::internal::PortalVirtualBase* Device = nullptr; - std::shared_ptr DeviceTransferState = nullptr; -}; -} -} -} - -VTKM_DEPRECATED_SUPPRESS_END - -#endif diff --git a/vtkm/cont/internal/VirtualObjectTransfer.cxx b/vtkm/cont/internal/VirtualObjectTransfer.cxx deleted file mode 100644 index 6d784c0c2..000000000 --- a/vtkm/cont/internal/VirtualObjectTransfer.cxx +++ /dev/null @@ -1,63 +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. -//============================================================================ - -#include - -#include -#include - -#include -#include - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -VTKM_CONT TransferInterface::~TransferInterface() = default; - -bool TransferState::DeviceIdIsValid(vtkm::cont::DeviceAdapterId deviceId) const -{ - auto index = static_cast(deviceId.GetValue()); - auto size = this->DeviceTransferState.size(); - - if (!this->HostPointer) - { - throw vtkm::cont::ErrorBadValue( - "No virtual object was bound before being asked to be executed"); - } - if (index >= size) - { - std::string msg = "An invalid DeviceAdapter[id=" + std::to_string(deviceId.GetValue()) + - ", name=" + deviceId.GetName() + "] was used when trying to construct a virtual object."; - throw vtkm::cont::ErrorBadType(msg); - } - - if (!this->DeviceTransferState[index]) - { - const std::string msg = - "VTK-m was asked to transfer a VirtualObjectHandle for execution on DeviceAdapter[id=" + - std::to_string(deviceId.GetValue()) + ", name=" + deviceId.GetName() + - "]. It can't as this VirtualObjectHandle was not constructed/bound with this " - "DeviceAdapter in the list of valid DeviceAdapters."; - throw vtkm::cont::ErrorBadType(msg); - } - - return true; -} -} -} -} - -VTKM_DEPRECATED_SUPPRESS_END diff --git a/vtkm/cont/internal/VirtualObjectTransfer.h b/vtkm/cont/internal/VirtualObjectTransfer.h deleted file mode 100644 index 90a27a6e7..000000000 --- a/vtkm/cont/internal/VirtualObjectTransfer.h +++ /dev/null @@ -1,180 +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. -//============================================================================ -#ifndef vtk_m_cont_internal_VirtualObjectTransfer_h -#define vtk_m_cont_internal_VirtualObjectTransfer_h - -#include - -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -// This is a deprecated class. Don't warn about deprecation while implementing -// deprecated functionality. -VTKM_DEPRECATED_SUPPRESS_BEGIN - -#include -#include - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -struct CreateTransferInterface; //forward declare for friendship - -template -struct VTKM_DEPRECATED(1.7, "Virtual methods are no longer supported in the execution environment.") - VirtualObjectTransfer -#ifdef VTKM_DOXYGEN_ONLY -{ - /// A VirtualObjectTransfer is constructed with a pointer to the derived type that (eventually) - /// gets transferred to the execution environment of the given DeviceAdapter. - /// - VTKM_CONT VirtualObjectTransfer(const VirtualDerivedType* virtualObject); - - /// \brief Transfers the virtual object to the execution environment. - /// - /// This method transfers the virtual object to the execution environment and returns a pointer - /// to the object that can be used in the execution environment (but not necessarily the control - /// environment). If the \c updateData flag is true, then the data is always copied to the - /// execution environment (such as if the data were updated since the last call to \c - /// PrepareForExecution). If the \c updateData flag is false and the object was already - /// transferred previously, the previously created object is returned. - /// - VTKM_CONT const VirtualDerivedType* PrepareForExecution(bool updateData); - - /// \brief Frees up any resources in the execution environment. - /// - /// Any previously returned virtual object from \c PrepareForExecution becomes invalid. - /// - VTKM_CONT void ReleaseResources(); -} -#endif -; - -class VTKM_CONT_EXPORT VTKM_DEPRECATED( - 1.7, - "Virtual methods are no longer supported in the execution environment.") TransferInterface -{ -public: - VTKM_CONT virtual ~TransferInterface(); - - VTKM_CONT virtual const vtkm::VirtualObjectBase* PrepareForExecution( - vtkm::Id hostModifiedCount) = 0; - VTKM_CONT virtual void ReleaseResources() = 0; -}; - -template -class TransferInterfaceImpl final : public TransferInterface -{ -public: - VTKM_CONT TransferInterfaceImpl(const VirtualDerivedType* virtualObject) - : LastModifiedCount(-1) - , Transfer(virtualObject) - { - } - - VTKM_CONT const vtkm::VirtualObjectBase* PrepareForExecution(vtkm::Id hostModifiedCount) override - { - bool updateData = (this->LastModifiedCount != hostModifiedCount); - const vtkm::VirtualObjectBase* executionObject = this->Transfer.PrepareForExecution(updateData); - this->LastModifiedCount = hostModifiedCount; - return executionObject; - } - - VTKM_CONT void ReleaseResources() override { this->Transfer.ReleaseResources(); } - -private: - vtkm::Id LastModifiedCount; - vtkm::cont::internal::VirtualObjectTransfer Transfer; -}; - - -struct VTKM_CONT_EXPORT VTKM_DEPRECATED( - 1.7, - "Virtual methods are no longer supported in the execution environment.") TransferState -{ - TransferState() = default; - - ~TransferState() { this->ReleaseResources(); } - - bool DeviceIdIsValid(vtkm::cont::DeviceAdapterId deviceId) const; - - bool WillReleaseHostPointer() const { return this->DeleteFunction != nullptr; } - - - void UpdateHost(vtkm::VirtualObjectBase* host, void (*deleteFunction)(void*)) - { - if (this->HostPointer != host) - { - this->ReleaseResources(); - this->HostPointer = host; - this->DeleteFunction = deleteFunction; - } - } - - void ReleaseResources() - { - this->ReleaseExecutionResources(); - - //This needs to be updated to release all execution information - - if (this->DeleteFunction) - { - this->DeleteFunction(this->HostPointer); - } - this->HostPointer = nullptr; - this->DeleteFunction = nullptr; - } - - void ReleaseExecutionResources() - { - //This needs to be updated to only release the active execution part - for (auto& state : this->DeviceTransferState) - { - if (state) - { - state->ReleaseResources(); - } - } - } - - const vtkm::VirtualObjectBase* PrepareForExecution(vtkm::cont::DeviceAdapterId deviceId) const - { - //make sure the device is up to date - auto index = static_cast(deviceId.GetValue()); - vtkm::Id count = this->HostPointer->GetModifiedCount(); - return this->DeviceTransferState[index]->PrepareForExecution(count); - } - - vtkm::VirtualObjectBase* HostPtr() const { return this->HostPointer; } - -private: - friend struct CreateTransferInterface; - - vtkm::VirtualObjectBase* HostPointer = nullptr; - void (*DeleteFunction)(void*) = nullptr; - - std::array, 8> DeviceTransferState; -}; -} -} -} // vtkm::cont::internal - -VTKM_DEPRECATED_SUPPRESS_END - -#endif // vtkm_cont_internal_VirtualObjectTransfer_h diff --git a/vtkm/cont/internal/VirtualObjectTransferInstantiate.h b/vtkm/cont/internal/VirtualObjectTransferInstantiate.h deleted file mode 100644 index f52f52e4b..000000000 --- a/vtkm/cont/internal/VirtualObjectTransferInstantiate.h +++ /dev/null @@ -1,42 +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. -//============================================================================ -#ifndef vtk_m_cont_internal_VirtualObjectTransferInstantiate_h -#define vtk_m_cont_internal_VirtualObjectTransferInstantiate_h - -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -#define VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_FOR_DEVICE(DerivedType, DeviceDapterTagType) \ - template class vtkm::cont::internal::VirtualObjectTransfer - -#if defined(VTKM_ENABLE_CUDA) -#include -#define VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_CUDA(DerivedType) \ - VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_FOR_DEVICE(DerivedType, vtkm::cont::DeviceAdapterTagCuda) -#else // defined(VTKM_ENABLE_CUDA) -#define VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_CUDA(DerivedType) -#endif // defined(VTKM_ENABLE_CUDA) - -#if defined(VTKM_ENABLE_KOKKOS) -#include -#define VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_KOKKOS(DerivedType) \ - VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_FOR_DEVICE(DerivedType, vtkm::cont::DeviceAdapterTagKokkos) -#else // defined(VTKM_ENABLE_KOKKOS) -#define VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_KOKKOS(DerivedType) -#endif // defined(VTKM_ENABLE_KOKKOS) - -#define VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(DerivedType) \ - VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_CUDA(DerivedType) \ - VTKM_EXPLICITLY_INSTANTIATE_TRANSFER_KOKKOS(DerivedType) - -#endif // vtk_m_cont_internal_VirtualObjectTransferInstantiate_h diff --git a/vtkm/cont/internal/VirtualObjectTransferShareWithControl.h b/vtkm/cont/internal/VirtualObjectTransferShareWithControl.h deleted file mode 100644 index d00b7d7f1..000000000 --- a/vtkm/cont/internal/VirtualObjectTransferShareWithControl.h +++ /dev/null @@ -1,49 +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. -//============================================================================ -#ifndef vtk_m_cont_internal_VirtualObjectTransferShareWithControl_h -#define vtk_m_cont_internal_VirtualObjectTransferShareWithControl_h - -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -template -struct VirtualObjectTransferShareWithControl -{ - VTKM_CONT VirtualObjectTransferShareWithControl(const VirtualDerivedType* virtualObject) - : VirtualObject(virtualObject) - { - } - - VTKM_CONT const VirtualDerivedType* PrepareForExecution(bool vtkmNotUsed(updateData)) - { - return this->VirtualObject; - } - - VTKM_CONT void ReleaseResources() {} - -private: - const VirtualDerivedType* VirtualObject; -}; -} -} -} // vtkm::cont::internal - -#endif // vtk_m_cont_internal_VirtualObjectTransferShareWithControl_h diff --git a/vtkm/cont/kokkos/DeviceAdapterKokkos.h b/vtkm/cont/kokkos/DeviceAdapterKokkos.h index 76b921839..eb9f12384 100644 --- a/vtkm/cont/kokkos/DeviceAdapterKokkos.h +++ b/vtkm/cont/kokkos/DeviceAdapterKokkos.h @@ -20,9 +20,6 @@ #include #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL #else // !defined(VTKM_KOKKOS_CUDA) || defined(VTKM_CUDA) diff --git a/vtkm/cont/kokkos/internal/CMakeLists.txt b/vtkm/cont/kokkos/internal/CMakeLists.txt index f003cf2e1..c00a8851d 100644 --- a/vtkm/cont/kokkos/internal/CMakeLists.txt +++ b/vtkm/cont/kokkos/internal/CMakeLists.txt @@ -18,12 +18,6 @@ set(headers RuntimeDeviceConfigurationKokkos.h ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - VirtualObjectTransferKokkos.h - ) -endif() - vtkm_declare_headers(${headers}) if (TARGET vtkm::kokkos) diff --git a/vtkm/cont/kokkos/internal/VirtualObjectTransferKokkos.h b/vtkm/cont/kokkos/internal/VirtualObjectTransferKokkos.h deleted file mode 100644 index 702846a05..000000000 --- a/vtkm/cont/kokkos/internal/VirtualObjectTransferKokkos.h +++ /dev/null @@ -1,122 +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. -//============================================================================ -#ifndef vtk_m_cont_kokkos_internal_VirtualObjectTransferKokkos_h -#define vtk_m_cont_kokkos_internal_VirtualObjectTransferKokkos_h - -#include -#include - -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -template -struct VirtualObjectTransfer -{ - VTKM_CONT VirtualObjectTransfer(const VirtualDerivedType* virtualObject) - : ControlObject(virtualObject) - , ExecutionObject(nullptr) - { - } - - VTKM_CONT ~VirtualObjectTransfer() { this->ReleaseResources(); } - - VirtualObjectTransfer(const VirtualObjectTransfer&) = delete; - void operator=(const VirtualObjectTransfer&) = delete; - - VTKM_CONT const VirtualDerivedType* PrepareForExecution(bool updateData) - { - if (this->ExecutionObject == nullptr || updateData) - { - // deviceTarget will hold a byte copy of the host object on the device. The virtual table - // will be wrong. - vtkm::cont::kokkos::internal::KokkosViewConstCont hbuffer( - reinterpret_cast(this->ControlObject), sizeof(VirtualDerivedType)); - - auto deviceTarget = static_cast( - vtkm::cont::kokkos::internal::Allocate(sizeof(VirtualDerivedType))); - vtkm::cont::kokkos::internal::KokkosViewExec dbuffer( - reinterpret_cast(deviceTarget), sizeof(VirtualDerivedType)); - Kokkos::deep_copy( - vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), dbuffer, hbuffer); - - if (this->ExecutionObject == nullptr) - { - // Allocate memory for the object that will eventually be a correct copy on the device. - auto executionObjectPtr = this->ExecutionObject = static_cast( - vtkm::cont::kokkos::internal::Allocate(sizeof(VirtualDerivedType))); - // Initialize the device object - Kokkos::RangePolicy policy( - vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), 0, 1); - Kokkos::parallel_for( - "ConstructVirtualObject", policy, KOKKOS_LAMBDA(const int&) { - new (executionObjectPtr) VirtualDerivedType(*deviceTarget); - }); - } - else if (updateData) - { - auto executionObjectPtr = this->ExecutionObject; - // Initialize the device object - Kokkos::RangePolicy policy( - vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), 0, 1); - Kokkos::parallel_for( - "UpdateVirtualObject", policy, KOKKOS_LAMBDA(const int&) { - *executionObjectPtr = *deviceTarget; - }); - } - - vtkm::cont::kokkos::internal::Free(deviceTarget); - } - - return this->ExecutionObject; - } - - VTKM_CONT void ReleaseResources() - { - if (this->ExecutionObject != nullptr) - { - auto executionObjectPtr = this->ExecutionObject; - this->ExecutionObject = nullptr; - - Kokkos::RangePolicy policy( - vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), 0, 1); - Kokkos::parallel_for( - "DeleteVirtualObject", policy, KOKKOS_LAMBDA(const int&) { - executionObjectPtr->~VirtualDerivedType(); - }); - vtkm::cont::kokkos::internal::Free(executionObjectPtr); - } - } - -private: - const VirtualDerivedType* ControlObject; - VirtualDerivedType* ExecutionObject; -}; - -VTKM_DEPRECATED_SUPPRESS_END - -} -} -} // vtkm::cont::internal - -#endif // vtk_m_cont_kokkos_internal_VirtualObjectTransferKokkos_h diff --git a/vtkm/cont/openmp/DeviceAdapterOpenMP.h b/vtkm/cont/openmp/DeviceAdapterOpenMP.h index 235bc0f21..2f7517183 100644 --- a/vtkm/cont/openmp/DeviceAdapterOpenMP.h +++ b/vtkm/cont/openmp/DeviceAdapterOpenMP.h @@ -18,9 +18,6 @@ #include #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL #endif #endif //vtk_m_cont_openmp_DeviceAdapterOpenMP_h diff --git a/vtkm/cont/openmp/internal/CMakeLists.txt b/vtkm/cont/openmp/internal/CMakeLists.txt index 16c7f06df..dd04a8af7 100644 --- a/vtkm/cont/openmp/internal/CMakeLists.txt +++ b/vtkm/cont/openmp/internal/CMakeLists.txt @@ -21,12 +21,6 @@ set(headers RuntimeDeviceConfigurationOpenMP.h ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - VirtualObjectTransferOpenMP.h - ) -endif() - vtkm_declare_headers(${headers}) #These sources need to always be built diff --git a/vtkm/cont/openmp/internal/VirtualObjectTransferOpenMP.h b/vtkm/cont/openmp/internal/VirtualObjectTransferOpenMP.h deleted file mode 100644 index 97c5a6445..000000000 --- a/vtkm/cont/openmp/internal/VirtualObjectTransferOpenMP.h +++ /dev/null @@ -1,47 +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. -//============================================================================ - -#ifndef vtk_m_cont_openmp_internal_VirtualObjectTransferOpenMP_h -#define vtk_m_cont_openmp_internal_VirtualObjectTransferOpenMP_h - -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -template -struct VirtualObjectTransfer final - : VirtualObjectTransferShareWithControl -{ - using VirtualObjectTransferShareWithControl< - VirtualDerivedType>::VirtualObjectTransferShareWithControl; -}; - -VTKM_DEPRECATED_SUPPRESS_END - -} -} -} // vtkm::cont::internal - - - -#endif // vtk_m_cont_openmp_internal_VirtualObjectTransferOpenMP_h diff --git a/vtkm/cont/serial/DeviceAdapterSerial.h b/vtkm/cont/serial/DeviceAdapterSerial.h index d10ff7af5..4c20b8577 100644 --- a/vtkm/cont/serial/DeviceAdapterSerial.h +++ b/vtkm/cont/serial/DeviceAdapterSerial.h @@ -17,9 +17,6 @@ #include #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL // clang-format on #endif //vtk_m_cont_serial_DeviceAdapterSerial_h diff --git a/vtkm/cont/serial/internal/CMakeLists.txt b/vtkm/cont/serial/internal/CMakeLists.txt index ed935b464..7ec8db7f1 100644 --- a/vtkm/cont/serial/internal/CMakeLists.txt +++ b/vtkm/cont/serial/internal/CMakeLists.txt @@ -16,12 +16,6 @@ set(headers RuntimeDeviceConfigurationSerial.h ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - VirtualObjectTransferSerial.h - ) -endif() - vtkm_declare_headers(${headers}) target_sources(vtkm_cont PRIVATE diff --git a/vtkm/cont/serial/internal/VirtualObjectTransferSerial.h b/vtkm/cont/serial/internal/VirtualObjectTransferSerial.h deleted file mode 100644 index 5a1b2a941..000000000 --- a/vtkm/cont/serial/internal/VirtualObjectTransferSerial.h +++ /dev/null @@ -1,42 +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. -//============================================================================ -#ifndef vtk_m_cont_serial_internal_VirtualObjectTransferSerial_h -#define vtk_m_cont_serial_internal_VirtualObjectTransferSerial_h - -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -VTKM_DEPRECATED_SUPPRESS_BEGIN -template -struct VirtualObjectTransfer final - : VirtualObjectTransferShareWithControl -{ - using VirtualObjectTransferShareWithControl< - VirtualDerivedType>::VirtualObjectTransferShareWithControl; -}; -VTKM_DEPRECATED_SUPPRESS_END - -} -} -} // vtkm::cont::internal - -#endif // vtk_m_cont_serial_internal_VirtualObjectTransferSerial_h diff --git a/vtkm/cont/tbb/DeviceAdapterTBB.h b/vtkm/cont/tbb/DeviceAdapterTBB.h index 18a9e46fd..f403ea059 100644 --- a/vtkm/cont/tbb/DeviceAdapterTBB.h +++ b/vtkm/cont/tbb/DeviceAdapterTBB.h @@ -17,9 +17,6 @@ #include #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL #endif #endif //vtk_m_cont_tbb_DeviceAdapterTBB_h diff --git a/vtkm/cont/tbb/internal/CMakeLists.txt b/vtkm/cont/tbb/internal/CMakeLists.txt index 6de7248a8..4a04356f5 100644 --- a/vtkm/cont/tbb/internal/CMakeLists.txt +++ b/vtkm/cont/tbb/internal/CMakeLists.txt @@ -18,12 +18,6 @@ set(headers RuntimeDeviceConfigurationTBB.h ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - VirtualObjectTransferTBB.h - ) -endif() - vtkm_declare_headers(${headers} ParallelSortTBB.hxx ) diff --git a/vtkm/cont/tbb/internal/VirtualObjectTransferTBB.h b/vtkm/cont/tbb/internal/VirtualObjectTransferTBB.h deleted file mode 100644 index cbac0db3a..000000000 --- a/vtkm/cont/tbb/internal/VirtualObjectTransferTBB.h +++ /dev/null @@ -1,44 +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. -//============================================================================ -#ifndef vtk_m_cont_tbb_internal_VirtualObjectTransferTBB_h -#define vtk_m_cont_tbb_internal_VirtualObjectTransferTBB_h - -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -template -struct VirtualObjectTransfer final - : VirtualObjectTransferShareWithControl -{ - using VirtualObjectTransferShareWithControl< - VirtualDerivedType>::VirtualObjectTransferShareWithControl; -}; - -VTKM_DEPRECATED_SUPPRESS_END - -} -} -} // vtkm::cont::internal - -#endif // vtk_m_cont_tbb_internal_VirtualObjectTransferTBB_h diff --git a/vtkm/cont/testing/CMakeLists.txt b/vtkm/cont/testing/CMakeLists.txt index 59c464f03..54f421e97 100644 --- a/vtkm/cont/testing/CMakeLists.txt +++ b/vtkm/cont/testing/CMakeLists.txt @@ -27,7 +27,6 @@ set(unit_tests UnitTestArrayHandleReverse.cxx UnitTestArrayHandleThreadSafety.cxx UnitTestArrayHandleUniformPointCoordinates.cxx - UnitTestArrayHandleVirtual.cxx UnitTestArrayPortalFromIterators.cxx UnitTestArrayPortalToIterators.cxx UnitTestBuffer.cxx @@ -125,12 +124,6 @@ if(TARGET vtkm_filter_field_conversion) ) endif() -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - list(APPEND unit_tests_device - UnitTestVirtualObjectHandle.cxx - ) -endif() - vtkm_unit_tests(SOURCES ${unit_tests} DEVICE_SOURCES ${unit_tests_device}) #add distributed tests i.e.test to run with MPI diff --git a/vtkm/cont/testing/TestingDeviceAdapter.h b/vtkm/cont/testing/TestingDeviceAdapter.h index 944930e7a..02bf1668a 100644 --- a/vtkm/cont/testing/TestingDeviceAdapter.h +++ b/vtkm/cont/testing/TestingDeviceAdapter.h @@ -31,10 +31,6 @@ #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL - #include #include @@ -340,45 +336,6 @@ public: vtkm::exec::AtomicArrayExecutionObject AArray; }; -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - VTKM_DEPRECATED_SUPPRESS_BEGIN - - class VirtualObjectTransferKernel - { - public: - struct Interface : public vtkm::VirtualObjectBase - { - VTKM_EXEC virtual vtkm::Id Foo() const = 0; - }; - - struct Concrete : public Interface - { - VTKM_EXEC vtkm::Id Foo() const override { return this->Value; } - - vtkm::Id Value = 0; - }; - - VirtualObjectTransferKernel(const Interface* vo, - IdArrayHandle& result, - vtkm::cont::Token& token) - : Virtual(vo) - , Result(result.PrepareForInPlace(DeviceAdapterTag(), token)) - { - } - - VTKM_EXEC - void operator()(vtkm::Id) const { this->Result.Set(0, this->Virtual->Foo()); } - - VTKM_CONT void SetErrorMessageBuffer(const vtkm::exec::internal::ErrorMessageBuffer&) {} - - private: - const Interface* Virtual; - IdPortalType Result; - }; - - VTKM_DEPRECATED_SUPPRESS_END -#endif //VTKM_NO_DEPRECATED_VIRTUAL - struct CustomPairOp { using ValueType = vtkm::Pair; @@ -612,49 +569,6 @@ private: } } -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - VTKM_DEPRECATED_SUPPRESS_BEGIN - - VTKM_CONT - static void TestVirtualObjectTransfer() - { - std::cout << "-------------------------------------------" << std::endl; - std::cout << "Testing VirtualObjectTransfer" << std::endl; - - using BaseType = typename VirtualObjectTransferKernel::Interface; - using TargetType = typename VirtualObjectTransferKernel::Concrete; - using Transfer = vtkm::cont::internal::VirtualObjectTransfer; - - IdArrayHandle result; - result.Allocate(1); - result.WritePortal().Set(0, 0); - - TargetType target; - target.Value = 5; - - Transfer transfer(&target); - const BaseType* base = static_cast(transfer.PrepareForExecution(false)); - - { - vtkm::cont::Token token; - Algorithm::Schedule(VirtualObjectTransferKernel(base, result, token), 1); - } - VTKM_TEST_ASSERT(result.ReadPortal().Get(0) == 5, "Did not get expected result"); - - { - vtkm::cont::Token token; - target.Value = 10; - base = static_cast(transfer.PrepareForExecution(true)); - Algorithm::Schedule(VirtualObjectTransferKernel(base, result, token), 1); - } - VTKM_TEST_ASSERT(result.ReadPortal().Get(0) == 10, "Did not get expected result"); - - transfer.ReleaseResources(); - } - - VTKM_DEPRECATED_SUPPRESS_END -#endif //VTKM_NO_DEPRECATED_VIRTUAL - static VTKM_CONT void TestAlgorithmSchedule() { std::cout << "-------------------------------------------" << std::endl; @@ -3027,10 +2941,6 @@ private: TestOutOfMemory(); TestTimer(); -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - TestVirtualObjectTransfer(); -#endif //VTKM_NO_DEPRECATED_VIRTUAL - TestAlgorithmSchedule(); TestErrorExecution(); diff --git a/vtkm/cont/testing/UnitTestArrayHandleVirtual.cxx b/vtkm/cont/testing/UnitTestArrayHandleVirtual.cxx deleted file mode 100644 index 7876f088f..000000000 --- a/vtkm/cont/testing/UnitTestArrayHandleVirtual.cxx +++ /dev/null @@ -1,267 +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. -//============================================================================ - -#include -#include - -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#include -#endif - -#include - -#include -#include - -#include - -#include - -#include - -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace UnitTestArrayHandleVirtualDetail -{ - -template -struct Test -{ - static constexpr vtkm::Id ARRAY_SIZE = 100; - static constexpr vtkm::Id NUM_KEYS = 3; - - using ArrayHandle = vtkm::cont::ArrayHandle; - using VirtHandle = vtkm::cont::ArrayHandleVirtual; - using DeviceTag = vtkm::cont::DeviceAdapterTagSerial; - using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; - - void TestConstructors() - { - std::cout << "Constructors" << std::endl; - - VirtHandle nullStorage; - VTKM_TEST_ASSERT(nullStorage.GetStorage().GetStorageVirtual() == nullptr, - "storage should be empty when using ArrayHandleVirtual()."); - - VirtHandle fromArrayHandle{ ArrayHandle{} }; - VTKM_TEST_ASSERT(fromArrayHandle.GetStorage().GetStorageVirtual() != nullptr, - "storage should be empty when using ArrayHandleVirtual()."); - VTKM_TEST_ASSERT(vtkm::cont::IsType(fromArrayHandle), - "ArrayHandleVirtual should contain a ArrayHandle."); - - VirtHandle fromVirtHandle(fromArrayHandle); - VTKM_TEST_ASSERT(fromVirtHandle.GetStorage().GetStorageVirtual() != nullptr, - "storage should be empty when using ArrayHandleVirtual()."); - VTKM_TEST_ASSERT(vtkm::cont::IsType(fromVirtHandle), - "ArrayHandleVirtual should contain a ArrayHandle."); - - VirtHandle fromNullPtrHandle(nullStorage); - VTKM_TEST_ASSERT(fromNullPtrHandle.GetStorage().GetStorageVirtual() == nullptr, - "storage should be empty when constructing from a ArrayHandleVirtual that has " - "nullptr storage."); - VTKM_TEST_ASSERT((vtkm::cont::IsType(fromNullPtrHandle) == false), - "ArrayHandleVirtual shouldn't match any type with nullptr storage."); - } - - - void TestMoveConstructors() - { - std::cout << "Move constructors" << std::endl; - - //test ArrayHandle move constructor - { - ArrayHandle handle; - VirtHandle virt(std::move(handle)); - VTKM_TEST_ASSERT( - vtkm::cont::IsType(virt), - "ArrayHandleVirtual should be valid after move constructor ArrayHandle."); - } - - //test ArrayHandleVirtual move constructor - { - ArrayHandle handle; - VirtHandle virt(std::move(handle)); - VirtHandle virt2(std::move(virt)); - VTKM_TEST_ASSERT( - vtkm::cont::IsType(virt2), - "ArrayHandleVirtual should be valid after move constructor ArrayHandleVirtual."); - } - } - - void TestAssignmentOps() - { - std::cout << "Assignment operators" << std::endl; - - //test assignment operator from ArrayHandleVirtual - { - VirtHandle virt; - virt = VirtHandle{ ArrayHandle{} }; - VTKM_TEST_ASSERT(vtkm::cont::IsType(virt), - "ArrayHandleVirtual should be valid after assignment op from AHV."); - } - - //test assignment operator from ArrayHandle - { - VirtHandle virt = vtkm::cont::ArrayHandleCounting{}; - virt = ArrayHandle{}; - VTKM_TEST_ASSERT(vtkm::cont::IsType(virt), - "ArrayHandleVirtual should be valid after assignment op from AH."); - } - - //test move assignment operator from ArrayHandleVirtual - { - VirtHandle temp{ ArrayHandle{} }; - VirtHandle virt; - virt = std::move(temp); - VTKM_TEST_ASSERT(vtkm::cont::IsType(virt), - "ArrayHandleVirtual should be valid after move assignment op from AHV."); - } - - //test move assignment operator from ArrayHandle - { - vtkm::cont::ArrayHandleCounting temp; - VirtHandle virt; - virt = std::move(temp); - VTKM_TEST_ASSERT(vtkm::cont::IsType(virt), - "ArrayHandleVirtual should be valid after move assignment op from AH."); - } - } - - void TestPrepareForExecution() - { - std::cout << "Prepare for execution" << std::endl; - - vtkm::cont::ArrayHandle handle; - handle.Allocate(ARRAY_SIZE); - - VirtHandle virt(std::move(handle)); - - try - { - vtkm::cont::Token token; - virt.PrepareForInput(DeviceTag(), token); - virt.PrepareForInPlace(DeviceTag(), token); - virt.PrepareForOutput(ARRAY_SIZE, DeviceTag(), token); - } - catch (vtkm::cont::ErrorBadValue&) - { - // un-expected failure. - VTKM_TEST_FAIL( - "Unexpected error when using Prepare* on an ArrayHandleVirtual with StorageAny."); - } - } - - - void TestIsType() - { - std::cout << "IsType" << std::endl; - - vtkm::cont::ArrayHandle handle; - VirtHandle virt(std::move(handle)); - - VTKM_TEST_ASSERT(vtkm::cont::IsType(virt), - "virt should by same type as decltype(virt)"); - VTKM_TEST_ASSERT(vtkm::cont::IsType(virt), - "virt should by same type as decltype(handle)"); - - vtkm::cont::ArrayHandle> vecHandle; - VTKM_TEST_ASSERT(!vtkm::cont::IsType(virt), - "virt shouldn't by same type as decltype(vecHandle)"); - } - - void TestCast() - { - std::cout << "Cast" << std::endl; - - vtkm::cont::ArrayHandle handle; - VirtHandle virt(handle); - - auto c1 = vtkm::cont::Cast(virt); - VTKM_TEST_ASSERT(c1 == virt, "virt should cast to VirtHandle"); - - auto c2 = vtkm::cont::Cast(virt); - VTKM_TEST_ASSERT(c2 == handle, "virt should cast to HandleType"); - - using VecHandle = vtkm::cont::ArrayHandle>; - try - { - auto c3 = vtkm::cont::Cast(virt); - VTKM_TEST_FAIL("Cast of T to Vec should have failed"); - } - catch (vtkm::cont::ErrorBadType&) - { - } - } - - void TestControlPortalLocking() - { - std::cout << "Control portal locking" << std::endl; - - // There was a bug where a control portal was not relinquished and it locked the - // ArrayHandle from further use. - - ArrayHandle concreteArray; - concreteArray.Allocate(ARRAY_SIZE); - - VirtHandle virtualArray(concreteArray); - - // Make sure you can write to the virtualArray and then read the data from the concreteArray - // without the concreteArray getting locked up. - SetPortal(virtualArray.WritePortal()); - CheckPortal(concreteArray.ReadPortal()); - - // Make sure you can read from the virtualArray and the write to the concreteArray without - // the concreteArray getting locked up. - CheckPortal(virtualArray.ReadPortal()); - SetPortal(concreteArray.WritePortal()); - } - - void operator()() - { - std::cout << std::endl; - std::cout << "### Testing for " << vtkm::cont::TypeToString() << std::endl; - TestConstructors(); - TestMoveConstructors(); - TestAssignmentOps(); - TestPrepareForExecution(); - TestIsType(); - TestCast(); - TestControlPortalLocking(); - } -}; - -void TestArrayHandleVirtual() -{ - Test()(); - Test()(); - Test()(); - Test()(); - Test()(); - Test()(); -} - -} // end namespace UnitTestArrayHandleVirtualDetail - -VTKM_DEPRECATED_SUPPRESS_END -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -int UnitTestArrayHandleVirtual(int argc, char* argv[]) -{ -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - using namespace UnitTestArrayHandleVirtualDetail; - return vtkm::cont::testing::Testing::Run(TestArrayHandleVirtual, argc, argv); -#else - (void)argc; - (void)argv; - return 0; -#endif -} diff --git a/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmGeneral.cxx b/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmGeneral.cxx index 7a3743a2c..18bc1667e 100644 --- a/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmGeneral.cxx +++ b/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmGeneral.cxx @@ -26,10 +26,6 @@ #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL - #include // Hijack the serial device id so that precompiled units (like memory management) still work. @@ -89,17 +85,6 @@ class DeviceAdapterMemoryManager -struct VirtualObjectTransfer final - : public VirtualObjectTransferShareWithControl -{ - using VirtualObjectTransferShareWithControl::VirtualObjectTransferShareWithControl; -}; -VTKM_DEPRECATED_SUPPRESS_END -#endif //VTKM_NO_DEPRECATED_VIRTUAL - } } } // namespace vtkm::cont::internal diff --git a/vtkm/cont/testing/UnitTestImplicitFunction.cxx b/vtkm/cont/testing/UnitTestImplicitFunction.cxx index 57dd514a3..34bd3fe97 100644 --- a/vtkm/cont/testing/UnitTestImplicitFunction.cxx +++ b/vtkm/cont/testing/UnitTestImplicitFunction.cxx @@ -15,10 +15,6 @@ #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //!VTKM_NO_DEPRECATED_VIRTUAL - #include #include @@ -41,20 +37,6 @@ public: val = function.Value(point); gradient = function.Gradient(point); } - -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - VTKM_DEPRECATED_SUPPRESS_BEGIN - template - VTKM_EXEC void operator()(const VecType& point, - ScalarType& val, - VecType& gradient, - const FunctionType* function) const - { - val = function->Value(point); - gradient = function->Gradient(point); - } - VTKM_DEPRECATED_SUPPRESS_END -#endif //!VTKM_NO_DEPRECATED_VIRTUAL }; constexpr std::array points_g = { { { 0, 0, 0 }, @@ -96,20 +78,6 @@ void Try(ImplicitFunctorType& function, VTKM_TEST_ASSERT(test_equal_ArrayHandles(gradients, expectedGradientsArray)); } -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - VTKM_DEPRECATED_SUPPRESS_BEGIN - { - vtkm::cont::ImplicitFunctionHandle functionHandle(&function, false); - vtkm::cont::ArrayHandle values; - vtkm::cont::ArrayHandle> gradients; - EvaluateOnCoordinates(functionHandle, values, gradients); - - VTKM_TEST_ASSERT(test_equal_ArrayHandles(values, expectedValuesArray)); - VTKM_TEST_ASSERT(test_equal_ArrayHandles(gradients, expectedGradientsArray)); - } - VTKM_DEPRECATED_SUPPRESS_END -#endif //!VTKM_NO_DEPRECATED_VIRTUAL - { vtkm::ImplicitFunctionMultiplexer functionChoose(function); vtkm::cont::ArrayHandle values; diff --git a/vtkm/cont/testing/UnitTestVariantArrayHandle.cxx b/vtkm/cont/testing/UnitTestVariantArrayHandle.cxx index 79467c31a..4a38f2dc5 100644 --- a/vtkm/cont/testing/UnitTestVariantArrayHandle.cxx +++ b/vtkm/cont/testing/UnitTestVariantArrayHandle.cxx @@ -30,10 +30,6 @@ VTKM_DEPRECATED_SUPPRESS_BEGIN #include #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif - #include #include @@ -125,19 +121,6 @@ struct CheckFunctor CheckArray(array); } -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - template - void operator()(const vtkm::cont::ArrayHandleVirtual& array, - bool& vtkmNotUsed(calledBasic), - bool& calledVirtual) const - { - calledVirtual = true; - std::cout << " Checking for virtual array type: " << typeid(T).name() << std::endl; - - CheckArray(array); - } -#endif //VTKM_NO_DEPRECATED_VIRTUAL - template void operator()(const vtkm::cont::ArrayHandle&, bool&, bool&) const { @@ -258,83 +241,6 @@ void CheckCastToArrayHandle(const ArrayHandleType& array) template using VecOrScalar = typename std::conditional<(NumComps > 1), vtkm::Vec, T>::type; -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -template -void CheckCastToVirtualArrayHandle(const ArrayType& array) -{ - VTKM_IS_ARRAY_HANDLE(ArrayType); - - using ValueType = typename ArrayType::ValueType; - using VTraits = vtkm::VecTraits; - using ComponentType = typename VTraits::ComponentType; - static constexpr vtkm::IdComponent NumComps = VTraits::NUM_COMPONENTS; - - using Storage = typename ArrayType::StorageTag; - using StorageList = vtkm::ListAppend>; - - using TypeList = vtkm::ListAppend>; - using VariantArrayType = vtkm::cont::VariantArrayHandleBase; - - VariantArrayType arrayVariant = array; - - { - auto testArray = arrayVariant.template AsVirtual(); - VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(), - "Did not get back virtual array handle representation."); - } - - { - auto testArray = - arrayVariant.template AsVirtual, StorageList>(); - VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(), - "Did not get back virtual array handle representation."); - } - - { - auto testArray = - arrayVariant.template AsVirtual, StorageList>(); - VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(), - "Did not get back virtual array handle representation."); - } - - { - auto testArray = - arrayVariant.template AsVirtual, StorageList>(); - VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(), - "Did not get back virtual array handle representation."); - } - - { - auto testArray = - arrayVariant.template AsVirtual, StorageList>(); - VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(), - "Did not get back virtual array handle representation."); - } - - { - auto testArray = - arrayVariant.template AsVirtual, StorageList>(); - VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(), - "Did not get back virtual array handle representation."); - } - - bool threw = false; - try - { - arrayVariant.template AsVirtual, StorageList>(); - } - catch (vtkm::cont::ErrorBadType&) - { - // caught expected exception - threw = true; - } - - VTKM_TEST_ASSERT(threw, - "Casting to different vector width did not throw expected " - "ErrorBadType exception."); -} -#endif //VTKM_NO_DEPRECATED_VIRTUAL - template void TryNewInstance(T, ArrayVariantType originalArray) { @@ -468,9 +374,6 @@ template void TryCastToArrayHandle(const ArrayHandleType& array) { CheckCastToArrayHandle(array); -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - CheckCastToVirtualArrayHandle(array); -#endif } void TryCastToArrayHandle() diff --git a/vtkm/cont/testing/UnitTestVirtualObjectHandle.cxx b/vtkm/cont/testing/UnitTestVirtualObjectHandle.cxx deleted file mode 100644 index 42c2d34a8..000000000 --- a/vtkm/cont/testing/UnitTestVirtualObjectHandle.cxx +++ /dev/null @@ -1,215 +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. -//============================================================================ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This test should be disabled if the VTKm_NO_DEPRECATED_VIRTUAL is true." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -#define ARRAY_LEN 8 - -namespace -{ - -class Transformer : public vtkm::VirtualObjectBase -{ -public: - VTKM_EXEC - virtual vtkm::FloatDefault Eval(vtkm::FloatDefault val) const = 0; -}; - -class Square : public Transformer -{ -public: - VTKM_EXEC - vtkm::FloatDefault Eval(vtkm::FloatDefault val) const override { return val * val; } -}; - -class Multiply : public Transformer -{ -public: - VTKM_CONT - void SetMultiplicand(vtkm::FloatDefault val) - { - this->Multiplicand = val; - this->Modified(); - } - - VTKM_CONT - vtkm::FloatDefault GetMultiplicand() const { return this->Multiplicand; } - - VTKM_EXEC - vtkm::FloatDefault Eval(vtkm::FloatDefault val) const override - { - return val * this->Multiplicand; - } - -private: - vtkm::FloatDefault Multiplicand = 0.0f; -}; - -class TransformerFunctor -{ -public: - TransformerFunctor() = default; - explicit TransformerFunctor(const Transformer* impl) - : Impl(impl) - { - } - - VTKM_EXEC - vtkm::FloatDefault operator()(vtkm::FloatDefault val) const { return this->Impl->Eval(val); } - -private: - const Transformer* Impl; -}; - -using FloatArrayHandle = vtkm::cont::ArrayHandle; -using ArrayTransform = vtkm::cont::ArrayHandleTransform; -using TransformerHandle = vtkm::cont::VirtualObjectHandle; - -class TestStage1 -{ -public: - TestStage1(const FloatArrayHandle& input, TransformerHandle& handle) - : Input(&input) - , Handle(&handle) - { - } - - template - bool operator()(DeviceAdapter device) const - { - using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; - std::cout << "\tDeviceAdapter: " << vtkm::cont::DeviceAdapterTraits::GetName() - << std::endl; - - for (int n = 0; n < 2; ++n) - { - vtkm::cont::Token token; - TransformerFunctor tfnctr(this->Handle->PrepareForExecution(device, token)); - ArrayTransform transformed(*this->Input, tfnctr); - - FloatArrayHandle output; - Algorithm::Copy(transformed, output); - auto portal = output.ReadPortal(); - for (vtkm::Id i = 0; i < ARRAY_LEN; ++i) - { - vtkm::FloatDefault expected = TestValue(i, vtkm::FloatDefault{}); - expected = expected * expected; - VTKM_TEST_ASSERT( - test_equal(portal.Get(i), expected), "Expected ", expected, " but got ", portal.Get(i)); - } - std::cout << "\tSuccess." << std::endl; - - if (n == 0) - { - std::cout << "\tReleaseResources and test again..." << std::endl; - this->Handle->ReleaseExecutionResources(); - } - } - return true; - } - -private: - const FloatArrayHandle* Input; - TransformerHandle* Handle; -}; - -class TestStage2 -{ -public: - TestStage2(const FloatArrayHandle& input, Multiply& mul, TransformerHandle& handle) - : Input(&input) - , Mul(&mul) - , Handle(&handle) - { - } - - template - bool operator()(DeviceAdapter device) const - { - using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; - std::cout << "\tDeviceAdapter: " << vtkm::cont::DeviceAdapterTraits::GetName() - << std::endl; - - this->Mul->SetMultiplicand(2); - for (int n = 0; n < 2; ++n) - { - vtkm::cont::Token token; - TransformerFunctor tfnctr(this->Handle->PrepareForExecution(device, token)); - ArrayTransform transformed(*this->Input, tfnctr); - - FloatArrayHandle output; - Algorithm::Copy(transformed, output); - auto portal = output.ReadPortal(); - for (vtkm::Id i = 0; i < ARRAY_LEN; ++i) - { - vtkm::FloatDefault expected = - TestValue(i, vtkm::FloatDefault{}) * this->Mul->GetMultiplicand(); - VTKM_TEST_ASSERT( - test_equal(portal.Get(i), expected), "Expected ", expected, " but got ", portal.Get(i)); - } - std::cout << "\tSuccess." << std::endl; - - if (n == 0) - { - std::cout << "\tUpdate and test again..." << std::endl; - this->Mul->SetMultiplicand(3); - } - } - return true; - } - -private: - const FloatArrayHandle* Input; - Multiply* Mul; - TransformerHandle* Handle; -}; - -void Run() -{ - vtkm::cont::ArrayHandle input; - input.Allocate(ARRAY_LEN); - SetPortal(input.WritePortal()); - - TransformerHandle handle; - - std::cout << "Testing with concrete type 1 (Square)..." << std::endl; - Square sqr; - handle.Reset(&sqr, false); - vtkm::cont::TryExecute(TestStage1(input, handle)); - - std::cout << "ReleaseResources..." << std::endl; - handle.ReleaseResources(); - - std::cout << "Testing with concrete type 2 (Multiply)..." << std::endl; - Multiply mul; - handle.Reset(&mul, false); - vtkm::cont::TryExecute(TestStage2(input, mul, handle)); -} - -} // anonymous namespace - -VTKM_DEPRECATED_SUPPRESS_END - -int UnitTestVirtualObjectHandle(int argc, char* argv[]) -{ - return vtkm::cont::testing::Testing::Run(Run, argc, argv); -} diff --git a/vtkm/exec/CMakeLists.txt b/vtkm/exec/CMakeLists.txt index 450648cef..147c0a666 100644 --- a/vtkm/exec/CMakeLists.txt +++ b/vtkm/exec/CMakeLists.txt @@ -39,13 +39,6 @@ set(header_impls ColorTable.hxx ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - CellLocator.h - PointLocator.h - ) -endif() - #----------------------------------------------------------------------------- add_subdirectory(internal) add_subdirectory(arg) diff --git a/vtkm/exec/CellLocator.h b/vtkm/exec/CellLocator.h deleted file mode 100644 index c853d418f..000000000 --- a/vtkm/exec/CellLocator.h +++ /dev/null @@ -1,69 +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. -//============================================================================ -#ifndef vtk_m_exec_CellLocator_h -#define vtk_m_exec_CellLocator_h - -#include -#include -#include -#include -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "CellLocator with virtual methods is removed. Do not include CellLocator.h" -#endif - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ -namespace exec -{ - -class VTKM_DEPRECATED( - 1.6, - "CellLocator with virtual methods no longer supported. Use CellLocatorGeneral.") - VTKM_ALWAYS_EXPORT CellLocator : public vtkm::VirtualObjectBase -{ - VTKM_DEPRECATED_SUPPRESS_BEGIN -public: - VTKM_EXEC_CONT virtual ~CellLocator() noexcept - { - // This must not be defaulted, since defaulted virtual destructors are - // troublesome with CUDA __host__ __device__ markup. - } - - VTKM_EXEC - virtual vtkm::ErrorCode FindCell(const vtkm::Vec3f& point, - vtkm::Id& cellId, - vtkm::Vec3f& parametric) const = 0; - - VTKM_DEPRECATED(1.6, "FindCell no longer takes worklet argument.") - VTKM_EXEC - void FindCell(const vtkm::Vec3f& point, - vtkm::Id& cellId, - vtkm::Vec3f& parametric, - const vtkm::exec::FunctorBase& worklet) const - { - vtkm::ErrorCode status = this->FindCell(point, cellId, parametric); - if (status != vtkm::ErrorCode::Success) - { - worklet.RaiseError(vtkm::ErrorString(status)); - } - } - VTKM_DEPRECATED_SUPPRESS_END -}; - -} // namespace exec -} // namespace vtkm - -VTKM_DEPRECATED_SUPPRESS_END - -#endif // vtk_m_exec_CellLocator_h diff --git a/vtkm/exec/PointLocator.h b/vtkm/exec/PointLocator.h deleted file mode 100644 index e781314e0..000000000 --- a/vtkm/exec/PointLocator.h +++ /dev/null @@ -1,49 +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. -//============================================================================ -#ifndef vtk_m_exec_PointLocator_h -#define vtk_m_exec_PointLocator_h - -#include - -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "PointLocator with virtual methods is removed. Do not include PointLocator.h" -#endif - -VTKM_DEPRECATED_SUPPRESS_BEGIN - -namespace vtkm -{ -namespace exec -{ - -class VTKM_DEPRECATED(1.6, "PointLocator with virtual methods no longer supported.") - VTKM_ALWAYS_EXPORT PointLocator : public vtkm::VirtualObjectBase -{ - VTKM_DEPRECATED_SUPPRESS_BEGIN -public: - VTKM_EXEC_CONT virtual ~PointLocator() noexcept - { - // This must not be defaulted, since defaulted virtual destructors are - // troublesome with CUDA __host__ __device__ markup. - } - - VTKM_EXEC - virtual void FindNearestNeighbor(const vtkm::Vec3f& queryPoint, - vtkm::Id& pointId, - vtkm::FloatDefault& distanceSquared) const = 0; - VTKM_DEPRECATED_SUPPRESS_END -}; - -} // vtkm::exec -} // vtkm - -VTKM_DEPRECATED_SUPPRESS_END - -#endif // vtk_m_exec_PointLocator_h diff --git a/vtkm/filter/entity_extraction/ExtractPoints.h b/vtkm/filter/entity_extraction/ExtractPoints.h index 9b2a454c1..b0a99041c 100644 --- a/vtkm/filter/entity_extraction/ExtractPoints.h +++ b/vtkm/filter/entity_extraction/ExtractPoints.h @@ -13,10 +13,6 @@ #include -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#include -#endif //VTKM_NO_DEPRECATED_VIRTUAL - #include #include diff --git a/vtkm/internal/ArrayPortalVirtual.h b/vtkm/internal/ArrayPortalVirtual.h deleted file mode 100644 index bd5ba54b0..000000000 --- a/vtkm/internal/ArrayPortalVirtual.h +++ /dev/null @@ -1,154 +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. -//============================================================================ -#ifndef vtk_m_internal_ArrayPortalVirtual_h -#define vtk_m_internal_ArrayPortalVirtual_h - -#include -#ifdef VTKM_NO_DEPRECATED_VIRTUAL -#error "This header should not be included when VTKM_NO_DEPRECATED_VIRTUAL is set." -#endif //VTKM_NO_DEPRECATED_VIRTUAL - -#include -#include - -#include -#include - -namespace vtkm -{ -namespace internal -{ - -class VTKM_ALWAYS_EXPORT PortalVirtualBase -{ -public: - VTKM_EXEC_CONT PortalVirtualBase() noexcept {} - - VTKM_EXEC_CONT virtual ~PortalVirtualBase() noexcept { - //we implement this as we need a destructor with cuda markup. - //Using =default causes cuda free errors inside VirtualObjectTransferCuda - }; -}; - -} // namespace internal - -template -class VTKM_ALWAYS_EXPORT ArrayPortalVirtual : public internal::PortalVirtualBase -{ -public: - using ValueType = T; - - //use parents constructor - using PortalVirtualBase::PortalVirtualBase; - - VTKM_EXEC_CONT virtual ~ArrayPortalVirtual(){}; - - VTKM_EXEC_CONT virtual T Get(vtkm::Id index) const noexcept = 0; - - VTKM_EXEC_CONT virtual void Set(vtkm::Id, const T&) const noexcept {} -}; - - -template -class VTKM_ALWAYS_EXPORT ArrayPortalWrapper final - : public vtkm::ArrayPortalVirtual -{ - using T = typename PortalT::ValueType; - -public: - ArrayPortalWrapper(const PortalT& p) noexcept - : ArrayPortalVirtual() - , Portal(p) - { - } - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - ~ArrayPortalWrapper() {} - - VTKM_EXEC_CONT - T Get(vtkm::Id index) const noexcept - { - using call_supported_t = typename internal::PortalSupportsGets::type; - return this->Get(call_supported_t(), index); - } - - VTKM_EXEC_CONT - void Set(vtkm::Id index, const T& value) const noexcept - { - using call_supported_t = typename internal::PortalSupportsSets::type; - this->Set(call_supported_t(), index, value); - } - -private: - // clang-format off - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT inline T Get(std::true_type, vtkm::Id index) const noexcept { return this->Portal.Get(index); } - VTKM_EXEC_CONT inline T Get(std::false_type, vtkm::Id) const noexcept { return T{}; } - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT inline void Set(std::true_type, vtkm::Id index, const T& value) const noexcept { this->Portal.Set(index, value); } - VTKM_EXEC_CONT inline void Set(std::false_type, vtkm::Id, const T&) const noexcept {} - // clang-format on - - - PortalT Portal; -}; - - -template -class VTKM_ALWAYS_EXPORT ArrayPortalRef -{ -public: - using ValueType = T; - - VTKM_EXEC_CONT - ArrayPortalRef() noexcept - : Portal(nullptr) - , NumberOfValues(0) - { - } - - VTKM_EXEC_CONT - ArrayPortalRef(const ArrayPortalVirtual* portal, vtkm::Id numValues) noexcept - : Portal(portal) - , NumberOfValues(numValues) - { - } - - //Currently this needs to be valid on both the host and device for cuda, so we can't - //call the underlying portal as that uses device virtuals and the method will fail. - //We need to seriously look at the interaction of portals and iterators for device - //adapters and determine a better approach as iterators are really fat - VTKM_EXEC_CONT inline vtkm::Id GetNumberOfValues() const noexcept { return this->NumberOfValues; } - - //This isn't valid on the host for cuda - VTKM_EXEC_CONT inline T Get(vtkm::Id index) const noexcept { return this->Portal->Get(index); } - - //This isn't valid on the host for - VTKM_EXEC_CONT inline void Set(vtkm::Id index, const T& t) const noexcept - { - this->Portal->Set(index, t); - } - - const ArrayPortalVirtual* Portal; - vtkm::Id NumberOfValues; -}; - -template -inline ArrayPortalRef make_ArrayPortalRef(const ArrayPortalVirtual* portal, - vtkm::Id numValues) noexcept -{ - return ArrayPortalRef(portal, numValues); -} - - -} // namespace vtkm - -#endif diff --git a/vtkm/internal/CMakeLists.txt b/vtkm/internal/CMakeLists.txt index 75bbc799d..62e860314 100755 --- a/vtkm/internal/CMakeLists.txt +++ b/vtkm/internal/CMakeLists.txt @@ -38,7 +38,6 @@ elseif(TARGET vtkm::kokkos_hip) endif() set(VTKM_ENABLE_LOGGING ${VTKm_ENABLE_LOGGING}) -set(VTKM_NO_DEPRECATED_VIRTUAL ${VTKm_NO_DEPRECATED_VIRTUAL}) vtkm_get_kit_name(kit_name kit_dir) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Configure.h.in @@ -76,12 +75,6 @@ set(headers Windows.h ) -if (NOT VTKm_NO_DEPRECATED_VIRTUAL) - set(headers ${headers} - ArrayPortalVirtual.h - ) -endif() - vtkm_declare_headers(${headers}) vtkm_pyexpander_generated_file(FunctionInterfaceDetailPre.h) diff --git a/vtkm/internal/Configure.h.in b/vtkm/internal/Configure.h.in index d75c2d5fa..f290d8e39 100644 --- a/vtkm/internal/Configure.h.in +++ b/vtkm/internal/Configure.h.in @@ -323,10 +323,6 @@ //Mark if we have enabled logging. #cmakedefine VTKM_ENABLE_LOGGING -#ifndef VTKM_NO_DEPRECATED_VIRTUAL -#cmakedefine VTKM_NO_DEPRECATED_VIRTUAL -#endif - // Define a pair of macros, VTKM_SWALLOW_SEMICOLON_PRE_BLOCK and // VTKM_SWALLOW_SEMICOLON_POST_BLOCK that can be used around a block in a // macro to "swallow" the semicolon after the macro's use so that it is diff --git a/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx b/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx index 94d1393f8..45f6436a3 100644 --- a/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx +++ b/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx @@ -53,17 +53,6 @@ struct CheckSameCoordinateSystem CheckSameField{}(originalArray, fileCoords); } -#ifndef VTKM_NO_DEPRECATED_VIRTUAL - VTKM_DEPRECATED_SUPPRESS_BEGIN - template - void operator()(const vtkm::cont::ArrayHandleVirtual& originalArray, - const vtkm::cont::CoordinateSystem& fileCoords) const - { - CheckSameField{}(originalArray, fileCoords); - } - VTKM_DEPRECATED_SUPPRESS_END -#endif - void operator()(const vtkm::cont::ArrayHandleUniformPointCoordinates& originalArray, const vtkm::cont::CoordinateSystem& fileCoords) const {