mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Merge topic 'runtime-vec-info'
5bdd3c7bc Move ArrayHandleRuntimeVec metadata to a separate class Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Li-Ta Lo <ollie@lanl.gov> Merge-request: !3062
This commit is contained in:
commit
fb8e3d7ce7
@ -133,6 +133,11 @@ struct VTKM_ALWAYS_EXPORT StorageTagRuntimeVec
|
||||
namespace internal
|
||||
{
|
||||
|
||||
struct RuntimeVecMetaData
|
||||
{
|
||||
vtkm::IdComponent NumberOfComponents;
|
||||
};
|
||||
|
||||
template <typename ComponentsPortal>
|
||||
class Storage<vtkm::VecFromPortal<ComponentsPortal>, vtkm::cont::StorageTagRuntimeVec>
|
||||
{
|
||||
@ -152,10 +157,7 @@ class Storage<vtkm::VecFromPortal<ComponentsPortal>, vtkm::cont::StorageTagRunti
|
||||
(std::is_same<ComponentsPortal, typename ComponentsStorage::WritePortalType>::value),
|
||||
"Used invalid ComponentsPortal type with expected ComponentsStorageTag.");
|
||||
|
||||
struct Info
|
||||
{
|
||||
vtkm::IdComponent NumberOfComponents;
|
||||
};
|
||||
using Info = RuntimeVecMetaData;
|
||||
|
||||
VTKM_CONT static std::vector<vtkm::cont::internal::Buffer> ComponentsBuffers(
|
||||
const std::vector<vtkm::cont::internal::Buffer>& buffers)
|
||||
|
@ -544,11 +544,10 @@ void TrySetMultiplexerArray()
|
||||
CheckUnknownArray<vtkm::List<vtkm::Id>, vtkm::List<VTKM_DEFAULT_STORAGE_TAG>>(unknownArray, 1);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, typename BasicComponentType = typename vtkm::VecFlat<T>::ComponentType>
|
||||
void TryConvertRuntimeVec()
|
||||
{
|
||||
using BasicArrayType = vtkm::cont::ArrayHandle<T>;
|
||||
using BasicComponentType = typename vtkm::VecFlat<T>::ComponentType;
|
||||
constexpr vtkm::IdComponent numFlatComponents = vtkm::VecFlat<T>::NUM_COMPONENTS;
|
||||
using RuntimeArrayType = vtkm::cont::ArrayHandleRuntimeVec<BasicComponentType>;
|
||||
|
||||
@ -614,6 +613,16 @@ void TryConvertRuntimeVec()
|
||||
|
||||
std::cout << " Vec of Vecs of Vecs." << std::endl;
|
||||
TryConvertRuntimeVec<vtkm::Vec<vtkm::Vec<vtkm::Id4, 3>, 2>>();
|
||||
|
||||
std::cout << " Compatible but different C types." << std::endl;
|
||||
if (sizeof(int) == sizeof(long))
|
||||
{
|
||||
TryConvertRuntimeVec<vtkm::Vec<int, 4>, long>();
|
||||
}
|
||||
else // assuming sizeof(long long) == sizeof(long)
|
||||
{
|
||||
TryConvertRuntimeVec<vtkm::Vec<long long, 4>, long>();
|
||||
}
|
||||
}
|
||||
|
||||
struct DefaultTypeFunctor
|
||||
|
Loading…
Reference in New Issue
Block a user