vexcl_resize.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 <type_traits>
  17. #include <vexcl/vector.hpp>
  18. #include <vexcl/multivector.hpp>
  19. #include <boost/numeric/odeint/util/is_resizeable.hpp>
  20. #include <boost/numeric/odeint/util/resize.hpp>
  21. #include <boost/numeric/odeint/util/same_size.hpp>
  22. namespace boost {
  23. namespace numeric {
  24. namespace odeint {
  25. /*
  26. * specializations for vex::vector< T >
  27. */
  28. template< typename T >
  29. struct is_resizeable< vex::vector< T > > : std::true_type { };
  30. template< typename T >
  31. struct resize_impl< vex::vector< T > , vex::vector< T > >
  32. {
  33. static void resize( vex::vector< T > &x1 , const vex::vector< T > &x2 )
  34. {
  35. x1.resize( x2.queue_list() , x2.size() );
  36. }
  37. };
  38. template< typename T >
  39. struct same_size_impl< vex::vector< T > , vex::vector< T > >
  40. {
  41. static bool same_size( const vex::vector< T > &x1 , const vex::vector< T > &x2 )
  42. {
  43. return x1.size() == x2.size();
  44. }
  45. };
  46. /*
  47. * specializations for vex::multivector< T >
  48. */
  49. template< typename T , size_t N >
  50. struct is_resizeable< vex::multivector< T , N > > : std::true_type { };
  51. template< typename T , size_t N >
  52. struct resize_impl< vex::multivector< T , N > , vex::multivector< T , N > >
  53. {
  54. static void resize( vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 )
  55. {
  56. x1.resize( x2.queue_list() , x2.size() );
  57. }
  58. };
  59. template< typename T , size_t N >
  60. struct same_size_impl< vex::multivector< T , N > , vex::multivector< T , N > >
  61. {
  62. static bool same_size( const vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 )
  63. {
  64. return x1.size() == x2.size();
  65. }
  66. };
  67. } // namespace odeint
  68. } // namespace numeric
  69. } // namespace boost
  70. #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED