]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/compute/include/boost/compute/interop/vtk/data_array.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / interop / vtk / data_array.hpp
CommitLineData
7c673cae
FG
1//---------------------------------------------------------------------------//
2// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
3//
4// Distributed under the Boost Software License, Version 1.0
5// See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt
7//
8// See http://boostorg.github.com/compute for more information.
9//---------------------------------------------------------------------------//
10
11#ifndef BOOST_COMPUTE_INTEROP_VTK_DATA_ARRAY_HPP
12#define BOOST_COMPUTE_INTEROP_VTK_DATA_ARRAY_HPP
13
14#include <vtkDataArray.h>
15#include <vtkDataArrayTemplate.h>
16
17#include <boost/compute/system.hpp>
18#include <boost/compute/command_queue.hpp>
19#include <boost/compute/algorithm/copy.hpp>
20#include <boost/compute/algorithm/copy_n.hpp>
21#include <boost/compute/iterator/buffer_iterator.hpp>
22
23namespace boost {
24namespace compute {
25
26/// Copies the values in \p data to \p buffer.
27template<class T>
28inline void vtk_copy_data_array_to_buffer(const vtkDataArray *data,
29 buffer_iterator<T> buffer,
30 command_queue &queue = system::default_queue());
31
32/// \internal_
33template<class T>
34inline void vtk_copy_data_array_to_buffer(const vtkDataArrayTemplate<T> *data,
35 buffer_iterator<T> buffer,
36 command_queue &queue = system::default_queue())
37{
38 vtkDataArrayTemplate<T> *data_ = const_cast<vtkDataArrayTemplate<T> *>(data);
39 const T *data_ptr = static_cast<const T *>(data_->GetVoidPointer(0));
40 size_t data_size = data_->GetNumberOfComponents() * data_->GetNumberOfTuples();
41 ::boost::compute::copy_n(data_ptr, data_size, buffer, queue);
42}
43
44/// Copies the values in the range [\p first, \p last) to \p data.
45template<class T>
46inline void vtk_copy_buffer_to_data_array(buffer_iterator<T> first,
47 buffer_iterator<T> last,
48 vtkDataArray *data,
49 command_queue &queue = system::default_queue());
50
51/// \internal_
52template<class T>
53inline void vtk_copy_buffer_to_data_array(buffer_iterator<T> first,
54 buffer_iterator<T> last,
55 vtkDataArrayTemplate<T> *data,
56 command_queue &queue = system::default_queue())
57{
58 T *data_ptr = static_cast<T *>(data->GetVoidPointer(0));
59 ::boost::compute::copy(first, last, data_ptr, queue);
60}
61
62} // end compute namespace
63} // end boost namespace
64
65#endif // BOOST_COMPUTE_INTEROP_VTK_DATA_ARRAY_HPP