Support ArrayHandleCompositeVector with 1 component

When `ArrayHandleCompositeVector` has only 1 component, it is supposed
to have a special template that uses the base value type rather than a
`Vec` of that type. However, the `Storage` with the value type was
missing. I'm not sure how we weren't getting compile errors before, but
moving to the new buffer arrays seems to bring about the expected error.
This commit is contained in:
Kenneth Moreland 2020-11-23 17:17:31 -07:00
parent 5391e353a0
commit 7ff1a690de
2 changed files with 23 additions and 2 deletions

@ -248,8 +248,8 @@ class Storage<vtkm::Vec<T, static_cast<vtkm::IdComponent>(sizeof...(StorageTags)
public:
using ReadPortalType =
vtkm::internal::ArrayPortalCompositeVector<typename StorageFor<StorageTags>::ReadPortalType...>;
using WritePortalType =
vtkm::internal::ArrayPortalCompositeVector<typename StorageFor<StorageTags>::ReadPortalType...>;
using WritePortalType = vtkm::internal::ArrayPortalCompositeVector<
typename StorageFor<StorageTags>::WritePortalType...>;
private:
// Hoop to jump through to use Storage::ResizeBuffer in an initializer list.
@ -382,6 +382,23 @@ public:
}
};
// Special degenerative case when there is only one array being composited
template <typename T, typename StorageTag>
struct Storage<T, vtkm::cont::StorageTagCompositeVec<StorageTag>> : Storage<T, StorageTag>
{
VTKM_CONT static std::vector<vtkm::cont::internal::Buffer> CreateBuffers(
const vtkm::cont::ArrayHandle<T, StorageTag>& array)
{
return vtkm::cont::internal::CreateBuffers(array);
}
VTKM_CONT static vtkm::Tuple<vtkm::cont::ArrayHandle<T, StorageTag>> GetArrayTuple(
const vtkm::cont::internal::Buffer* buffers)
{
return vtkm::cont::ArrayHandle<T, StorageTag>(buffers);
}
};
} // namespace internal
template <typename T, typename... Ss>

@ -94,8 +94,12 @@ class Storage
: public vtkm::cont::internal::UndefinedStorage
{
public:
// TODO: Deprecate these
using PortalType = vtkm::cont::internal::detail::UndefinedArrayPortal<T>;
using PortalConstType = vtkm::cont::internal::detail::UndefinedArrayPortal<T>;
using ReadPortalType = vtkm::cont::internal::detail::UndefinedArrayPortal<T>;
using WritePortalType = vtkm::cont::internal::detail::UndefinedArrayPortal<T>;
};
#else //VTKM_DOXYGEN_ONLY
{