mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-20 11:05:44 +00:00
64958b014b
The original design of invoke and the transport infrastructure relied on the implementation behavior of vtkm::cont types such as ArrayHandle that used an internal shared_ptr to managed state. This allowed passing by value instead of passing by non-const ref when needing to transfer information to the device. As VTK-m adds support for classes that use virtuals the ability to pass by base pointer type allows for us to invoke worklets using a base type without the risk of type slicing. Additional by moving over to a non-const ref Invocation we can update all transports that have 'output' to now be by ref and therefore support types that can't be copied while being 'more' correct.
646 B
646 B
VTK-m now supports dispatcher parameters being pointers
Previously it was only possible to pass values to a dispatcher when you wanted to invoke a VTK-m worklet. This caused problems when it came to designing new types that used inheritance as the types couldn't be past as the base type to the dispatcher. To fix this issue we now support invoking worklets with pointers as seen below.
vtkm::cont::ArrayHandle<T> input;
//fill input
vtkm::cont::ArrayHandle<T> output;
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
dispatcher(&input, output);
dispatcher(input, &output);
dispatcher(&input, &output);