Skip to content

Add standard support for read-only storage

Kenneth Moreland requested to merge kmorel/vtk-m:release-read-only into master

Many of the fancy ArrayHandles are read-only and therefore connot really create write portals. Likewise, many ArrayHandles (both read- only and read/write) have no way to resize themselves. In this case, implementing the CreateWritePortal and ResizeBuffers methods in the Storage class was troublesome. Mostly they just threw an exception, but they also sometimes had to deal with cases where the behavior was allowed.

To simplify code for developers, this introduces a pair of macros: VTKM_STORAGE_NO_RESIZE and VTKM_STORAGE_NO_WRITE_PORTAL. These can be declared in a Storage implementation when the storage has no viable way to resize itself and create a write portal, respectively.

Having boilerplate code for these methods also helps work around expected behavior for ResizeBuffers. ResizeBuffers should silently work when resizing to the same size. Also ResizeBuffers should behave well when resizing to 0 as that is what ReleaseResources does.

Merge request reports

Loading