3 boost/numeric/odeint/external/compute/compute_resize.hpp
6 Enable resizing for Boost.Compute vector
9 Copyright 2009-2011 Karsten Ahnert
10 Copyright 2009-2011 Mario Mulansky
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED
19 #define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED
21 #include <boost/compute/container/vector.hpp>
23 #include <boost/numeric/odeint/util/copy.hpp>
29 template< class T, class A >
30 struct is_resizeable< boost::compute::vector< T , A > >
32 struct type : public boost::true_type { };
33 const static bool value = type::value;
36 template< class T, class A >
37 struct same_size_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > >
39 static bool same_size( const boost::compute::vector< T, A > &x , const boost::compute::vector< T, A > &y )
41 return x.size() == y.size();
45 template< class T, class A >
46 struct resize_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > >
48 static void resize( boost::compute::vector< T, A > &x , const boost::compute::vector< T, A > &y )
55 template< class Container1, class T, class A >
56 struct copy_impl< Container1 , boost::compute::vector< T, A > >
58 static void copy( const Container1 &from , boost::compute::vector< T, A > &to )
60 boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
64 template< class T, class A, class Container2 >
65 struct copy_impl< boost::compute::vector< T, A > , Container2 >
67 static void copy( const boost::compute::vector< T, A > &from , Container2 &to )
69 boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
73 template< class T, class A >
74 struct copy_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > >
76 static void copy( const boost::compute::vector< T, A > &from , boost::compute::vector< T, A > &to )
78 boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
90 #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED