mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
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.
This commit is contained in:
parent
13ee0b5cdc
commit
ea560e9486
@ -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 "")
|
||||
|
@ -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:
|
||||
|
@ -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()
|
||||
|
||||
|
||||
|
@ -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}")
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -19,10 +19,6 @@
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ArrayHandleVirtual.h>
|
||||
#endif
|
||||
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
@ -420,20 +416,6 @@ void BenchBlackScholesStatic(::benchmark::State& state)
|
||||
};
|
||||
VTKM_BENCHMARK_TEMPLATES(BenchBlackScholesStatic, ValueTypes);
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
template <typename ValueType>
|
||||
void BenchBlackScholesDynamic(::benchmark::State& state)
|
||||
{
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
BenchBlackScholesImpl<ValueType> 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 <typename ValueType>
|
||||
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 <typename ValueType>
|
||||
void BenchMathDynamic(::benchmark::State& state)
|
||||
{
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
BenchMathImpl<ValueType> 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 <typename ValueType>
|
||||
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 <typename ValueType>
|
||||
void BenchFusedMathDynamic(::benchmark::State& state)
|
||||
{
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
BenchFusedMathImpl<ValueType> 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 <typename ValueType>
|
||||
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 <typename ValueType>
|
||||
void BenchEdgeInterpDynamic(::benchmark::State& state)
|
||||
{
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
BenchEdgeInterpImpl<ValueType> 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<vtkm::Vec3f> 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;
|
||||
|
@ -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 \
|
||||
|
7
docs/changelog/delete-deprecated.md
Normal file
7
docs/changelog/delete-deprecated.md
Normal file
@ -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.
|
@ -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
|
||||
)
|
||||
|
@ -20,39 +20,9 @@
|
||||
// For interface class only.
|
||||
#include <vtkm/cont/ExecutionAndControlObjectBase.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/VirtualObjectBase.h>
|
||||
#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<Scalar, 3>;
|
||||
|
||||
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
|
||||
|
@ -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 <vtkm/Types.h>
|
||||
|
||||
#include <vtkm/VecFromPortal.h>
|
||||
#include <vtkm/internal/ArrayPortalVirtual.h>
|
||||
|
||||
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 <typename T>
|
||||
class VTKM_ALWAYS_EXPORT VecFromVirtPortal
|
||||
{
|
||||
using RefType = vtkm::internal::ArrayPortalValueReference<vtkm::ArrayPortalRef<T>>;
|
||||
|
||||
public:
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
VecFromVirtPortal(const vtkm::ArrayPortalRef<T>* 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::IdComponent DestSize>
|
||||
VTKM_EXEC_CONT void CopyInto(vtkm::Vec<T, DestSize>& 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<T>* Portal = nullptr;
|
||||
vtkm::IdComponent NumComponents = 0;
|
||||
vtkm::Id Offset = 0;
|
||||
};
|
||||
}
|
||||
#endif
|
@ -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 <vtkm/Deprecated.h>
|
||||
#include <vtkm/Types.h>
|
||||
|
||||
#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
|
@ -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 <vtkm/cont/ArrayHandleVirtual.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
#define VTK_M_ARRAY_HANDLE_VIRTUAL_INSTANTIATE(T) \
|
||||
template class VTKM_CONT_EXPORT ArrayHandle<T, StorageTagVirtual>; \
|
||||
template class VTKM_CONT_EXPORT ArrayHandleVirtual<T>; \
|
||||
template class VTKM_CONT_EXPORT ArrayHandle<vtkm::Vec<T, 2>, StorageTagVirtual>; \
|
||||
template class VTKM_CONT_EXPORT ArrayHandleVirtual<vtkm::Vec<T, 2>>; \
|
||||
template class VTKM_CONT_EXPORT ArrayHandle<vtkm::Vec<T, 3>, StorageTagVirtual>; \
|
||||
template class VTKM_CONT_EXPORT ArrayHandleVirtual<vtkm::Vec<T, 3>>; \
|
||||
template class VTKM_CONT_EXPORT ArrayHandle<vtkm::Vec<T, 4>, StorageTagVirtual>; \
|
||||
template class VTKM_CONT_EXPORT ArrayHandleVirtual<vtkm::Vec<T, 4>>
|
||||
|
||||
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
|
@ -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 <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/DeviceAdapterTag.h>
|
||||
#include <vtkm/cont/StorageVirtual.h>
|
||||
|
||||
#include <vtkm/cont/internal/ArrayHandleDeprecated.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#ifdef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#error "ArrayHandleVirtual is removed. Do not include ArrayHandleVirtual.h"
|
||||
#endif
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
template <typename T>
|
||||
VTKM_ARRAY_HANDLE_DEPRECATED(T, vtkm::cont::StorageTagVirtual);
|
||||
|
||||
template <typename T>
|
||||
class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6) ArrayHandleVirtual
|
||||
: public vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>
|
||||
{
|
||||
using StorageType = vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagVirtual>;
|
||||
|
||||
public:
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleVirtual,
|
||||
(ArrayHandleVirtual<T>),
|
||||
(vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>));
|
||||
|
||||
///Construct a valid ArrayHandleVirtual from an existing ArrayHandle
|
||||
///that doesn't derive from ArrayHandleVirtual.
|
||||
///Note left non-explicit to allow:
|
||||
///
|
||||
/// std::vector<vtkm::cont::ArrayHandleVirtual<vtkm::Float64>> vectorOfArrays;
|
||||
/// //Make basic array.
|
||||
/// vtkm::cont::ArrayHandle<vtkm::Float64> basicArray;
|
||||
/// //Fill basicArray...
|
||||
/// vectorOfArrays.push_back(basicArray);
|
||||
///
|
||||
/// // Make fancy array.
|
||||
/// vtkm::cont::ArrayHandleCounting<vtkm::Float64> fancyArray(-1.0, 0.1, ARRAY_SIZE);
|
||||
/// vectorOfArrays.push_back(fancyArray);
|
||||
template <typename S>
|
||||
ArrayHandleVirtual(const vtkm::cont::ArrayHandle<T, S>& ah)
|
||||
: Superclass(StorageType(ah))
|
||||
{
|
||||
using is_base = std::is_base_of<StorageType, S>;
|
||||
static_assert(!is_base::value, "Wrong specialization for ArrayHandleVirtual selected");
|
||||
}
|
||||
|
||||
/// Returns true if this array matches the type passed in.
|
||||
///
|
||||
template <typename ArrayHandleType>
|
||||
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<vtkm::cont::StorageTagVirtual, ST>;
|
||||
|
||||
//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<T, VT>;
|
||||
|
||||
return this->IsSameType<ArrayHandleType>(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 <typename ArrayHandleType>
|
||||
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<vtkm::cont::StorageTagVirtual, ST>;
|
||||
|
||||
//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<T, VT>;
|
||||
|
||||
return this->CastToType<ArrayHandleType>(same_value_type{}, is_base{});
|
||||
}
|
||||
|
||||
/// Returns a new instance of an ArrayHandleVirtual with the same storage
|
||||
///
|
||||
VTKM_CONT ArrayHandleVirtual<T> NewInstance() const
|
||||
{
|
||||
return ArrayHandleVirtual<T>(this->GetStorage().NewInstance());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename ArrayHandleType>
|
||||
inline bool IsSameType(std::false_type, std::true_type) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
template <typename ArrayHandleType>
|
||||
inline bool IsSameType(std::false_type, std::false_type) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
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<const ArrayHandleType*>(this);
|
||||
return casted != nullptr;
|
||||
}
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
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<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>();
|
||||
}
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
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<ArrayHandleType>());
|
||||
return ArrayHandleType{};
|
||||
}
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
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<ArrayHandleType>());
|
||||
return ArrayHandleType{};
|
||||
}
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
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<const ArrayHandleType*>(this);
|
||||
if (!derived)
|
||||
{
|
||||
VTKM_LOG_CAST_FAIL(*this, ArrayHandleType);
|
||||
throwFailedDynamicCast("ArrayHandleVirtual", vtkm::cont::TypeToString<ArrayHandleType>());
|
||||
}
|
||||
VTKM_LOG_CAST_SUCC(*this, derived);
|
||||
return *derived;
|
||||
}
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
ArrayHandleType CastToType(std::true_type vtkmNotUsed(valueTypesMatch),
|
||||
std::false_type vtkmNotUsed(notFromArrayHandleVirtual)) const;
|
||||
};
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/// A convenience function for creating an ArrayHandleVirtual.
|
||||
template <typename T, typename S>
|
||||
VTKM_CONT vtkm::cont::ArrayHandleVirtual<T> make_ArrayHandleVirtual(
|
||||
const vtkm::cont::ArrayHandle<T, S>& ah)
|
||||
{
|
||||
return vtkm::cont::ArrayHandleVirtual<T>(ah);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Free function casting helpers
|
||||
|
||||
/// Returns true if \c virtHandle matches the type of ArrayHandleType.
|
||||
///
|
||||
template <typename ArrayHandleType, typename T>
|
||||
VTKM_CONT inline bool IsType(
|
||||
const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>& virtHandle)
|
||||
{
|
||||
return static_cast<vtkm::cont::ArrayHandleVirtual<T>>(virtHandle)
|
||||
.template IsType<ArrayHandleType>();
|
||||
}
|
||||
|
||||
/// 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 <typename ArrayHandleType, typename T>
|
||||
VTKM_CONT inline ArrayHandleType Cast(
|
||||
const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>& virtHandle)
|
||||
{
|
||||
return static_cast<vtkm::cont::ArrayHandleVirtual<T>>(virtHandle)
|
||||
.template Cast<ArrayHandleType>();
|
||||
}
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
/// @cond SERIALIZATION
|
||||
template <typename T>
|
||||
struct SerializableTypeString<vtkm::cont::ArrayHandleVirtual<T>>
|
||||
{
|
||||
static VTKM_CONT const std::string& Get()
|
||||
{
|
||||
static std::string name = "AH_Virtual<" + SerializableTypeString<T>::Get() + ">";
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct SerializableTypeString<vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>>
|
||||
: public SerializableTypeString<vtkm::cont::ArrayHandleVirtual<T>>
|
||||
{
|
||||
};
|
||||
|
||||
#ifndef vtk_m_cont_ArrayHandleVirtual_cxx
|
||||
|
||||
#define VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(T) \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<T, StorageTagVirtual>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandleVirtual<T>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Vec<T, 2>, StorageTagVirtual>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandleVirtual<vtkm::Vec<T, 2>>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Vec<T, 3>, StorageTagVirtual>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandleVirtual<vtkm::Vec<T, 3>>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Vec<T, 4>, StorageTagVirtual>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandleVirtual<vtkm::Vec<T, 4>>
|
||||
|
||||
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
|
@ -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 <vtkm/cont/ArrayHandleVirtual.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
template <typename ArrayHandleType>
|
||||
ArrayHandleType inline ArrayHandleVirtual<T>::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<ArrayHandleType>());
|
||||
}
|
||||
using S = typename ArrayHandleType::StorageTag;
|
||||
const auto* castStorage =
|
||||
storage->template Cast<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>();
|
||||
return castStorage->GetHandle();
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
|
||||
#include <vtkm/cont/ArrayHandleConstant.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
/// @cond SERIALIZATION
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Serialization<vtkm::cont::ArrayHandleVirtual<T>>
|
||||
{
|
||||
|
||||
static VTKM_CONT void save(vtkmdiy::BinaryBuffer& bb,
|
||||
const vtkm::cont::ArrayHandleVirtual<T>& obj)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
if (obj.template IsType<decltype(array)>())
|
||||
{
|
||||
array = obj.template Cast<decltype(array)>();
|
||||
}
|
||||
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<T>& obj)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = std::move(vtkm::cont::ArrayHandleVirtual<T>{ array });
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct IntAnySerializer
|
||||
{
|
||||
using CountingType = vtkm::cont::ArrayHandleCounting<T>;
|
||||
using ConstantType = vtkm::cont::ArrayHandleConstant<T>;
|
||||
using BasicType = vtkm::cont::ArrayHandle<T>;
|
||||
|
||||
static VTKM_CONT void save(vtkmdiy::BinaryBuffer& bb,
|
||||
const vtkm::cont::ArrayHandleVirtual<T>& obj)
|
||||
{
|
||||
if (obj.template IsType<CountingType>())
|
||||
{
|
||||
vtkmdiy::save(bb, vtkm::cont::SerializableTypeString<CountingType>::Get());
|
||||
|
||||
using S = typename CountingType::StorageTag;
|
||||
const vtkm::cont::internal::detail::StorageVirtual* storage =
|
||||
obj.GetStorage().GetStorageVirtual();
|
||||
auto* castStorage = storage->Cast<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>();
|
||||
vtkmdiy::save(bb, castStorage->GetHandle());
|
||||
}
|
||||
else if (obj.template IsType<ConstantType>())
|
||||
{
|
||||
vtkmdiy::save(bb, vtkm::cont::SerializableTypeString<ConstantType>::Get());
|
||||
|
||||
using S = typename ConstantType::StorageTag;
|
||||
const vtkm::cont::internal::detail::StorageVirtual* storage =
|
||||
obj.GetStorage().GetStorageVirtual();
|
||||
auto* castStorage = storage->Cast<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>();
|
||||
vtkmdiy::save(bb, castStorage->GetHandle());
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkmdiy::save(bb, vtkm::cont::SerializableTypeString<BasicType>::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<T>& obj)
|
||||
{
|
||||
std::string typeString;
|
||||
vtkmdiy::load(bb, typeString);
|
||||
|
||||
if (typeString == vtkm::cont::SerializableTypeString<CountingType>::Get())
|
||||
{
|
||||
CountingType array;
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = std::move(vtkm::cont::ArrayHandleVirtual<T>{ array });
|
||||
}
|
||||
else if (typeString == vtkm::cont::SerializableTypeString<ConstantType>::Get())
|
||||
{
|
||||
ConstantType array;
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = std::move(vtkm::cont::ArrayHandleVirtual<T>{ array });
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = std::move(vtkm::cont::ArrayHandleVirtual<T>{ array });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
struct Serialization<vtkm::cont::ArrayHandleVirtual<vtkm::UInt8>>
|
||||
: public IntAnySerializer<vtkm::UInt8>
|
||||
{
|
||||
};
|
||||
template <>
|
||||
struct Serialization<vtkm::cont::ArrayHandleVirtual<vtkm::Int32>>
|
||||
: public IntAnySerializer<vtkm::Int32>
|
||||
{
|
||||
};
|
||||
template <>
|
||||
struct Serialization<vtkm::cont::ArrayHandleVirtual<vtkm::Int64>>
|
||||
: public IntAnySerializer<vtkm::Int64>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Serialization<vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>>
|
||||
: public Serialization<vtkm::cont::ArrayHandleVirtual<T>>
|
||||
{
|
||||
};
|
||||
|
||||
} // mangled_diy_namespace
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
#endif
|
@ -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 <vtkm/cont/ArrayHandleVirtual.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayHandleCast.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
|
||||
#include <vtkm/cont/ErrorBadType.h>
|
||||
#include <vtkm/cont/Logging.h>
|
||||
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
#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<vtkm::Vec3f>
|
||||
{
|
||||
public:
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS_NT(ArrayHandleVirtualCoordinates,
|
||||
(vtkm::cont::ArrayHandleVirtual<vtkm::Vec3f>));
|
||||
|
||||
template <typename T, typename S>
|
||||
explicit ArrayHandleVirtualCoordinates(const vtkm::cont::ArrayHandle<T, S>& ah)
|
||||
: vtkm::cont::ArrayHandleVirtual<vtkm::Vec3f>(vtkm::cont::make_ArrayHandleCast<ValueType>(ah))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Functor, typename... Args>
|
||||
void CastAndCall(const vtkm::cont::ArrayHandleVirtualCoordinates& coords,
|
||||
Functor&& f,
|
||||
Args&&... args)
|
||||
{
|
||||
using HandleType = ArrayHandleUniformPointCoordinates;
|
||||
if (coords.IsType<HandleType>())
|
||||
{
|
||||
HandleType uniform = coords.Cast<HandleType>();
|
||||
f(uniform, std::forward<Args>(args)...);
|
||||
}
|
||||
else
|
||||
{
|
||||
f(coords, std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
struct SerializableTypeString<vtkm::cont::ArrayHandleVirtualCoordinates>
|
||||
{
|
||||
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<vtkm::cont::ArrayHandleVirtualCoordinates>
|
||||
{
|
||||
private:
|
||||
using Type = vtkm::cont::ArrayHandleVirtualCoordinates;
|
||||
using BaseType = vtkm::cont::ArrayHandle<typename Type::ValueType, typename Type::StorageTag>;
|
||||
|
||||
using BasicCoordsType = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
|
||||
using RectilinearCoordsArrayType =
|
||||
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>>;
|
||||
|
||||
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<vtkm::cont::ArrayHandleUniformPointCoordinates>())
|
||||
{
|
||||
using HandleType = vtkm::cont::ArrayHandleUniformPointCoordinates;
|
||||
using T = typename HandleType::ValueType;
|
||||
using S = typename HandleType::StorageTag;
|
||||
auto array = storage->Cast<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>();
|
||||
vtkmdiy::save(bb, vtkm::cont::SerializableTypeString<HandleType>::Get());
|
||||
vtkmdiy::save(bb, array->GetHandle());
|
||||
}
|
||||
else if (obj.IsType<RectilinearCoordsArrayType>())
|
||||
{
|
||||
using HandleType = RectilinearCoordsArrayType;
|
||||
using T = typename HandleType::ValueType;
|
||||
using S = typename HandleType::StorageTag;
|
||||
auto array = storage->Cast<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>();
|
||||
vtkmdiy::save(bb, vtkm::cont::SerializableTypeString<HandleType>::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<BasicCoordsType>())
|
||||
{
|
||||
// If the object actually is a BasicCoordsType, just save it.
|
||||
array =
|
||||
storage->Cast<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>()->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<BasicCoordsType>::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<vtkm::cont::ArrayHandleUniformPointCoordinates>::Get())
|
||||
{
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates array;
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
||||
}
|
||||
else if (typeString == vtkm::cont::SerializableTypeString<RectilinearCoordsArrayType>::Get())
|
||||
{
|
||||
RectilinearCoordsArrayType array;
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
||||
}
|
||||
else if (typeString == vtkm::cont::SerializableTypeString<BasicCoordsType>::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
|
@ -17,10 +17,6 @@
|
||||
|
||||
#include <vtkm/cont/Algorithm.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ArrayHandleVirtual.h>
|
||||
#endif
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace vtkm
|
||||
@ -100,49 +96,6 @@ inline vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeComputeImpl(
|
||||
} // namespace detail
|
||||
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
VTKM_CONT
|
||||
inline vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
|
||||
const vtkm::cont::ArrayHandleVirtual<vtkm::Vec3f>& input,
|
||||
vtkm::cont::DeviceAdapterId device)
|
||||
{
|
||||
using UniformHandleType = ArrayHandleUniformPointCoordinates;
|
||||
using RectilinearHandleType =
|
||||
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>>;
|
||||
|
||||
if (input.IsType<UniformHandleType>())
|
||||
{
|
||||
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<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>();
|
||||
|
||||
return ArrayRangeCompute(castStorage->GetHandle(), device);
|
||||
}
|
||||
else if (input.IsType<RectilinearHandleType>())
|
||||
{
|
||||
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<vtkm::cont::internal::detail::StorageVirtualImpl<T, S>>();
|
||||
|
||||
return ArrayRangeCompute(castStorage->GetHandle(), device);
|
||||
}
|
||||
else
|
||||
{
|
||||
return detail::ArrayRangeComputeImpl(input, device);
|
||||
}
|
||||
}
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
inline vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
|
||||
const ArrayHandleType& input,
|
||||
|
@ -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)
|
||||
|
@ -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 <vtkm/cont/CellLocator.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
CellLocator::~CellLocator() = default;
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
}
|
||||
}
|
@ -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 <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/ExecutionObjectBase.h>
|
||||
#include <vtkm/cont/UnknownCellSet.h>
|
||||
|
||||
#include <vtkm/exec/CellLocator.h>
|
||||
|
||||
#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
|
@ -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::cont::ArrayHandleVirtualCoordinates>();
|
||||
}
|
||||
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<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>
|
||||
CoordinateSystem::GetData() const
|
||||
{
|
||||
return vtkm::cont::UncertainArrayHandle<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>(
|
||||
this->Superclass::GetData());
|
||||
}
|
||||
#endif //!VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
|
||||
VTKM_CONT vtkm::cont::CoordinateSystem::MultiplexerArrayType
|
||||
|
@ -18,113 +18,11 @@
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ArrayHandleVirtualCoordinates.h>
|
||||
#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<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>
|
||||
{
|
||||
using Superclass =
|
||||
vtkm::cont::UncertainArrayHandle<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>;
|
||||
|
||||
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<vtkm::Vec3f, vtkm::cont::StorageTagVirtual>() 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 <typename Device>
|
||||
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 <typename Device>
|
||||
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 <typename Device>
|
||||
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<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>
|
||||
GetData() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef VTKM_USE_DOUBLE_PRECISION
|
||||
@ -275,14 +169,6 @@ struct DynamicTransformTraits<vtkm::cont::CoordinateSystem>
|
||||
using DynamicTag = vtkm::cont::internal::DynamicTransformTagCastAndCall;
|
||||
};
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
template <>
|
||||
struct DynamicTransformTraits<vtkm::cont::detail::CoordDataDepWrapper>
|
||||
{
|
||||
using DynamicTag = vtkm::cont::internal::DynamicTransformTagCastAndCall;
|
||||
};
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace cont
|
||||
@ -294,16 +180,6 @@ struct DynamicTransformTraits<vtkm::cont::detail::CoordDataDepWrapper>
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
template <>
|
||||
struct Serialization<vtkm::cont::detail::CoordDataDepWrapper>
|
||||
: public Serialization<
|
||||
vtkm::cont::UncertainArrayHandle<vtkm::List<vtkm::Vec3f_32, vtkm::Vec3f_64>,
|
||||
VTKM_DEFAULT_STORAGE_LIST>>
|
||||
{
|
||||
};
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
template <>
|
||||
struct Serialization<vtkm::cont::CoordinateSystem> : Serialization<vtkm::cont::Field>
|
||||
{
|
||||
|
@ -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 <vtkm/ImplicitFunction.h>
|
||||
#include <vtkm/cont/VirtualObjectHandle.h>
|
||||
|
||||
#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 <typename FunctionType>
|
||||
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<vtkm::ImplicitFunction>
|
||||
{
|
||||
private:
|
||||
using Superclass = vtkm::cont::VirtualObjectHandle<vtkm::ImplicitFunction>;
|
||||
|
||||
public:
|
||||
ImplicitFunctionHandle() = default;
|
||||
|
||||
template <typename VirtualDerivedType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST,
|
||||
typename = typename std::enable_if<
|
||||
std::is_base_of<vtkm::ImplicitFunction, VirtualDerivedType>::value>::type>
|
||||
explicit ImplicitFunctionHandle(VirtualDerivedType* function,
|
||||
bool acquireOwnership = true,
|
||||
DeviceAdapterList devices = DeviceAdapterList())
|
||||
: Superclass(function, acquireOwnership, devices)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename ImplicitFunctionType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST>
|
||||
explicit ImplicitFunctionHandle(
|
||||
vtkm::internal::ImplicitFunctionBase<ImplicitFunctionType>* function,
|
||||
bool acquireOwnership = true,
|
||||
DeviceAdapterList devices = DeviceAdapterList())
|
||||
: Superclass(new detail::ImplicitFunctionBaseExecWrapper<ImplicitFunctionType>(
|
||||
*reinterpret_cast<ImplicitFunctionType*>(function)),
|
||||
true,
|
||||
devices)
|
||||
{
|
||||
if (acquireOwnership)
|
||||
{
|
||||
delete function;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename ImplicitFunctionType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST>
|
||||
VTKM_CONT void Reset(vtkm::internal::ImplicitFunctionBase<ImplicitFunctionType>* function,
|
||||
bool acquireOwnership = true,
|
||||
DeviceAdapterList devices = DeviceAdapterList{})
|
||||
{
|
||||
this->Reset(new detail::ImplicitFunctionBaseExecWrapper<ImplicitFunctionType>(
|
||||
*reinterpret_cast<ImplicitFunctionType*>(function)),
|
||||
true,
|
||||
devices);
|
||||
if (acquireOwnership)
|
||||
{
|
||||
delete function;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VirtualDerivedType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST,
|
||||
typename = typename std::enable_if<
|
||||
std::is_base_of<vtkm::ImplicitFunction, VirtualDerivedType>::value>::type>
|
||||
VTKM_CONT void Reset(VirtualDerivedType* derived,
|
||||
bool acquireOwnership = true,
|
||||
DeviceAdapterList devices = DeviceAdapterList())
|
||||
{
|
||||
this->Superclass::Reset(derived, acquireOwnership, devices);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ImplicitFunctionType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST>
|
||||
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<ImplicitFunctionType>::type;
|
||||
return ImplicitFunctionHandle(
|
||||
new IFType(std::forward<ImplicitFunctionType>(func)), true, devices);
|
||||
}
|
||||
|
||||
template <typename ImplicitFunctionType, typename... Args>
|
||||
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>(args)...),
|
||||
true,
|
||||
VTKM_DEFAULT_DEVICE_ADAPTER_LIST());
|
||||
}
|
||||
|
||||
template <typename ImplicitFunctionType, typename DeviceAdapterList, typename... Args>
|
||||
VTKM_CONT ImplicitFunctionHandle make_ImplicitFunctionHandle(Args&&... args)
|
||||
{
|
||||
return ImplicitFunctionHandle(
|
||||
new ImplicitFunctionType(std::forward<Args>(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 <typename ImplicitFunctionType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST>
|
||||
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 <typename ImplicitFunctionType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST>
|
||||
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<ImplicitFunctionType>::type;
|
||||
return ImplicitFunctionValueHandle(
|
||||
new IFType(std::forward<ImplicitFunctionType>(func)), true, devices);
|
||||
}
|
||||
|
||||
template <typename ImplicitFunctionType, typename... Args>
|
||||
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>(args)...),
|
||||
true,
|
||||
VTKM_DEFAULT_DEVICE_ADAPTER_LIST());
|
||||
}
|
||||
|
||||
template <typename ImplicitFunctionType, typename DeviceAdapterList, typename... Args>
|
||||
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>(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/cont/internal/VirtualObjectTransferInstantiate.h>
|
||||
VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(
|
||||
vtkm::cont::detail::ImplicitFunctionBaseExecWrapper<vtkm::Box>);
|
||||
VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(
|
||||
vtkm::cont::detail::ImplicitFunctionBaseExecWrapper<vtkm::Cylinder>);
|
||||
VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(
|
||||
vtkm::cont::detail::ImplicitFunctionBaseExecWrapper<vtkm::Frustum>);
|
||||
VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(
|
||||
vtkm::cont::detail::ImplicitFunctionBaseExecWrapper<vtkm::Plane>);
|
||||
VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(
|
||||
vtkm::cont::detail::ImplicitFunctionBaseExecWrapper<vtkm::Sphere>);
|
||||
#endif
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
#endif // vtk_m_cont_ImplicitFunctionHandle_h
|
@ -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 <vtkm/cont/PointLocator.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
PointLocator::~PointLocator() = default;
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
}
|
||||
}
|
@ -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 <vtkm/Deprecated.h>
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/ExecutionObjectBase.h>
|
||||
#include <vtkm/cont/VirtualObjectHandle.h>
|
||||
#include <vtkm/exec/PointLocator.h>
|
||||
|
||||
#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
|
@ -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 <vtkm/cont/StorageVirtual.h>
|
||||
|
||||
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> 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<T>; \
|
||||
template class VTKM_CONT_EXPORT ArrayTransferVirtual<vtkm::Vec<T, 2>>; \
|
||||
template class VTKM_CONT_EXPORT ArrayTransferVirtual<vtkm::Vec<T, 3>>; \
|
||||
template class VTKM_CONT_EXPORT ArrayTransferVirtual<vtkm::Vec<T, 4>>
|
||||
|
||||
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<T, VTKM_DEFAULT_STORAGE_TAG>; \
|
||||
template class VTKM_CONT_EXPORT StorageVirtualImpl<vtkm::Vec<T, 2>, VTKM_DEFAULT_STORAGE_TAG>; \
|
||||
template class VTKM_CONT_EXPORT StorageVirtualImpl<vtkm::Vec<T, 3>, VTKM_DEFAULT_STORAGE_TAG>; \
|
||||
template class VTKM_CONT_EXPORT StorageVirtualImpl<vtkm::Vec<T, 4>, 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
|
@ -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 <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ErrorBadType.h>
|
||||
#include <vtkm/cont/Storage.h>
|
||||
#include <vtkm/cont/internal/ArrayHandleDeprecated.h>
|
||||
#include <vtkm/cont/internal/StorageDeprecated.h>
|
||||
#include <vtkm/cont/internal/TransferInfo.h>
|
||||
#include <vtkm/internal/ArrayPortalVirtual.h>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
#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 <typename DerivedStorage>
|
||||
bool IsType() const
|
||||
{ //needs optimizations based on platform. !OSX can use typeid
|
||||
return nullptr != dynamic_cast<const DerivedStorage*>(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<StorageVirtual> NewInstance() const;
|
||||
|
||||
template <typename DerivedStorage>
|
||||
const DerivedStorage* Cast() const
|
||||
{
|
||||
const DerivedStorage* derived = dynamic_cast<const DerivedStorage*>(this);
|
||||
if (!derived)
|
||||
{
|
||||
VTKM_LOG_CAST_FAIL(*this, DerivedStorage);
|
||||
throwFailedDynamicCast("StorageVirtual", vtkm::cont::TypeToString<DerivedStorage>());
|
||||
}
|
||||
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<StorageVirtual> 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<vtkm::cont::internal::TransferInfoArray> DeviceTransferState =
|
||||
std::make_shared<vtkm::cont::internal::TransferInfoArray>();
|
||||
};
|
||||
|
||||
template <typename T, typename S>
|
||||
class VTKM_ALWAYS_EXPORT StorageVirtualImpl final
|
||||
: public vtkm::cont::internal::detail::StorageVirtual
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
explicit StorageVirtualImpl(const vtkm::cont::ArrayHandle<T, S>& ah);
|
||||
|
||||
explicit StorageVirtualImpl(vtkm::cont::ArrayHandle<T, S>&& ah) noexcept;
|
||||
|
||||
VTKM_CONT
|
||||
~StorageVirtualImpl() override = default;
|
||||
|
||||
const vtkm::cont::ArrayHandle<T, S>& 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<vtkm::cont::internal::detail::StorageVirtual> MakeNewInstance() const override
|
||||
{
|
||||
return std::unique_ptr<vtkm::cont::internal::detail::StorageVirtual>(
|
||||
new StorageVirtualImpl<T, S>{ vtkm::cont::ArrayHandle<T, S>{} });
|
||||
}
|
||||
|
||||
|
||||
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<T, S> Handle;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename T>
|
||||
class VTKM_ALWAYS_EXPORT Storage<T, vtkm::cont::StorageTagVirtual>
|
||||
{
|
||||
public:
|
||||
using ValueType = T;
|
||||
|
||||
using PortalType = vtkm::ArrayPortalRef<T>;
|
||||
using PortalConstType = vtkm::ArrayPortalRef<T>;
|
||||
|
||||
Storage() = default;
|
||||
|
||||
// Should never really be used, but just in case.
|
||||
Storage(const Storage<T, vtkm::cont::StorageTagVirtual>&) = default;
|
||||
|
||||
template <typename S>
|
||||
Storage(const vtkm::cont::ArrayHandle<T, S>& srcArray)
|
||||
: VirtualStorage(std::make_shared<detail::StorageVirtualImpl<T, S>>(srcArray))
|
||||
{
|
||||
}
|
||||
|
||||
~Storage() = default;
|
||||
|
||||
PortalType GetPortal()
|
||||
{
|
||||
return make_ArrayPortalRef(
|
||||
reinterpret_cast<const vtkm::ArrayPortalVirtual<T>*>(this->VirtualStorage->WritePortal()),
|
||||
this->GetNumberOfValues());
|
||||
}
|
||||
|
||||
PortalConstType GetPortalConst() const
|
||||
{
|
||||
return make_ArrayPortalRef(
|
||||
reinterpret_cast<const vtkm::ArrayPortalVirtual<T>*>(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<T, vtkm::cont::StorageTagVirtual> NewInstance() const;
|
||||
|
||||
const detail::StorageVirtual* GetStorageVirtual() const { return this->VirtualStorage.get(); }
|
||||
detail::StorageVirtual* GetStorageVirtual() { return this->VirtualStorage.get(); }
|
||||
|
||||
private:
|
||||
std::shared_ptr<detail::StorageVirtual> VirtualStorage;
|
||||
|
||||
Storage(std::shared_ptr<detail::StorageVirtual> virtualStorage)
|
||||
: VirtualStorage(virtualStorage)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_STORAGE_OLD_STYLE;
|
||||
};
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
} // namespace internal
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
||||
#ifndef vtk_m_cont_StorageVirtual_hxx
|
||||
#include <vtkm/cont/StorageVirtual.hxx>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -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 <vtkm/cont/DeviceAdapter.h>
|
||||
#include <vtkm/cont/StorageVirtual.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
|
||||
#include <vtkm/cont/internal/ArrayTransfer.h>
|
||||
#include <vtkm/cont/internal/TransferInfo.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransferShareWithControl.h>
|
||||
|
||||
#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 <typename DerivedPortal>
|
||||
struct TransferToDevice
|
||||
{
|
||||
template <typename DeviceAdapterTag, typename Payload, typename... Args>
|
||||
inline bool operator()(DeviceAdapterTag devId, Payload&& payload, Args&&... args) const
|
||||
{
|
||||
using TransferType = cont::internal::VirtualObjectTransfer<DerivedPortal, DeviceAdapterTag>;
|
||||
using shared_memory_transfer =
|
||||
std::is_base_of<vtkm::cont::internal::VirtualObjectTransferShareWithControl<DerivedPortal>,
|
||||
TransferType>;
|
||||
|
||||
return this->Transfer(
|
||||
devId, shared_memory_transfer{}, std::forward<Payload>(payload), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename DeviceAdapterTag, typename Payload, typename... Args>
|
||||
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>(args)...);
|
||||
auto host = std::unique_ptr<DerivedPortal>(smp_ptr);
|
||||
payload.updateDevice(devId, std::move(host), smp_ptr, nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename DeviceAdapterTag, typename Payload, typename... Args>
|
||||
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<DerivedPortal, DeviceAdapterTag>;
|
||||
|
||||
auto host = std::unique_ptr<DerivedPortal>(new DerivedPortal(std::forward<Args>(args)...));
|
||||
auto transfer = std::make_shared<TransferType>(host.get());
|
||||
auto device = transfer->PrepareForExecution(true);
|
||||
|
||||
payload.updateDevice(devId, std::move(host), device, std::static_pointer_cast<void>(transfer));
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template <typename DerivedPortal, typename... Args>
|
||||
inline void make_transferToDevice(vtkm::cont::DeviceAdapterId devId, Args&&... args)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, detail::TransferToDevice<DerivedPortal>{}, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename DerivedPortal, typename Payload, typename... Args>
|
||||
inline void make_hostPortal(Payload&& payload, Args&&... args)
|
||||
{
|
||||
auto host = std::unique_ptr<DerivedPortal>(new DerivedPortal(std::forward<Args>(args)...));
|
||||
payload.updateHost(std::move(host));
|
||||
}
|
||||
|
||||
namespace internal
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
VTKM_CONT
|
||||
template <typename T, typename S>
|
||||
StorageVirtualImpl<T, S>::StorageVirtualImpl(const vtkm::cont::ArrayHandle<T, S>& ah)
|
||||
: vtkm::cont::internal::detail::StorageVirtual()
|
||||
, Handle(ah)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
template <typename T, typename S>
|
||||
StorageVirtualImpl<T, S>::StorageVirtualImpl(vtkm::cont::ArrayHandle<T, S>&& ah) noexcept
|
||||
: vtkm::cont::internal::detail::StorageVirtual()
|
||||
, Handle(std::move(ah))
|
||||
{
|
||||
}
|
||||
|
||||
/// release execution side resources
|
||||
template <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::ReleaseResourcesExecution()
|
||||
{
|
||||
this->DropExecutionPortal();
|
||||
this->Handle.ReleaseResourcesExecution();
|
||||
}
|
||||
|
||||
/// release control side resources
|
||||
template <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::ReleaseResources()
|
||||
{
|
||||
this->DropAllPortals();
|
||||
this->Handle.ReleaseResources();
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::Allocate(vtkm::Id numberOfValues)
|
||||
{
|
||||
this->DropAllPortals();
|
||||
this->Handle.Allocate(numberOfValues);
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::Shrink(vtkm::Id numberOfValues)
|
||||
{
|
||||
this->DropAllPortals();
|
||||
this->Handle.Allocate(numberOfValues, vtkm::CopyFlag::On);
|
||||
}
|
||||
|
||||
struct PortalWrapperToDevice
|
||||
{
|
||||
template <typename DeviceAdapterTag, typename Handle>
|
||||
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<decltype(portal)>;
|
||||
vtkm::cont::detail::TransferToDevice<DerivedPortal> transfer;
|
||||
return transfer(device, payload, portal);
|
||||
}
|
||||
template <typename DeviceAdapterTag, typename Handle>
|
||||
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<decltype(portal)>;
|
||||
vtkm::cont::detail::TransferToDevice<DerivedPortal> transfer;
|
||||
return transfer(device, payload, portal);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::cont::Token token;
|
||||
auto portal = handle.PrepareForInPlace(device, token);
|
||||
using DerivedPortal = vtkm::ArrayPortalWrapper<decltype(portal)>;
|
||||
vtkm::cont::detail::TransferToDevice<DerivedPortal> transfer;
|
||||
return transfer(device, payload, portal);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::ControlPortalForInput(
|
||||
vtkm::cont::internal::TransferInfoArray& payload) const
|
||||
{
|
||||
auto portal = this->Handle.ReadPortal();
|
||||
using DerivedPortal = vtkm::ArrayPortalWrapper<decltype(portal)>;
|
||||
vtkm::cont::make_hostPortal<DerivedPortal>(payload, portal);
|
||||
}
|
||||
|
||||
template <typename HandleType>
|
||||
inline void make_writableHostPortal(std::true_type,
|
||||
vtkm::cont::internal::TransferInfoArray& payload,
|
||||
HandleType& handle)
|
||||
{
|
||||
auto portal = handle.WritePortal();
|
||||
using DerivedPortal = vtkm::ArrayPortalWrapper<decltype(portal)>;
|
||||
vtkm::cont::make_hostPortal<DerivedPortal>(payload, portal);
|
||||
}
|
||||
template <typename HandleType>
|
||||
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 <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::ControlPortalForOutput(
|
||||
vtkm::cont::internal::TransferInfoArray& payload)
|
||||
{
|
||||
using HT = vtkm::cont::ArrayHandle<T, S>;
|
||||
constexpr auto isWritable = typename vtkm::cont::internal::IsWritableArrayHandle<HT>::type{};
|
||||
|
||||
detail::make_writableHostPortal(isWritable, payload, this->Handle);
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::TransferPortalForInput(
|
||||
vtkm::cont::internal::TransferInfoArray& payload,
|
||||
vtkm::cont::DeviceAdapterId devId) const
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::PortalWrapperToDevice(), this->Handle, payload);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::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 <typename T>
|
||||
void Storage<T, vtkm::cont::StorageTagVirtual>::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 <typename T>
|
||||
void Storage<T, vtkm::cont::StorageTagVirtual>::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 <typename T>
|
||||
void Storage<T, vtkm::cont::StorageTagVirtual>::ReleaseResources()
|
||||
{
|
||||
if (this->VirtualStorage)
|
||||
{
|
||||
this->VirtualStorage->ReleaseResources();
|
||||
}
|
||||
else
|
||||
{
|
||||
// No concrete array, nothing allocated, nothing to do.
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Storage<T, vtkm::cont::StorageTagVirtual> Storage<T, vtkm::cont::StorageTagVirtual>::NewInstance()
|
||||
const
|
||||
{
|
||||
if (this->GetStorageVirtual())
|
||||
{
|
||||
return Storage<T, vtkm::cont::StorageTagVirtual>(this->GetStorageVirtual()->NewInstance());
|
||||
}
|
||||
else
|
||||
{
|
||||
return Storage<T, vtkm::cont::StorageTagVirtual>();
|
||||
}
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
class VTKM_ALWAYS_EXPORT ArrayTransferVirtual
|
||||
{
|
||||
using StorageType = vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagVirtual>;
|
||||
vtkm::cont::internal::detail::StorageVirtual* Storage;
|
||||
|
||||
public:
|
||||
using ValueType = T;
|
||||
|
||||
using PortalControl = typename StorageType::PortalType;
|
||||
using PortalConstControl = typename StorageType::PortalConstType;
|
||||
|
||||
using PortalExecution = vtkm::ArrayPortalRef<ValueType>;
|
||||
using PortalConstExecution = vtkm::ArrayPortalRef<ValueType>;
|
||||
|
||||
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<const vtkm::ArrayPortalVirtual<ValueType>*>(
|
||||
this->Storage->PrepareForInput(device)),
|
||||
this->GetNumberOfValues());
|
||||
}
|
||||
|
||||
VTKM_CONT PortalExecution PrepareForOutput(vtkm::Id numberOfValues,
|
||||
vtkm::cont::DeviceAdapterId device)
|
||||
{
|
||||
return make_ArrayPortalRef(static_cast<const vtkm::ArrayPortalVirtual<T>*>(
|
||||
this->Storage->PrepareForOutput(numberOfValues, device)),
|
||||
numberOfValues);
|
||||
}
|
||||
|
||||
VTKM_CONT PortalExecution PrepareForInPlace(vtkm::cont::DeviceAdapterId device)
|
||||
{
|
||||
return vtkm::make_ArrayPortalRef(static_cast<const vtkm::ArrayPortalVirtual<ValueType>*>(
|
||||
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<T>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayTransferVirtual<vtkm::Vec<T, 2>>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayTransferVirtual<vtkm::Vec<T, 3>>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayTransferVirtual<vtkm::Vec<T, 4>>
|
||||
|
||||
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<T, VTKM_DEFAULT_STORAGE_TAG>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT \
|
||||
StorageVirtualImpl<vtkm::Vec<T, 2>, VTKM_DEFAULT_STORAGE_TAG>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT \
|
||||
StorageVirtualImpl<vtkm::Vec<T, 3>, VTKM_DEFAULT_STORAGE_TAG>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT \
|
||||
StorageVirtualImpl<vtkm::Vec<T, 4>, 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 <typename T, typename Device>
|
||||
struct ArrayTransfer<T, vtkm::cont::StorageTagVirtual, Device> : detail::ArrayTransferVirtual<T>
|
||||
{
|
||||
using Superclass = detail::ArrayTransferVirtual<T>;
|
||||
|
||||
VTKM_CONT ArrayTransfer(vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagVirtual>* 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
|
@ -27,10 +27,6 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ArrayHandleVirtual.h>
|
||||
#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 <typename SrcValueType, typename Storage, typename DstValueType>
|
||||
VTKM_CONT typename std::enable_if<std::is_same<SrcValueType, DstValueType>::value>::type
|
||||
operator()(const vtkm::cont::ArrayHandle<SrcValueType, Storage>& input,
|
||||
vtkm::cont::ArrayHandleVirtual<DstValueType>& output) const
|
||||
{ // ValueTypes match
|
||||
output = vtkm::cont::make_ArrayHandleVirtual<DstValueType>(input);
|
||||
}
|
||||
|
||||
template <typename SrcValueType, typename Storage, typename DstValueType>
|
||||
VTKM_CONT typename std::enable_if<!std::is_same<SrcValueType, DstValueType>::value>::type
|
||||
operator()(const vtkm::cont::ArrayHandle<SrcValueType, Storage>& input,
|
||||
vtkm::cont::ArrayHandleVirtual<DstValueType>& output) const
|
||||
{ // ValueTypes do not match
|
||||
this->ValidateWidthAndCast<SrcValueType, DstValueType>(input, output);
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename S,
|
||||
typename D,
|
||||
typename InputType,
|
||||
vtkm::IdComponent SSize = vtkm::VecTraits<S>::NUM_COMPONENTS,
|
||||
vtkm::IdComponent DSize = vtkm::VecTraits<D>::NUM_COMPONENTS>
|
||||
VTKM_CONT typename std::enable_if<SSize == DSize>::type ValidateWidthAndCast(
|
||||
const InputType& input,
|
||||
vtkm::cont::ArrayHandleVirtual<D>& output) const
|
||||
{ // number of components match
|
||||
auto casted = vtkm::cont::make_ArrayHandleCast<D>(input);
|
||||
output = vtkm::cont::make_ArrayHandleVirtual<D>(casted);
|
||||
}
|
||||
|
||||
template <typename S,
|
||||
typename D,
|
||||
vtkm::IdComponent SSize = vtkm::VecTraits<S>::NUM_COMPONENTS,
|
||||
vtkm::IdComponent DSize = vtkm::VecTraits<D>::NUM_COMPONENTS>
|
||||
VTKM_CONT typename std::enable_if<SSize != DSize>::type ValidateWidthAndCast(
|
||||
const ArrayHandleBase&,
|
||||
ArrayHandleBase&) const
|
||||
{ // number of components do not match
|
||||
std::ostringstream str;
|
||||
str << "VariantArrayHandle::AsVirtual: Cannot cast from " << vtkm::cont::TypeToString<S>()
|
||||
<< " to " << vtkm::cont::TypeToString<D>()
|
||||
<< "; "
|
||||
"number of components must match exactly.";
|
||||
throw vtkm::cont::ErrorBadType(str.str());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
struct NoCastStorageTransformImpl
|
||||
{
|
||||
using type = S;
|
||||
};
|
||||
template <typename T, typename S>
|
||||
struct NoCastStorageTransformImpl<vtkm::cont::StorageTagCast<T, S>>
|
||||
{
|
||||
using type = S;
|
||||
};
|
||||
template <typename S>
|
||||
using NoCastStorageTransform = typename NoCastStorageTransformImpl<S>::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>(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 <typename T,
|
||||
typename StorageList = VTKM_DEFAULT_STORAGE_LIST,
|
||||
typename TypeList = vtkm::List<T>>
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "ArrayHandleVirtual is no longer supported.")
|
||||
vtkm::cont::ArrayHandleVirtual<T> 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<StorageList, vtkm::cont::internal::variant::NoCastStorageTransform>;
|
||||
vtkm::cont::internal::variant::ForceCastToVirtual caster;
|
||||
vtkm::cont::ArrayHandleVirtual<T> output;
|
||||
this->CastAndCall<TypeList, CleanStorageList>(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 <typename T, typename StorageList = VTKM_DEFAULT_STORAGE_LIST>
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "ArrayHandleVirtual is no longer suported.")
|
||||
vtkm::cont::ArrayHandleVirtual<T> AsVirtual() const
|
||||
{
|
||||
return this->Superclass::AsVirtual<T, StorageList, TypeList>();
|
||||
}
|
||||
#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
|
||||
|
@ -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 <vtkm/cont/DeviceAdapterList.h>
|
||||
#include <vtkm/cont/ExecutionAndControlObjectBase.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterListHelpers.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
|
||||
#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 <array>
|
||||
#include <type_traits>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
namespace internal
|
||||
{
|
||||
struct CreateTransferInterface
|
||||
{
|
||||
template <typename VirtualDerivedType, typename DeviceAdapter>
|
||||
VTKM_CONT inline void operator()(DeviceAdapter device,
|
||||
internal::TransferState* transfers,
|
||||
const VirtualDerivedType* virtualObject) const
|
||||
{
|
||||
using TransferImpl = TransferInterfaceImpl<VirtualDerivedType, DeviceAdapter>;
|
||||
auto i = static_cast<std::size_t>(device.GetValue());
|
||||
transfers->DeviceTransferState[i].reset(new TransferImpl(virtualObject));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// \brief Implements VTK-m's execution side <em> Virtual Methods </em> 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 <typename VirtualBaseType>
|
||||
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<vtkm::VirtualObjectBase, VirtualBaseType>::value),
|
||||
"All virtual objects must be subclass of vtkm::VirtualObjectBase.");
|
||||
|
||||
public:
|
||||
VTKM_CONT VirtualObjectHandle()
|
||||
: Internals(std::make_shared<internal::TransferState>())
|
||||
{
|
||||
}
|
||||
|
||||
template <typename VirtualDerivedType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST>
|
||||
VTKM_CONT explicit VirtualObjectHandle(VirtualDerivedType* derived,
|
||||
bool acquireOwnership = true,
|
||||
DeviceAdapterList devices = DeviceAdapterList())
|
||||
: Internals(std::make_shared<internal::TransferState>())
|
||||
{
|
||||
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<VirtualBaseType*>(this->Internals->HostPtr());
|
||||
}
|
||||
|
||||
/// Reset the underlying derived type object
|
||||
template <typename VirtualDerivedType,
|
||||
typename DeviceAdapterList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST>
|
||||
VTKM_CONT void Reset(VirtualDerivedType* derived,
|
||||
bool acquireOwnership = true,
|
||||
DeviceAdapterList devices = DeviceAdapterList())
|
||||
{
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
VTKM_STATIC_ASSERT_MSG((std::is_base_of<VirtualBaseType, VirtualDerivedType>::value),
|
||||
"Tried to bind a type that is not a subclass of the base class.");
|
||||
|
||||
if (acquireOwnership)
|
||||
{
|
||||
auto deleter = [](void* p) { delete static_cast<VirtualBaseType*>(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<const VirtualBaseType*>(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<internal::TransferState> Internals;
|
||||
};
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
|
||||
#endif // vtk_m_cont_VirtualObjectHandle_h
|
@ -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 <vtkm/cont/VirtualObjectHandle.h>
|
||||
|
||||
#include <vtkm/cont/DeviceAdapterList.h>
|
||||
#include <vtkm/cont/DeviceAdapterTag.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterListHelpers.h>
|
||||
|
||||
#include <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransfer.hxx>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
template <typename VirtualBaseType>
|
||||
VirtualObjectHandle<VirtualBaseType>::VirtualObjectHandle()
|
||||
: Internals(std::make_shared<internal::TransferState>())
|
||||
{
|
||||
}
|
||||
|
||||
template <typename VirtualBaseType>
|
||||
template <typename VirtualDerivedType, typename DeviceAdapterList>
|
||||
VirtualObjectHandle<VirtualBaseType>::VirtualObjectHandle(VirtualDerivedType* derived,
|
||||
bool acquireOwnership,
|
||||
DeviceAdapterList devices)
|
||||
: Internals(std::make_shared<internal::TransferState>())
|
||||
{
|
||||
this->Reset(derived, acquireOwnership, devices);
|
||||
}
|
||||
|
||||
template <typename VirtualBaseType>
|
||||
bool VirtualObjectHandle<VirtualBaseType>::GetValid() const
|
||||
{
|
||||
return this->Internals->HostPtr() != nullptr;
|
||||
}
|
||||
|
||||
template <typename VirtualBaseType>
|
||||
bool VirtualObjectHandle<VirtualBaseType>::OwnsObject() const
|
||||
{
|
||||
return this->Internals->WillReleaseHostPointer();
|
||||
}
|
||||
|
||||
template <typename VirtualBaseType>
|
||||
VirtualBaseType* VirtualObjectHandle<VirtualBaseType>::Get()
|
||||
{
|
||||
return static_cast<VirtualBaseType*>(this->Internals->HostPtr());
|
||||
}
|
||||
|
||||
/// Reset the underlying derived type object
|
||||
template <typename VirtualBaseType>
|
||||
template <typename VirtualDerivedType, typename DeviceAdapterList>
|
||||
void VirtualObjectHandle<VirtualBaseType>::Reset(VirtualDerivedType* derived,
|
||||
bool acquireOwnership,
|
||||
DeviceAdapterList devices)
|
||||
{
|
||||
VTKM_STATIC_ASSERT_MSG((std::is_base_of<VirtualBaseType, VirtualDerivedType>::value),
|
||||
"Tried to bind a type that is not a subclass of the base class.");
|
||||
|
||||
if (acquireOwnership)
|
||||
{
|
||||
// auto deleter = [](void* p) { delete static_cast<VirtualBaseType*>(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 <typename VirtualBaseType>
|
||||
const VirtualBaseType* VirtualObjectHandle<VirtualBaseType>::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<const VirtualBaseType*>(this->Internals->PrepareForExecution(deviceId));
|
||||
}
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
#endif // vtk_m_cont_VirtualObjectHandle_h
|
@ -14,12 +14,6 @@
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ArrayHandleVirtual.h>
|
||||
#include <vtkm/cont/StorageVirtual.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <vtkm/cont/arg/Transport.h>
|
||||
|
||||
#include <vtkm/cont/AtomicArray.h>
|
||||
@ -67,45 +61,6 @@ struct Transport<vtkm::cont::arg::TransportTagAtomicArray,
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename T, typename Device>
|
||||
struct Transport<vtkm::cont::arg::TransportTagAtomicArray,
|
||||
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>,
|
||||
Device>
|
||||
{
|
||||
using ExecObjectType = vtkm::exec::AtomicArrayExecutionObject<T>;
|
||||
using ExecType = vtkm::cont::AtomicArray<T>;
|
||||
|
||||
template <typename InputDomainType>
|
||||
VTKM_CONT ExecObjectType
|
||||
operator()(vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>& array,
|
||||
const InputDomainType&,
|
||||
vtkm::Id,
|
||||
vtkm::Id) const
|
||||
{
|
||||
using ArrayHandleType = vtkm::cont::ArrayHandle<T>;
|
||||
const bool is_type = vtkm::cont::IsType<ArrayHandleType>(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<ArrayHandleType>(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
|
||||
|
@ -17,10 +17,6 @@
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/AtomicArray.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/StorageVirtual.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
@ -46,15 +42,6 @@ struct TypeCheck<TypeCheckTagAtomicArray, vtkm::cont::ArrayHandle<T, vtkm::cont:
|
||||
static constexpr bool value = vtkm::ListHas<vtkm::cont::AtomicArrayTypeList, T>::value;
|
||||
};
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename T>
|
||||
struct TypeCheck<TypeCheckTagAtomicArray, vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>>
|
||||
{
|
||||
static constexpr bool value = vtkm::ListHas<vtkm::cont::AtomicArrayTypeList, T>::value;
|
||||
};
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont::arg
|
||||
|
@ -23,9 +23,6 @@
|
||||
#include <vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h>
|
||||
#include <vtkm/cont/cuda/internal/DeviceAdapterMemoryManagerCuda.h>
|
||||
#include <vtkm/cont/cuda/internal/RuntimeDeviceConfigurationCuda.h>
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/cuda/internal/VirtualObjectTransferCuda.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
#else // !VTKM_CUDA
|
||||
|
||||
|
@ -21,12 +21,6 @@ set(headers
|
||||
ThrustExceptionHandler.h
|
||||
)
|
||||
|
||||
if (NOT VTKm_NO_DEPRECATED_VIRTUAL)
|
||||
set(headers ${headers}
|
||||
VirtualObjectTransferCuda.h
|
||||
)
|
||||
endif()
|
||||
|
||||
vtkm_declare_headers(${headers})
|
||||
|
||||
|
||||
|
@ -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 <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/cuda/ErrorCuda.h>
|
||||
#include <vtkm/cont/cuda/internal/CudaAllocator.h>
|
||||
#include <vtkm/cont/cuda/internal/DeviceAdapterTagCuda.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
|
||||
#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 <typename VirtualDerivedType>
|
||||
__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 <typename VirtualDerivedType>
|
||||
__global__ void UpdateVirtualObjectKernel(VirtualDerivedType* deviceObject,
|
||||
const VirtualDerivedType* targetObject)
|
||||
{
|
||||
*deviceObject = *targetObject;
|
||||
}
|
||||
|
||||
template <typename VirtualDerivedType>
|
||||
__global__ void DeleteVirtualObjectKernel(VirtualDerivedType* deviceObject)
|
||||
{
|
||||
deviceObject->~VirtualDerivedType();
|
||||
}
|
||||
|
||||
#if (defined(VTKM_GCC) || defined(VTKM_CLANG))
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
} // detail
|
||||
|
||||
template <typename VirtualDerivedType>
|
||||
struct VirtualObjectTransfer<VirtualDerivedType, vtkm::cont::DeviceAdapterTagCuda>
|
||||
{
|
||||
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
|
@ -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.
|
||||
|
@ -17,13 +17,6 @@
|
||||
#include <vtkm/cont/ExecutionObjectBase.h>
|
||||
#include <vtkm/cont/UnknownCellSet.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
// To support deprecated implementation
|
||||
#include <vtkm/cont/CellLocator.h>
|
||||
#include <vtkm/cont/VirtualObjectHandle.h>
|
||||
#include <vtkm/exec/CellLocator.h>
|
||||
#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 <typename LocatorType>
|
||||
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 <typename LocatorType>
|
||||
struct CellLocatorBaseWrapperPrepareForExecutionFunctor
|
||||
{
|
||||
template <typename Device>
|
||||
VTKM_CONT bool operator()(Device device,
|
||||
vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator>& execHandle,
|
||||
const LocatorType& locator,
|
||||
vtkm::cont::Token& token)
|
||||
{
|
||||
auto execObject = locator.PrepareForExecution(device, token);
|
||||
using WrapType = CellLocatorBaseExecWrapper<decltype(execObject)>;
|
||||
execHandle.Reset(new WrapType(execObject));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Derived>
|
||||
class VTKM_ALWAYS_EXPORT CellLocatorBaseWrapper : public vtkm::cont::CellLocator
|
||||
{
|
||||
Derived Locator;
|
||||
mutable vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator> 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<Derived>{},
|
||||
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<Derived>() const
|
||||
{
|
||||
return detail::CellLocatorBaseWrapper<Derived>(reinterpret_cast<const Derived&>(*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)
|
||||
|
@ -16,12 +16,6 @@
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/ExecutionObjectBase.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/PointLocator.h>
|
||||
#include <vtkm/cont/VirtualObjectHandle.h>
|
||||
#include <vtkm/exec/PointLocator.h>
|
||||
#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 <typename LocatorType>
|
||||
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 <typename LocatorType>
|
||||
struct PointLocatorBaseWrapperPrepareForExecutionFunctor
|
||||
{
|
||||
template <typename Device>
|
||||
VTKM_CONT bool operator()(Device device,
|
||||
vtkm::cont::VirtualObjectHandle<vtkm::exec::PointLocator>& execHandle,
|
||||
const LocatorType& locator,
|
||||
vtkm::cont::Token& token)
|
||||
{
|
||||
auto execObject = locator.PrepareForExecution(device, token);
|
||||
using WrapType = PointLocatorBaseExecWrapper<decltype(execObject)>;
|
||||
execHandle.Reset(new WrapType(execObject));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Derived>
|
||||
class VTKM_ALWAYS_EXPORT PointLocatorBaseWrapper : public vtkm::cont::PointLocator
|
||||
{
|
||||
Derived Locator;
|
||||
mutable vtkm::cont::VirtualObjectHandle<vtkm::exec::PointLocator> 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<Derived>{},
|
||||
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 <typename Derived>
|
||||
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<Derived>() const
|
||||
{
|
||||
return detail::PointLocatorBaseWrapper<Derived>(reinterpret_cast<const Derived&>(*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)
|
||||
{
|
||||
|
@ -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 <vtkm/cont/internal/TransferInfo.h>
|
||||
|
||||
#include <vtkm/internal/ArrayPortalVirtual.h>
|
||||
|
||||
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<vtkm::internal::PortalVirtualBase>&& host) noexcept
|
||||
{
|
||||
this->Host = std::move(host);
|
||||
}
|
||||
|
||||
void TransferInfoArray::updateDevice(vtkm::cont::DeviceAdapterId devId,
|
||||
std::unique_ptr<vtkm::internal::PortalVirtualBase>&& hostCopy,
|
||||
const vtkm::internal::PortalVirtualBase* device,
|
||||
const std::shared_ptr<void>& 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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 <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/internal/Configure.h>
|
||||
#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 <vtkm/Types.h>
|
||||
#include <vtkm/cont/DeviceAdapterTag.h>
|
||||
#include <vtkm/internal/ArrayPortalVirtual.h>
|
||||
|
||||
// This is a deprecated class. Don't warn about deprecation while implementing
|
||||
// deprecated functionality.
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
#include <memory>
|
||||
|
||||
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<vtkm::internal::PortalVirtualBase>&& host) noexcept;
|
||||
void updateDevice(
|
||||
vtkm::cont::DeviceAdapterId id,
|
||||
std::unique_ptr<vtkm::internal::PortalVirtualBase>&& host_copy, //NOT the same as host version
|
||||
const vtkm::internal::PortalVirtualBase* device,
|
||||
const std::shared_ptr<void>& 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<void>& state() noexcept { return this->DeviceTransferState; }
|
||||
|
||||
private:
|
||||
vtkm::cont::DeviceAdapterId DeviceId = vtkm::cont::DeviceAdapterTagUndefined{};
|
||||
std::unique_ptr<vtkm::internal::PortalVirtualBase> Host = nullptr;
|
||||
std::unique_ptr<vtkm::internal::PortalVirtualBase> HostCopyOfDevice = nullptr;
|
||||
const vtkm::internal::PortalVirtualBase* Device = nullptr;
|
||||
std::shared_ptr<void> DeviceTransferState = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
#endif
|
@ -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 <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
|
||||
#include <vtkm/cont/ErrorBadType.h>
|
||||
#include <vtkm/cont/ErrorBadValue.h>
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
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<std::size_t>(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
|
@ -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 <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/VirtualObjectBase.h>
|
||||
#include <vtkm/cont/DeviceAdapterTag.h>
|
||||
|
||||
#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 <array>
|
||||
#include <memory>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
struct CreateTransferInterface; //forward declare for friendship
|
||||
|
||||
template <typename VirtualDerivedType, typename DeviceAdapter>
|
||||
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 <typename VirtualDerivedType, typename DeviceAdapter>
|
||||
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<VirtualDerivedType, DeviceAdapter> 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<std::size_t>(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<std::unique_ptr<TransferInterface>, 8> DeviceTransferState;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // vtkm::cont::internal
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
#endif // vtkm_cont_internal_VirtualObjectTransfer_h
|
@ -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 <vtkm/internal/Configure.h>
|
||||
|
||||
#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<DerivedType, DeviceDapterTagType>
|
||||
|
||||
#if defined(VTKM_ENABLE_CUDA)
|
||||
#include <vtkm/cont/cuda/internal/VirtualObjectTransferCuda.h>
|
||||
#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 <vtkm/cont/kokkos/internal/VirtualObjectTransferKokkos.h>
|
||||
#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
|
@ -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 <vtkm/StaticAssert.h>
|
||||
#include <vtkm/VirtualObjectBase.h>
|
||||
|
||||
#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 <typename VirtualDerivedType>
|
||||
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
|
@ -20,9 +20,6 @@
|
||||
#include <vtkm/cont/kokkos/internal/DeviceAdapterMemoryManagerKokkos.h>
|
||||
#include <vtkm/cont/kokkos/internal/DeviceAdapterRuntimeDetectorKokkos.h>
|
||||
#include <vtkm/cont/kokkos/internal/RuntimeDeviceConfigurationKokkos.h>
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/kokkos/internal/VirtualObjectTransferKokkos.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
#else // !defined(VTKM_KOKKOS_CUDA) || defined(VTKM_CUDA)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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 <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
|
||||
#include <vtkm/cont/kokkos/internal/DeviceAdapterTagKokkos.h>
|
||||
#include <vtkm/cont/kokkos/internal/KokkosAlloc.h>
|
||||
#include <vtkm/cont/kokkos/internal/KokkosTypes.h>
|
||||
|
||||
#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 <typename VirtualDerivedType>
|
||||
struct VirtualObjectTransfer<VirtualDerivedType, vtkm::cont::DeviceAdapterTagKokkos>
|
||||
{
|
||||
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<vtkm::UInt8> hbuffer(
|
||||
reinterpret_cast<const vtkm::UInt8*>(this->ControlObject), sizeof(VirtualDerivedType));
|
||||
|
||||
auto deviceTarget = static_cast<VirtualDerivedType*>(
|
||||
vtkm::cont::kokkos::internal::Allocate(sizeof(VirtualDerivedType)));
|
||||
vtkm::cont::kokkos::internal::KokkosViewExec<vtkm::UInt8> dbuffer(
|
||||
reinterpret_cast<vtkm::UInt8*>(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<VirtualDerivedType*>(
|
||||
vtkm::cont::kokkos::internal::Allocate(sizeof(VirtualDerivedType)));
|
||||
// Initialize the device object
|
||||
Kokkos::RangePolicy<vtkm::cont::kokkos::internal::ExecutionSpace> 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<vtkm::cont::kokkos::internal::ExecutionSpace> 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<vtkm::cont::kokkos::internal::ExecutionSpace> 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
|
@ -18,9 +18,6 @@
|
||||
#include <vtkm/cont/openmp/internal/DeviceAdapterAlgorithmOpenMP.h>
|
||||
#include <vtkm/cont/openmp/internal/DeviceAdapterMemoryManagerOpenMP.h>
|
||||
#include <vtkm/cont/openmp/internal/RuntimeDeviceConfigurationOpenMP.h>
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/openmp/internal/VirtualObjectTransferOpenMP.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#endif
|
||||
|
||||
#endif //vtk_m_cont_openmp_DeviceAdapterOpenMP_h
|
||||
|
@ -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
|
||||
|
@ -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 <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransferShareWithControl.h>
|
||||
#include <vtkm/cont/openmp/internal/DeviceAdapterTagOpenMP.h>
|
||||
|
||||
#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 <typename VirtualDerivedType>
|
||||
struct VirtualObjectTransfer<VirtualDerivedType, vtkm::cont::DeviceAdapterTagOpenMP> final
|
||||
: VirtualObjectTransferShareWithControl<VirtualDerivedType>
|
||||
{
|
||||
using VirtualObjectTransferShareWithControl<
|
||||
VirtualDerivedType>::VirtualObjectTransferShareWithControl;
|
||||
};
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
}
|
||||
}
|
||||
} // vtkm::cont::internal
|
||||
|
||||
|
||||
|
||||
#endif // vtk_m_cont_openmp_internal_VirtualObjectTransferOpenMP_h
|
@ -17,9 +17,6 @@
|
||||
#include <vtkm/cont/serial/internal/RuntimeDeviceConfigurationSerial.h>
|
||||
#include <vtkm/cont/serial/internal/DeviceAdapterMemoryManagerSerial.h>
|
||||
#include <vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h>
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/serial/internal/VirtualObjectTransferSerial.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
// clang-format on
|
||||
|
||||
#endif //vtk_m_cont_serial_DeviceAdapterSerial_h
|
||||
|
@ -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
|
||||
|
@ -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 <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransferShareWithControl.h>
|
||||
#include <vtkm/cont/serial/internal/DeviceAdapterTagSerial.h>
|
||||
|
||||
#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 <typename VirtualDerivedType>
|
||||
struct VirtualObjectTransfer<VirtualDerivedType, vtkm::cont::DeviceAdapterTagSerial> final
|
||||
: VirtualObjectTransferShareWithControl<VirtualDerivedType>
|
||||
{
|
||||
using VirtualObjectTransferShareWithControl<
|
||||
VirtualDerivedType>::VirtualObjectTransferShareWithControl;
|
||||
};
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
}
|
||||
}
|
||||
} // vtkm::cont::internal
|
||||
|
||||
#endif // vtk_m_cont_serial_internal_VirtualObjectTransferSerial_h
|
@ -17,9 +17,6 @@
|
||||
#include <vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.h>
|
||||
#include <vtkm/cont/tbb/internal/DeviceAdapterMemoryManagerTBB.h>
|
||||
#include <vtkm/cont/tbb/internal/RuntimeDeviceConfigurationTBB.h>
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/tbb/internal/VirtualObjectTransferTBB.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#endif
|
||||
|
||||
#endif //vtk_m_cont_tbb_DeviceAdapterTBB_h
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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 <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
#include <vtkm/cont/internal/VirtualObjectTransferShareWithControl.h>
|
||||
#include <vtkm/cont/tbb/internal/DeviceAdapterTagTBB.h>
|
||||
|
||||
#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 <typename VirtualDerivedType>
|
||||
struct VirtualObjectTransfer<VirtualDerivedType, vtkm::cont::DeviceAdapterTagTBB> final
|
||||
: VirtualObjectTransferShareWithControl<VirtualDerivedType>
|
||||
{
|
||||
using VirtualObjectTransferShareWithControl<
|
||||
VirtualDerivedType>::VirtualObjectTransferShareWithControl;
|
||||
};
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
}
|
||||
}
|
||||
} // vtkm::cont::internal
|
||||
|
||||
#endif // vtk_m_cont_tbb_internal_VirtualObjectTransferTBB_h
|
@ -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
|
||||
|
@ -31,10 +31,6 @@
|
||||
|
||||
#include <vtkm/cont/internal/ArrayPortalFromIterators.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/internal/VirtualObjectTransfer.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <vtkm/cont/AtomicArray.h>
|
||||
@ -340,45 +336,6 @@ public:
|
||||
vtkm::exec::AtomicArrayExecutionObject<T> 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<vtkm::Id, vtkm::Float32>;
|
||||
@ -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<TargetType, DeviceAdapterTag>;
|
||||
|
||||
IdArrayHandle result;
|
||||
result.Allocate(1);
|
||||
result.WritePortal().Set(0, 0);
|
||||
|
||||
TargetType target;
|
||||
target.Value = 5;
|
||||
|
||||
Transfer transfer(&target);
|
||||
const BaseType* base = static_cast<const BaseType*>(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<const BaseType*>(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();
|
||||
|
||||
|
@ -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 <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ArrayHandleVirtual.h>
|
||||
#include <vtkm/cont/ArrayHandleVirtual.hxx>
|
||||
#endif
|
||||
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
|
||||
#include <vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h>
|
||||
#include <vtkm/cont/serial/internal/DeviceAdapterTagSerial.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <vtkm/BinaryOperators.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
namespace UnitTestArrayHandleVirtualDetail
|
||||
{
|
||||
|
||||
template <typename ValueType>
|
||||
struct Test
|
||||
{
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 100;
|
||||
static constexpr vtkm::Id NUM_KEYS = 3;
|
||||
|
||||
using ArrayHandle = vtkm::cont::ArrayHandle<ValueType>;
|
||||
using VirtHandle = vtkm::cont::ArrayHandleVirtual<ValueType>;
|
||||
using DeviceTag = vtkm::cont::DeviceAdapterTagSerial;
|
||||
using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<DeviceTag>;
|
||||
|
||||
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<ArrayHandle>(fromArrayHandle),
|
||||
"ArrayHandleVirtual should contain a ArrayHandle<ValueType>.");
|
||||
|
||||
VirtHandle fromVirtHandle(fromArrayHandle);
|
||||
VTKM_TEST_ASSERT(fromVirtHandle.GetStorage().GetStorageVirtual() != nullptr,
|
||||
"storage should be empty when using ArrayHandleVirtual().");
|
||||
VTKM_TEST_ASSERT(vtkm::cont::IsType<ArrayHandle>(fromVirtHandle),
|
||||
"ArrayHandleVirtual should contain a ArrayHandle<ValueType>.");
|
||||
|
||||
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<ArrayHandle>(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<ArrayHandle>(virt),
|
||||
"ArrayHandleVirtual should be valid after move constructor ArrayHandle<ValueType>.");
|
||||
}
|
||||
|
||||
//test ArrayHandleVirtual move constructor
|
||||
{
|
||||
ArrayHandle handle;
|
||||
VirtHandle virt(std::move(handle));
|
||||
VirtHandle virt2(std::move(virt));
|
||||
VTKM_TEST_ASSERT(
|
||||
vtkm::cont::IsType<ArrayHandle>(virt2),
|
||||
"ArrayHandleVirtual should be valid after move constructor ArrayHandleVirtual<ValueType>.");
|
||||
}
|
||||
}
|
||||
|
||||
void TestAssignmentOps()
|
||||
{
|
||||
std::cout << "Assignment operators" << std::endl;
|
||||
|
||||
//test assignment operator from ArrayHandleVirtual
|
||||
{
|
||||
VirtHandle virt;
|
||||
virt = VirtHandle{ ArrayHandle{} };
|
||||
VTKM_TEST_ASSERT(vtkm::cont::IsType<ArrayHandle>(virt),
|
||||
"ArrayHandleVirtual should be valid after assignment op from AHV.");
|
||||
}
|
||||
|
||||
//test assignment operator from ArrayHandle
|
||||
{
|
||||
VirtHandle virt = vtkm::cont::ArrayHandleCounting<ValueType>{};
|
||||
virt = ArrayHandle{};
|
||||
VTKM_TEST_ASSERT(vtkm::cont::IsType<ArrayHandle>(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<ArrayHandle>(virt),
|
||||
"ArrayHandleVirtual should be valid after move assignment op from AHV.");
|
||||
}
|
||||
|
||||
//test move assignment operator from ArrayHandle
|
||||
{
|
||||
vtkm::cont::ArrayHandleCounting<ValueType> temp;
|
||||
VirtHandle virt;
|
||||
virt = std::move(temp);
|
||||
VTKM_TEST_ASSERT(vtkm::cont::IsType<decltype(temp)>(virt),
|
||||
"ArrayHandleVirtual should be valid after move assignment op from AH.");
|
||||
}
|
||||
}
|
||||
|
||||
void TestPrepareForExecution()
|
||||
{
|
||||
std::cout << "Prepare for execution" << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> 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<ValueType> handle;
|
||||
VirtHandle virt(std::move(handle));
|
||||
|
||||
VTKM_TEST_ASSERT(vtkm::cont::IsType<decltype(virt)>(virt),
|
||||
"virt should by same type as decltype(virt)");
|
||||
VTKM_TEST_ASSERT(vtkm::cont::IsType<decltype(handle)>(virt),
|
||||
"virt should by same type as decltype(handle)");
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<ValueType, 3>> vecHandle;
|
||||
VTKM_TEST_ASSERT(!vtkm::cont::IsType<decltype(vecHandle)>(virt),
|
||||
"virt shouldn't by same type as decltype(vecHandle)");
|
||||
}
|
||||
|
||||
void TestCast()
|
||||
{
|
||||
std::cout << "Cast" << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> handle;
|
||||
VirtHandle virt(handle);
|
||||
|
||||
auto c1 = vtkm::cont::Cast<decltype(virt)>(virt);
|
||||
VTKM_TEST_ASSERT(c1 == virt, "virt should cast to VirtHandle");
|
||||
|
||||
auto c2 = vtkm::cont::Cast<decltype(handle)>(virt);
|
||||
VTKM_TEST_ASSERT(c2 == handle, "virt should cast to HandleType");
|
||||
|
||||
using VecHandle = vtkm::cont::ArrayHandle<vtkm::Vec<ValueType, 3>>;
|
||||
try
|
||||
{
|
||||
auto c3 = vtkm::cont::Cast<VecHandle>(virt);
|
||||
VTKM_TEST_FAIL("Cast of T to Vec<T,3> 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<ValueType>() << std::endl;
|
||||
TestConstructors();
|
||||
TestMoveConstructors();
|
||||
TestAssignmentOps();
|
||||
TestPrepareForExecution();
|
||||
TestIsType();
|
||||
TestCast();
|
||||
TestControlPortalLocking();
|
||||
}
|
||||
};
|
||||
|
||||
void TestArrayHandleVirtual()
|
||||
{
|
||||
Test<vtkm::UInt8>()();
|
||||
Test<vtkm::Int16>()();
|
||||
Test<vtkm::Int32>()();
|
||||
Test<vtkm::Int64>()();
|
||||
Test<vtkm::Float32>()();
|
||||
Test<vtkm::Float64>()();
|
||||
}
|
||||
|
||||
} // 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
|
||||
}
|
@ -26,10 +26,6 @@
|
||||
#include <vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h>
|
||||
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/internal/VirtualObjectTransferShareWithControl.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
#include <vtkm/cont/testing/TestingDeviceAdapter.h>
|
||||
|
||||
// Hijack the serial device id so that precompiled units (like memory management) still work.
|
||||
@ -89,17 +85,6 @@ class DeviceAdapterMemoryManager<vtkm::cont::DeviceAdapterTagTestAlgorithmGenera
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename TargetClass>
|
||||
struct VirtualObjectTransfer<TargetClass, vtkm::cont::DeviceAdapterTagTestAlgorithmGeneral> final
|
||||
: public VirtualObjectTransferShareWithControl<TargetClass>
|
||||
{
|
||||
using VirtualObjectTransferShareWithControl<TargetClass>::VirtualObjectTransferShareWithControl;
|
||||
};
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont::internal
|
||||
|
@ -15,10 +15,6 @@
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ImplicitFunctionHandle.h>
|
||||
#endif //!VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
#include <array>
|
||||
@ -41,20 +37,6 @@ public:
|
||||
val = function.Value(point);
|
||||
gradient = function.Gradient(point);
|
||||
}
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename VecType, typename ScalarType, typename FunctionType>
|
||||
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<vtkm::Vec3f, 8> 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<vtkm::FloatDefault> values;
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> 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<ImplicitFunctorType> functionChoose(function);
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> values;
|
||||
|
@ -30,10 +30,6 @@ VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/ArrayHandleZip.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ArrayHandleVirtual.h>
|
||||
#endif
|
||||
|
||||
#include <vtkm/cont/internal/IteratorFromArrayPortal.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
@ -125,19 +121,6 @@ struct CheckFunctor
|
||||
CheckArray(array);
|
||||
}
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
template <typename T>
|
||||
void operator()(const vtkm::cont::ArrayHandleVirtual<T>& 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 <typename T, typename S>
|
||||
void operator()(const vtkm::cont::ArrayHandle<T, S>&, bool&, bool&) const
|
||||
{
|
||||
@ -258,83 +241,6 @@ void CheckCastToArrayHandle(const ArrayHandleType& array)
|
||||
template <typename T, vtkm::IdComponent NumComps>
|
||||
using VecOrScalar = typename std::conditional<(NumComps > 1), vtkm::Vec<T, NumComps>, T>::type;
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
template <typename ArrayType>
|
||||
void CheckCastToVirtualArrayHandle(const ArrayType& array)
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayType);
|
||||
|
||||
using ValueType = typename ArrayType::ValueType;
|
||||
using VTraits = vtkm::VecTraits<ValueType>;
|
||||
using ComponentType = typename VTraits::ComponentType;
|
||||
static constexpr vtkm::IdComponent NumComps = VTraits::NUM_COMPONENTS;
|
||||
|
||||
using Storage = typename ArrayType::StorageTag;
|
||||
using StorageList = vtkm::ListAppend<VTKM_DEFAULT_STORAGE_LIST, vtkm::List<Storage>>;
|
||||
|
||||
using TypeList = vtkm::ListAppend<VTKM_DEFAULT_TYPE_LIST, vtkm::List<ValueType>>;
|
||||
using VariantArrayType = vtkm::cont::VariantArrayHandleBase<TypeList>;
|
||||
|
||||
VariantArrayType arrayVariant = array;
|
||||
|
||||
{
|
||||
auto testArray = arrayVariant.template AsVirtual<ValueType, StorageList>();
|
||||
VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(),
|
||||
"Did not get back virtual array handle representation.");
|
||||
}
|
||||
|
||||
{
|
||||
auto testArray =
|
||||
arrayVariant.template AsVirtual<VecOrScalar<vtkm::Int8, NumComps>, StorageList>();
|
||||
VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(),
|
||||
"Did not get back virtual array handle representation.");
|
||||
}
|
||||
|
||||
{
|
||||
auto testArray =
|
||||
arrayVariant.template AsVirtual<VecOrScalar<vtkm::Int64, NumComps>, StorageList>();
|
||||
VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(),
|
||||
"Did not get back virtual array handle representation.");
|
||||
}
|
||||
|
||||
{
|
||||
auto testArray =
|
||||
arrayVariant.template AsVirtual<VecOrScalar<vtkm::UInt64, NumComps>, StorageList>();
|
||||
VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(),
|
||||
"Did not get back virtual array handle representation.");
|
||||
}
|
||||
|
||||
{
|
||||
auto testArray =
|
||||
arrayVariant.template AsVirtual<VecOrScalar<vtkm::Float32, NumComps>, StorageList>();
|
||||
VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(),
|
||||
"Did not get back virtual array handle representation.");
|
||||
}
|
||||
|
||||
{
|
||||
auto testArray =
|
||||
arrayVariant.template AsVirtual<VecOrScalar<vtkm::Float64, NumComps>, StorageList>();
|
||||
VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(),
|
||||
"Did not get back virtual array handle representation.");
|
||||
}
|
||||
|
||||
bool threw = false;
|
||||
try
|
||||
{
|
||||
arrayVariant.template AsVirtual<vtkm::Vec<ComponentType, NumComps + 1>, 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 <typename T, typename ArrayVariantType>
|
||||
void TryNewInstance(T, ArrayVariantType originalArray)
|
||||
{
|
||||
@ -468,9 +374,6 @@ template <typename ArrayHandleType>
|
||||
void TryCastToArrayHandle(const ArrayHandleType& array)
|
||||
{
|
||||
CheckCastToArrayHandle(array);
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
CheckCastToVirtualArrayHandle(array);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryCastToArrayHandle()
|
||||
|
@ -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 <vtkm/Types.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleTransform.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
#include <vtkm/cont/VirtualObjectHandle.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#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<vtkm::FloatDefault>;
|
||||
using ArrayTransform = vtkm::cont::ArrayHandleTransform<FloatArrayHandle, TransformerFunctor>;
|
||||
using TransformerHandle = vtkm::cont::VirtualObjectHandle<Transformer>;
|
||||
|
||||
class TestStage1
|
||||
{
|
||||
public:
|
||||
TestStage1(const FloatArrayHandle& input, TransformerHandle& handle)
|
||||
: Input(&input)
|
||||
, Handle(&handle)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename DeviceAdapter>
|
||||
bool operator()(DeviceAdapter device) const
|
||||
{
|
||||
using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
|
||||
std::cout << "\tDeviceAdapter: " << vtkm::cont::DeviceAdapterTraits<DeviceAdapter>::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 <typename DeviceAdapter>
|
||||
bool operator()(DeviceAdapter device) const
|
||||
{
|
||||
using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
|
||||
std::cout << "\tDeviceAdapter: " << vtkm::cont::DeviceAdapterTraits<DeviceAdapter>::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<vtkm::FloatDefault> 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);
|
||||
}
|
@ -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)
|
||||
|
@ -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 <vtkm/Deprecated.h>
|
||||
#include <vtkm/ErrorCode.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/VirtualObjectBase.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
|
||||
#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
|
@ -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 <vtkm/VirtualObjectBase.h>
|
||||
|
||||
#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
|
@ -13,10 +13,6 @@
|
||||
|
||||
#include <vtkm/ImplicitFunction.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ImplicitFunctionHandle.h>
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/entity_extraction/vtkm_filter_entity_extraction_export.h>
|
||||
|
||||
|
@ -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 <vtkm/internal/Configure.h>
|
||||
#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 <vtkm/VecTraits.h>
|
||||
#include <vtkm/VirtualObjectBase.h>
|
||||
|
||||
#include <vtkm/internal/ArrayPortalHelpers.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
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 <typename T>
|
||||
class VTKM_ALWAYS_EXPORT ArrayPortalVirtual : public internal::PortalVirtualBase
|
||||
{
|
||||
public:
|
||||
using ValueType = T;
|
||||
|
||||
//use parents constructor
|
||||
using PortalVirtualBase::PortalVirtualBase;
|
||||
|
||||
VTKM_EXEC_CONT virtual ~ArrayPortalVirtual<T>(){};
|
||||
|
||||
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 <typename PortalT>
|
||||
class VTKM_ALWAYS_EXPORT ArrayPortalWrapper final
|
||||
: public vtkm::ArrayPortalVirtual<typename PortalT::ValueType>
|
||||
{
|
||||
using T = typename PortalT::ValueType;
|
||||
|
||||
public:
|
||||
ArrayPortalWrapper(const PortalT& p) noexcept
|
||||
: ArrayPortalVirtual<T>()
|
||||
, 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<PortalT>::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<PortalT>::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 <typename T>
|
||||
class VTKM_ALWAYS_EXPORT ArrayPortalRef
|
||||
{
|
||||
public:
|
||||
using ValueType = T;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
ArrayPortalRef() noexcept
|
||||
: Portal(nullptr)
|
||||
, NumberOfValues(0)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
ArrayPortalRef(const ArrayPortalVirtual<T>* 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<Portal> 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<T>* Portal;
|
||||
vtkm::Id NumberOfValues;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline ArrayPortalRef<T> make_ArrayPortalRef(const ArrayPortalVirtual<T>* portal,
|
||||
vtkm::Id numValues) noexcept
|
||||
{
|
||||
return ArrayPortalRef<T>(portal, numValues);
|
||||
}
|
||||
|
||||
|
||||
} // namespace vtkm
|
||||
|
||||
#endif
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -53,17 +53,6 @@ struct CheckSameCoordinateSystem
|
||||
CheckSameField{}(originalArray, fileCoords);
|
||||
}
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename T>
|
||||
void operator()(const vtkm::cont::ArrayHandleVirtual<T>& 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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user