mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 09:59:12 +00:00
77f9ae653d
Previously, `ArrayHandleSOA` worked with any value type that supported `VecTraits`. That means that `ArrayHandleSOA` worked with scalar types like `Float32`. However, for scalar types, the behavior is essentially the same as `ArrayHandleBasic`, but with lots of extra templating and code generation. Although there is nothing _wrong_ with allowing `ArrayHandleSOA` holding a scalar, there is no real reason to either (other than likely template convenience). Generally, there is nothing wrong with supporting it, but if you want to support `ArrayHandleSOA` in places where types are not known (e.g. `Field`), then templating tends to iterate over the cross of all supported types with all supported storage. That means such code will automatically generate a bunch of code for `ArrayHandleSOA` with scalars even if there is no reason for those code paths. So, we can just disable the use of `ArrayHandleSOA` with scalars to allow us to use `ArrayHandleSOA` as a default storage without creating all these useless code paths.
39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
//============================================================================
|
|
// Copyright (c) Kitware, Inc.
|
|
// All rights reserved.
|
|
// See LICENSE.txt for details.
|
|
//
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
//============================================================================
|
|
|
|
#define vtkm_cont_ArrayHandleSOA_cxx
|
|
#include <vtkm/cont/ArrayHandleSOA.h>
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace cont
|
|
{
|
|
|
|
#define VTKM_ARRAYHANDLE_SOA_INSTANTIATE(Type) \
|
|
template class VTKM_CONT_EXPORT ArrayHandle<vtkm::Vec<Type, 2>, StorageTagSOA>; \
|
|
template class VTKM_CONT_EXPORT ArrayHandle<vtkm::Vec<Type, 3>, StorageTagSOA>; \
|
|
template class VTKM_CONT_EXPORT ArrayHandle<vtkm::Vec<Type, 4>, StorageTagSOA>;
|
|
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(char)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::Int8)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::UInt8)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::Int16)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::UInt16)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::Int32)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::UInt32)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::Int64)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::UInt64)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::Float32)
|
|
VTKM_ARRAYHANDLE_SOA_INSTANTIATE(vtkm::Float64)
|
|
|
|
#undef VTKM_ARRAYHANDLE_SOA_INSTANTIATE
|
|
}
|
|
} // end vtkm::cont
|