10 #ifndef vtk_m_cont_Storage_h
11 #define vtk_m_cont_Storage_h
13 #define VTKM_STORAGE_ERROR -2
14 #define VTKM_STORAGE_UNDEFINED -1
15 #define VTKM_STORAGE_BASIC 1
18 #define VTKM_STORAGE VTKM_STORAGE_BASIC
37 #ifdef VTKM_DOXYGEN_ONLY
70 #endif // VTKM_DOXYGEN_ONLY
75 struct UndefinedStorage
87 struct UndefinedArrayPortal
97 template <
typename T,
class StorageTag>
99 #ifndef VTKM_DOXYGEN_ONLY
100 :
public vtkm::cont::internal::UndefinedStorage
103 using ReadPortalType = vtkm::cont::internal::detail::UndefinedArrayPortal<T>;
104 using WritePortalType = vtkm::cont::internal::detail::UndefinedArrayPortal<T>;
106 #else //VTKM_DOXYGEN_ONLY
115 using ReadPortalType = vtkm::internal::ArrayPortalBasicRead<T>;
119 using WritePortalType = vtkm::internal::ArrayPortalBasicWrite<T>;
127 VTKM_CONT static std::vector<vtkm::cont::internal::Buffer> CreateBuffers();
134 const std::vector<vtkm::cont::internal::Buffer>& buffers,
140 const std::vector<vtkm::cont::internal::Buffer>& buffers);
144 VTKM_CONT static void Fill(
const std::vector<vtkm::cont::internal::Buffer>& buffers,
145 const ValueType& fillValue,
152 VTKM_CONT static ReadPortalType CreateReadPortal(
153 const std::vector<vtkm::cont::internal::Buffer>& buffers,
159 VTKM_CONT static WritePortalType CreateWritePortal(
160 const std::vector<vtkm::cont::internal::Buffer>& buffers,
164 #endif // VTKM_DOXYGEN_ONLY
171 std::string storageTagName);
175 template <
typename StorageType>
176 struct StorageTraits;
178 template <
typename T,
typename S>
179 struct StorageTraits<
vtkm::cont::internal::Storage<T, S>>
185 #define VTKM_STORAGE_NO_RESIZE \
186 VTKM_CONT static void ResizeBuffers(vtkm::Id numValues, \
187 const std::vector<vtkm::cont::internal::Buffer>& buffers, \
189 vtkm::cont::Token&) \
191 vtkm::cont::internal::detail::StorageNoResizeImpl( \
192 GetNumberOfValues(buffers), \
194 vtkm::cont::TypeToString<typename vtkm::cont::internal::StorageTraits<Storage>::Tag>()); \
196 using ResizeBuffersEatComma = void
198 #define VTKM_STORAGE_NO_WRITE_PORTAL \
199 using WritePortalType = vtkm::internal::ArrayPortalDummy< \
200 typename vtkm::cont::internal::StorageTraits<Storage>::ValueType>; \
201 VTKM_CONT static void Fill( \
202 const std::vector<vtkm::cont::internal::Buffer>&, \
203 const typename vtkm::cont::internal::StorageTraits<Storage>::ValueType&, \
206 vtkm::cont::Token&) \
208 throw vtkm::cont::ErrorBadAllocation( \
209 "Cannot write to arrays with storage type of " + \
210 vtkm::cont::TypeToString<typename vtkm::cont::internal::StorageTraits<Storage>::Tag>()); \
212 VTKM_CONT static WritePortalType CreateWritePortal( \
213 const std::vector<vtkm::cont::internal::Buffer>&, \
214 vtkm::cont::DeviceAdapterId, \
215 vtkm::cont::Token&) \
217 throw vtkm::cont::ErrorBadAllocation( \
218 "Cannot write to arrays with storage type of " + \
219 vtkm::cont::TypeToString<typename vtkm::cont::internal::StorageTraits<Storage>::Tag>()); \
221 using CreateWritePortalEatComma = void
227 #endif //vtk_m_cont_Storage_h