3 boost/numeric/odeint/external/vexcl/vexcl_resize.hpp
6 Enable resizing for vexcl vector and multivector.
9 Copyright 2012 Karsten Ahnert
10 Copyright 2012 Mario Mulansky
11 Copyright 2012 Denis Demidov
13 Distributed under the Boost Software License, Version 1.0.
14 (See accompanying file LICENSE_1_0.txt or
15 copy at http://www.boost.org/LICENSE_1_0.txt)
19 #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED
20 #define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED
22 #include <vexcl/vector.hpp>
23 #include <vexcl/multivector.hpp>
25 #include <boost/numeric/odeint/util/is_resizeable.hpp>
26 #include <boost/numeric/odeint/util/resize.hpp>
27 #include <boost/numeric/odeint/util/same_size.hpp>
36 * specializations for vex::vector< T >
38 template< typename T >
39 struct is_resizeable< vex::vector< T > > : boost::true_type { };
41 template< typename T >
42 struct resize_impl< vex::vector< T > , vex::vector< T > >
44 static void resize( vex::vector< T > &x1 , const vex::vector< T > &x2 )
46 x1.resize( x2.queue_list() , x2.size() );
50 template< typename T >
51 struct same_size_impl< vex::vector< T > , vex::vector< T > >
53 static bool same_size( const vex::vector< T > &x1 , const vex::vector< T > &x2 )
55 return x1.size() == x2.size();
64 * specializations for vex::multivector< T >
66 template< typename T , size_t N >
67 struct is_resizeable< vex::multivector< T , N > > : boost::true_type { };
69 template< typename T , size_t N >
70 struct resize_impl< vex::multivector< T , N > , vex::multivector< T , N > >
72 static void resize( vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 )
74 x1.resize( x2.queue_list() , x2.size() );
78 template< typename T , size_t N >
79 struct same_size_impl< vex::multivector< T , N > , vex::multivector< T , N > >
81 static bool same_size( const vex::multivector< T , N > &x1 , const vex::multivector< T , N > &x2 )
83 return x1.size() == x2.size();
89 } // namespace numeric
94 #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED