Commit e7b26f5c authored by Sujin Philip's avatar Sujin Philip Committed by Kitware Robot

Merge topic 'bugfixes-ArrayHandleVirtual'

dae779b9 ArrayHandleVirtual bugfixes
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard's avatarRobert Maynard <robert.maynard@kitware.com>
Merge-request: !1632
parents 830f16c4 dae779b9
...@@ -213,9 +213,11 @@ VTKM_CONT vtkm::cont::ArrayHandleVirtual<T> make_ArrayHandleVirtual( ...@@ -213,9 +213,11 @@ VTKM_CONT vtkm::cont::ArrayHandleVirtual<T> make_ArrayHandleVirtual(
/// Returns true if \c virtHandle matches the type of ArrayHandleType. /// Returns true if \c virtHandle matches the type of ArrayHandleType.
/// ///
template <typename ArrayHandleType, typename T> template <typename ArrayHandleType, typename T>
VTKM_CONT inline bool IsType(const vtkm::cont::ArrayHandleVirtual<T>& virtHandle) VTKM_CONT inline bool IsType(
const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>& virtHandle)
{ {
return virtHandle.template IsType<ArrayHandleType>(); return static_cast<vtkm::cont::ArrayHandleVirtual<T>>(virtHandle)
.template IsType<ArrayHandleType>();
} }
/// Returns \c virtHandle cast to the given \c ArrayHandle type. Throws \c /// Returns \c virtHandle cast to the given \c ArrayHandle type. Throws \c
...@@ -223,9 +225,11 @@ VTKM_CONT inline bool IsType(const vtkm::cont::ArrayHandleVirtual<T>& virtHandle ...@@ -223,9 +225,11 @@ VTKM_CONT inline bool IsType(const vtkm::cont::ArrayHandleVirtual<T>& virtHandle
/// to check if the cast can happen. /// to check if the cast can happen.
/// ///
template <typename ArrayHandleType, typename T> template <typename ArrayHandleType, typename T>
VTKM_CONT inline ArrayHandleType Cast(const vtkm::cont::ArrayHandleVirtual<T>& virtHandle) VTKM_CONT inline ArrayHandleType Cast(
const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>& virtHandle)
{ {
return virtHandle.template Cast<ArrayHandleType>(); return static_cast<vtkm::cont::ArrayHandleVirtual<T>>(virtHandle)
.template Cast<ArrayHandleType>();
} }
//============================================================================= //=============================================================================
// Specializations of serialization related classes // Specializations of serialization related classes
...@@ -239,6 +243,12 @@ struct SerializableTypeString<vtkm::cont::ArrayHandleVirtual<T>> ...@@ -239,6 +243,12 @@ struct SerializableTypeString<vtkm::cont::ArrayHandleVirtual<T>>
} }
}; };
template <typename T>
struct SerializableTypeString<vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>>
: public SerializableTypeString<vtkm::cont::ArrayHandleVirtual<T>>
{
};
#ifndef vtk_m_cont_ArrayHandleVirtual_cxx #ifndef vtk_m_cont_ArrayHandleVirtual_cxx
#define VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(T) \ #define VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(T) \
......
...@@ -154,6 +154,13 @@ struct Serialization<vtkm::cont::ArrayHandleVirtual<vtkm::Int64>> ...@@ -154,6 +154,13 @@ struct Serialization<vtkm::cont::ArrayHandleVirtual<vtkm::Int64>>
: public IntAnySerializer<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
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment