9
3

vexcl_resize.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/external/vexcl/vexcl_resize.hpp
  4. [begin_description]
  5. Enable resizing for vexcl vector and multivector.
  6. [end_description]
  7. Copyright 2012 Karsten Ahnert
  8. Copyright 2012 Mario Mulansky
  9. Copyright 2012 Denis Demidov
  10. Distributed under the Boost Software License, Version 1.0.
  11. (See accompanying file LICENSE_1_0.txt or
  12. copy at http://www.boost.org/LICENSE_1_0.txt)
  13. */
  14. #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED
  15. #define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED
  16. #include <vexcl/vector.hpp>
  17. #include <vexcl/multivector.hpp>
  18. #include <boost/numeric/odeint/util/is_resizeable.hpp>
  19. #include <boost/numeric/odeint/util/resize.hpp>
  20. #include <boost/numeric/odeint/util/same_size.hpp>
  21. namespace boost {
  22. namespace numeric {
  23. namespace odeint {
  24. /*
  25. * specializations for vex::vector< T >
  26. */
  27. template< typename T >
  28. struct is_resizeable< vex::vector< T > > : boost::true_type { };
  29. template< typename T >
  30. struct resize_impl< vex::vector< T > , vex::vector< T > >
  31. {
  32. static void resize( vex::vector< T > &x1 , const vex::vector< T > &x2 )
  33. {
  34. x1.resize( x2.queue_list() , x2.size() );
  35. }
  36. };
  37. template< typename T >
  38. struct same_size_impl< vex::vector< T > , vex::vector< T > >
  39. {
  40. static bool same_size( const vex::vector< T > &x1 , const vex::vector< T > &x2 )
  41. {
  42. return x1.size() == x2.size();
  43. }
  44. };
  45. /*
  46. * specializations for vex::multivector< T >
  47. */
  48. template< typename T , size_t N >
  49. struct is_resizeable< vex::multivector< T , N > > : boost::true_type { };
  50. template< typename T , size_t N >
  51. struct resize_impl< vex::multivector< T , N > , vex::multivector< T , N > >
  52. {
  53. static void resize( vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 )
  54. {
  55. x1.resize( x2.queue_list() , x2.size() );
  56. }
  57. };
  58. template< typename T , size_t N >
  59. struct same_size_impl< vex::multivector< T , N > , vex::multivector< T , N > >
  60. {
  61. static bool same_size( const vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 )
  62. {
  63. return x1.size() == x2.size();
  64. }
  65. };
  66. } // namespace odeint
  67. } // namespace numeric
  68. } // namespace boost
  69. #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED