compute_resize.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/external/compute/compute_resize.hpp
  4. [begin_description]
  5. Enable resizing for Boost.Compute vector
  6. [end_description]
  7. Copyright 2009-2011 Karsten Ahnert
  8. Copyright 2009-2011 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED
  14. #define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED
  15. #include <boost/compute/container/vector.hpp>
  16. #include <boost/numeric/odeint/util/copy.hpp>
  17. namespace boost {
  18. namespace numeric {
  19. namespace odeint {
  20. template< class T, class A >
  21. struct is_resizeable< boost::compute::vector< T , A > >
  22. {
  23. struct type : public boost::true_type { };
  24. const static bool value = type::value;
  25. };
  26. template< class T, class A >
  27. struct same_size_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > >
  28. {
  29. static bool same_size( const boost::compute::vector< T, A > &x , const boost::compute::vector< T, A > &y )
  30. {
  31. return x.size() == y.size();
  32. }
  33. };
  34. template< class T, class A >
  35. struct resize_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > >
  36. {
  37. static void resize( boost::compute::vector< T, A > &x , const boost::compute::vector< T, A > &y )
  38. {
  39. x.resize( y.size() );
  40. }
  41. };
  42. template< class Container1, class T, class A >
  43. struct copy_impl< Container1 , boost::compute::vector< T, A > >
  44. {
  45. static void copy( const Container1 &from , boost::compute::vector< T, A > &to )
  46. {
  47. boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
  48. }
  49. };
  50. template< class T, class A, class Container2 >
  51. struct copy_impl< boost::compute::vector< T, A > , Container2 >
  52. {
  53. static void copy( const boost::compute::vector< T, A > &from , Container2 &to )
  54. {
  55. boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
  56. }
  57. };
  58. template< class T, class A >
  59. struct copy_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > >
  60. {
  61. static void copy( const boost::compute::vector< T, A > &from , boost::compute::vector< T, A > &to )
  62. {
  63. boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) );
  64. }
  65. };
  66. } // odeint
  67. } // numeric
  68. } // boost
  69. #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED