File indexing completed on 2025-01-18 09:30:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_INTEROP_VTK_DATA_ARRAY_HPP
0012 #define BOOST_COMPUTE_INTEROP_VTK_DATA_ARRAY_HPP
0013
0014 #include <vtkDataArray.h>
0015 #include <vtkDataArrayTemplate.h>
0016
0017 #include <boost/compute/system.hpp>
0018 #include <boost/compute/command_queue.hpp>
0019 #include <boost/compute/algorithm/copy.hpp>
0020 #include <boost/compute/algorithm/copy_n.hpp>
0021 #include <boost/compute/iterator/buffer_iterator.hpp>
0022
0023 namespace boost {
0024 namespace compute {
0025
0026
0027 template<class T>
0028 inline void vtk_copy_data_array_to_buffer(const vtkDataArray *data,
0029 buffer_iterator<T> buffer,
0030 command_queue &queue = system::default_queue());
0031
0032
0033 template<class T>
0034 inline void vtk_copy_data_array_to_buffer(const vtkDataArrayTemplate<T> *data,
0035 buffer_iterator<T> buffer,
0036 command_queue &queue = system::default_queue())
0037 {
0038 vtkDataArrayTemplate<T> *data_ = const_cast<vtkDataArrayTemplate<T> *>(data);
0039 const T *data_ptr = static_cast<const T *>(data_->GetVoidPointer(0));
0040 size_t data_size = data_->GetNumberOfComponents() * data_->GetNumberOfTuples();
0041 ::boost::compute::copy_n(data_ptr, data_size, buffer, queue);
0042 }
0043
0044
0045 template<class T>
0046 inline void vtk_copy_buffer_to_data_array(buffer_iterator<T> first,
0047 buffer_iterator<T> last,
0048 vtkDataArray *data,
0049 command_queue &queue = system::default_queue());
0050
0051
0052 template<class T>
0053 inline void vtk_copy_buffer_to_data_array(buffer_iterator<T> first,
0054 buffer_iterator<T> last,
0055 vtkDataArrayTemplate<T> *data,
0056 command_queue &queue = system::default_queue())
0057 {
0058 T *data_ptr = static_cast<T *>(data->GetVoidPointer(0));
0059 ::boost::compute::copy(first, last, data_ptr, queue);
0060 }
0061
0062 }
0063 }
0064
0065 #endif