mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
ArrayHandleVirtual bugfixes
After the change to `ArrayHandleVirtual` where it became a subclass of `vtkm::cont::ArrayHandle`, a few extra changes are required. 1. Functions with `ArrayHandleVirtual` as parameters will not be callable with the superclass `ArrayHandle`. This is fixed by changing the argument types to the superclass. 2. Add Serialization classes specializations for the superclass, as "is-a" relation is not considered for class template parameters.
This commit is contained in:
parent
d0d33f9807
commit
dae779b9f8
@ -213,9 +213,11 @@ VTKM_CONT vtkm::cont::ArrayHandleVirtual<T> make_ArrayHandleVirtual(
|
||||
/// Returns true if \c virtHandle matches the type of ArrayHandleType.
|
||||
///
|
||||
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
|
||||
@ -223,9 +225,11 @@ VTKM_CONT inline bool IsType(const vtkm::cont::ArrayHandleVirtual<T>& virtHandle
|
||||
/// to check if the cast can happen.
|
||||
///
|
||||
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
|
||||
@ -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
|
||||
|
||||
#define VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(T) \
|
||||
|
@ -154,6 +154,13 @@ 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
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user