10 #ifndef vtk_m_cont_ArrayHandleDiscard_h
11 #define vtk_m_cont_ArrayHandleDiscard_h
17 #include <type_traits>
28 template <
typename ValueType_>
29 class ArrayPortalDiscard
32 using ValueType = ValueType_;
42 explicit ArrayPortalDiscard(
vtkm::Id numValues)
43 : NumberOfValues(numValues)
51 template <
class OtherV>
52 VTKM_CONT ArrayPortalDiscard(
const ArrayPortalDiscard<OtherV>& src)
53 : NumberOfValues(src.NumberOfValues)
58 vtkm::Id GetNumberOfValues()
const {
return this->NumberOfValues; }
67 void Set(
vtkm::Id index,
const ValueType&)
const
96 template <
typename ValueType>
97 class Storage<ValueType, StorageTagDiscard>
100 using WritePortalType = vtkm::exec::internal::ArrayPortalDiscard<ValueType>;
104 using ReadPortalType = vtkm::exec::internal::ArrayPortalDiscard<ValueType>;
106 VTKM_CONT static std::vector<vtkm::cont::internal::Buffer> CreateBuffers()
108 DiscardMetaData metaData;
109 metaData.NumberOfValues = 0;
110 return vtkm::cont::internal::CreateBuffers(metaData);
114 const std::vector<vtkm::cont::internal::Buffer>& buffers,
119 buffers[0].GetMetaData<DiscardMetaData>().NumberOfValues = numValues;
123 const std::vector<vtkm::cont::internal::Buffer>& buffers)
125 return buffers[0].GetMetaData<DiscardMetaData>().NumberOfValues;
128 VTKM_CONT static void Fill(
const std::vector<vtkm::cont::internal::Buffer>&,
137 VTKM_CONT static ReadPortalType CreateReadPortal(
const std::vector<vtkm::cont::internal::Buffer>&,
144 VTKM_CONT static WritePortalType CreateWritePortal(
145 const std::vector<vtkm::cont::internal::Buffer>& buffers,
149 return WritePortalType(GetNumberOfValues(buffers));
153 template <
typename ValueType_>
154 struct ArrayHandleDiscardTraits
156 using ValueType = ValueType_;
157 using StorageTag = StorageTagDiscard;
166 template <
typename ValueType_>
176 template <
typename T>
181 template <
typename T>
189 #endif // vtk_m_cont_ArrayHandleDiscard_h