Deprecate ArrayHandleVirtual

Virtual methods in the execution environment are going away the next
major release of VTK-m, so deprecate their use in preparation for that.
This commit is contained in:
Kenneth Moreland 2020-09-02 16:36:52 -06:00
parent 06579aac8c
commit e11f612add
13 changed files with 47 additions and 20 deletions

@ -26,8 +26,9 @@ namespace cont
{
VTKM_DEPRECATED_SUPPRESS_BEGIN
template <typename T>
class VTKM_ALWAYS_EXPORT ArrayHandleVirtual
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>;
@ -267,6 +268,7 @@ 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

@ -13,6 +13,7 @@
#include <vtkm/cont/ArrayHandleVirtual.h>
#include <vtkm/cont/TryExecute.h>
VTKM_DEPRECATED_SUPPRESS_BEGIN
namespace vtkm
{
namespace cont
@ -37,6 +38,7 @@ ArrayHandleType inline ArrayHandleVirtual<T>::CastToType(
}
}
} // namespace vtkm::cont
VTKM_DEPRECATED_SUPPRESS_END
#include <vtkm/cont/ArrayHandleConstant.h>
@ -45,6 +47,7 @@ ArrayHandleType inline ArrayHandleVirtual<T>::CastToType(
//=============================================================================
// Specializations of serialization related classes
/// @cond SERIALIZATION
VTKM_DEPRECATED_SUPPRESS_BEGIN
namespace mangled_diy_namespace
{
@ -178,5 +181,6 @@ struct Serialization<vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>>
};
} // mangled_diy_namespace
VTKM_DEPRECATED_SUPPRESS_END
#endif

@ -87,10 +87,12 @@ VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Float64, 4, vtkm::cont::StorageTagBas
#undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T
#undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC
VTKM_CONT
vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
const vtkm::cont::ArrayHandleVirtual<vtkm::Vec3f>& input,
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny());
VTKM_DEPRECATED_SUPPRESS_BEGIN
VTKM_CONT VTKM_DEPRECATED(1.6, "ArrayHandleVirtual no longer supported.")
vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
const vtkm::cont::ArrayHandleVirtual<vtkm::Vec3f>& input,
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny());
VTKM_DEPRECATED_SUPPRESS_END
VTKM_CONT_EXPORT VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
const vtkm::cont::ArrayHandle<vtkm::Vec3f,

@ -58,7 +58,7 @@ namespace vtkm
namespace cont
{
struct VTKM_ALWAYS_EXPORT StorageTagVirtual
struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6) StorageTagVirtual
{
};
@ -256,6 +256,7 @@ private:
} // namespace detail
VTKM_DEPRECATED_SUPPRESS_BEGIN
template <typename T>
class VTKM_ALWAYS_EXPORT Storage<T, vtkm::cont::StorageTagVirtual>
{
@ -315,6 +316,7 @@ private:
{
}
};
VTKM_DEPRECATED_SUPPRESS_END
} // namespace internal
}

@ -235,6 +235,7 @@ void StorageVirtualImpl<T, S>::TransferPortalForOutput(
}
} // namespace detail
VTKM_DEPRECATED_SUPPRESS_BEGIN
template <typename T>
void Storage<T, vtkm::cont::StorageTagVirtual>::Allocate(vtkm::Id numberOfValues)
{
@ -433,6 +434,7 @@ struct ArrayTransfer<T, vtkm::cont::StorageTagVirtual, Device> : detail::ArrayTr
return this->Superclass::PrepareForInPlace(Device());
}
};
VTKM_DEPRECATED_SUPPRESS_END
}
}
} // namespace vtkm::cont::internal

@ -36,6 +36,7 @@ namespace internal
namespace variant
{
VTKM_DEPRECATED_SUPPRESS_BEGIN
struct ForceCastToVirtual
{
template <typename SrcValueType, typename Storage, typename DstValueType>
@ -84,6 +85,7 @@ private:
throw vtkm::cont::ErrorBadType(str.str());
}
};
VTKM_DEPRECATED_SUPPRESS_END
}
} // namespace internal::variant
@ -155,10 +157,12 @@ public:
/// the CastAndCall. You can also specify a list of types to try as the optional
/// third template argument.
///
VTKM_DEPRECATED_SUPPRESS_BEGIN
template <typename T,
typename StorageList = VTKM_DEFAULT_STORAGE_LIST,
typename TypeList = vtkm::List<T>>
VTKM_CONT vtkm::cont::ArrayHandleVirtual<T> AsVirtual() const
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);
@ -167,6 +171,7 @@ public:
this->CastAndCall<TypeList, StorageList>(caster, output);
return output;
}
VTKM_DEPRECATED_SUPPRESS_END
/// Returns this array cast to a `ArrayHandleMultiplexer` of the given type.
/// This will attempt to cast the internal array to each supported type of
@ -311,11 +316,14 @@ public:
/// be specified in the second template parameter, which will be passed to
/// the CastAndCall.
///
VTKM_DEPRECATED_SUPPRESS_BEGIN
template <typename T, typename StorageList = VTKM_DEFAULT_STORAGE_LIST>
VTKM_CONT vtkm::cont::ArrayHandleVirtual<T> AsVirtual() const
VTKM_CONT VTKM_DEPRECATED(1.6, "ArrayHandleVirtual is no longer suported.")
vtkm::cont::ArrayHandleVirtual<T> AsVirtual() const
{
return this->Superclass::AsVirtual<T, StorageList, TypeList>();
}
VTKM_DEPRECATED_SUPPRESS_END
/// 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++

@ -64,6 +64,7 @@ struct Transport<vtkm::cont::arg::TransportTagAtomicArray,
}
};
VTKM_DEPRECATED_SUPPRESS_BEGIN
template <typename T, typename Device>
struct Transport<vtkm::cont::arg::TransportTagAtomicArray,
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>,
@ -99,6 +100,7 @@ struct Transport<vtkm::cont::arg::TransportTagAtomicArray,
return obj.PrepareForExecution(Device());
}
};
VTKM_DEPRECATED_SUPPRESS_END
}
}
} // namespace vtkm::cont::arg

@ -44,11 +44,13 @@ struct TypeCheck<TypeCheckTagAtomicArray, vtkm::cont::ArrayHandle<T, vtkm::cont:
static constexpr bool value = vtkm::ListHas<vtkm::cont::AtomicArrayTypeList, T>::value;
};
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
}
}
} // namespace vtkm::cont::arg

@ -25,6 +25,8 @@
#include <algorithm>
VTKM_DEPRECATED_SUPPRESS_BEGIN
namespace UnitTestArrayHandleVirtualDetail
{
@ -246,6 +248,8 @@ void TestArrayHandleVirtual()
} // end namespace UnitTestArrayHandleVirtualDetail
VTKM_DEPRECATED_SUPPRESS_END
int UnitTestArrayHandleVirtual(int argc, char* argv[])
{
using namespace UnitTestArrayHandleVirtualDetail;

@ -94,22 +94,22 @@ struct IsNoExceptHandle
void operator()(T) const
{
using HandleType = vtkm::cont::ArrayHandle<T>;
using VirtualType = vtkm::cont::ArrayHandleVirtual<T>;
using MultiplexerType = vtkm::cont::ArrayHandleMultiplexer<HandleType>;
//verify the handle type
is_noexcept_movable<HandleType>();
is_noexcept_movable<VirtualType>();
is_noexcept_movable<MultiplexerType>();
//verify the input portals of the handle
is_noexcept_movable<decltype(std::declval<HandleType>().PrepareForInput(
vtkm::cont::DeviceAdapterTagSerial{}, std::declval<vtkm::cont::Token&>()))>();
is_noexcept_movable<decltype(std::declval<VirtualType>().PrepareForInput(
is_noexcept_movable<decltype(std::declval<MultiplexerType>().PrepareForInput(
vtkm::cont::DeviceAdapterTagSerial{}, std::declval<vtkm::cont::Token&>()))>();
//verify the output portals of the handle
is_noexcept_movable<decltype(std::declval<HandleType>().PrepareForOutput(
2, vtkm::cont::DeviceAdapterTagSerial{}, std::declval<vtkm::cont::Token&>()))>();
is_noexcept_movable<decltype(std::declval<VirtualType>().PrepareForOutput(
is_noexcept_movable<decltype(std::declval<MultiplexerType>().PrepareForOutput(
2, vtkm::cont::DeviceAdapterTagSerial{}, std::declval<vtkm::cont::Token&>()))>();
}
};
@ -141,9 +141,6 @@ void TestContDataTypesHaveMoveSemantics()
is_noexcept_movable<vtkm::cont::DataSet>();
is_noexcept_movable<vtkm::cont::Field>();
is_noexcept_movable<vtkm::cont::CoordinateSystem>();
VTKM_DEPRECATED_SUPPRESS_BEGIN
is_noexcept_movable<vtkm::cont::ArrayHandleVirtualCoordinates>();
VTKM_DEPRECATED_SUPPRESS_END
//verify the CellSetStructured, and CellSetExplicit
//have efficient storage in containers such as std::vector

@ -264,6 +264,7 @@ void CheckCastToVirtualArrayHandle(const ArrayType& array)
VariantArrayType arrayVariant = array;
VTKM_DEPRECATED_SUPPRESS_BEGIN
{
auto testArray = arrayVariant.template AsVirtual<ValueType, StorageList>();
VTKM_TEST_ASSERT(testArray.GetNumberOfValues() == array.GetNumberOfValues(),
@ -319,6 +320,7 @@ void CheckCastToVirtualArrayHandle(const ArrayType& array)
VTKM_TEST_ASSERT(threw,
"Casting to different vector width did not throw expected "
"ErrorBadType exception.");
VTKM_DEPRECATED_SUPPRESS_END
}
template <typename T, typename ArrayVariantType>

@ -303,7 +303,7 @@ VTKM_CONT void ContourTreeAugmented::DoPostExecute(
currBlock.GetField(this->GetActiveFieldName(), this->GetActiveFieldAssociation());
//const vtkm::cont::ArrayHandle<T,StorageType> &fieldData = currField.GetData().Cast<vtkm::cont::ArrayHandle<T,StorageType> >();
vtkm::cont::ArrayHandle<T> fieldData;
vtkm::cont::ArrayCopy(currField.GetData().template AsVirtual<T>(), fieldData);
vtkm::cont::ArrayCopy(currField.GetData().template ResetTypes<vtkm::List<T>>(), fieldData);
auto currContourTreeMesh = vtkm::worklet::contourtree_distributed::MultiBlockContourTreeHelper::
ComputeLocalContourTreeMesh<T>(
this->MultiBlockTreeHelper->MultiBlockSpatialDecomposition.LocalBlockOrigins.ReadPortal()

@ -82,8 +82,8 @@ vtkm::cont::DataSet CreateDataSet(bool pointNormals, bool cellNormals)
struct ValidateNormals
{
using CellSetType = vtkm::cont::CellSetSingleType<>;
using NormalType = vtkm::Vec<vtkm::FloatDefault, 3>;
using NormalsArrayType = vtkm::cont::ArrayHandleVirtual<NormalType>;
using NormalType = vtkm::Vec3f;
using NormalsArrayType = vtkm::cont::ArrayHandle<NormalType>;
using NormalsPortalType = decltype(std::declval<NormalsArrayType>().ReadPortal());
using PointsType = decltype(std::declval<vtkm::cont::CoordinateSystem>().GetDataAsMultiplexer());
@ -154,12 +154,12 @@ struct ValidateNormals
if (this->CheckPoints)
{
this->PointNormalsArray = pointNormalsField.GetData().AsVirtual<NormalType>();
pointNormalsField.GetData().AsArrayHandle(this->PointNormalsArray);
this->PointNormals = this->PointNormalsArray.ReadPortal();
}
if (this->CheckCells)
{
this->CellNormalsArray = cellNormalsField.GetData().AsVirtual<NormalType>();
cellNormalsField.GetData().AsArrayHandle(this->CellNormalsArray);
this->CellNormals = this->CellNormalsArray.ReadPortal();
}
}