]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | [auto_generated] | |
3 | boost/numeric/odeint/external/compute/compute_resize.hpp | |
4 | ||
5 | [begin_description] | |
6 | Enable resizing for Boost.Compute vector | |
7 | [end_description] | |
8 | ||
9 | Copyright 2009-2011 Karsten Ahnert | |
10 | Copyright 2009-2011 Mario Mulansky | |
11 | ||
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) | |
15 | */ | |
16 | ||
17 | ||
18 | #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED | |
19 | #define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED | |
20 | ||
21 | #include <boost/compute/container/vector.hpp> | |
22 | ||
23 | #include <boost/numeric/odeint/util/copy.hpp> | |
24 | ||
25 | namespace boost { | |
26 | namespace numeric { | |
27 | namespace odeint { | |
28 | ||
29 | template< class T, class A > | |
30 | struct is_resizeable< boost::compute::vector< T , A > > | |
31 | { | |
32 | struct type : public boost::true_type { }; | |
33 | const static bool value = type::value; | |
34 | }; | |
35 | ||
36 | template< class T, class A > | |
37 | struct same_size_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > > | |
38 | { | |
39 | static bool same_size( const boost::compute::vector< T, A > &x , const boost::compute::vector< T, A > &y ) | |
40 | { | |
41 | return x.size() == y.size(); | |
42 | } | |
43 | }; | |
44 | ||
45 | template< class T, class A > | |
46 | struct resize_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > > | |
47 | { | |
48 | static void resize( boost::compute::vector< T, A > &x , const boost::compute::vector< T, A > &y ) | |
49 | { | |
50 | x.resize( y.size() ); | |
51 | } | |
52 | }; | |
53 | ||
54 | ||
55 | template< class Container1, class T, class A > | |
56 | struct copy_impl< Container1 , boost::compute::vector< T, A > > | |
57 | { | |
58 | static void copy( const Container1 &from , boost::compute::vector< T, A > &to ) | |
59 | { | |
60 | boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) ); | |
61 | } | |
62 | }; | |
63 | ||
64 | template< class T, class A, class Container2 > | |
65 | struct copy_impl< boost::compute::vector< T, A > , Container2 > | |
66 | { | |
67 | static void copy( const boost::compute::vector< T, A > &from , Container2 &to ) | |
68 | { | |
69 | boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) ); | |
70 | } | |
71 | }; | |
72 | ||
73 | template< class T, class A > | |
74 | struct copy_impl< boost::compute::vector< T, A > , boost::compute::vector< T, A > > | |
75 | { | |
76 | static void copy( const boost::compute::vector< T, A > &from , boost::compute::vector< T, A > &to ) | |
77 | { | |
78 | boost::compute::copy( boost::begin( from ) , boost::end( from ) , boost::begin( to ) ); | |
79 | } | |
80 | }; | |
81 | ||
82 | ||
83 | ||
84 | ||
85 | } // odeint | |
86 | } // numeric | |
87 | } // boost | |
88 | ||
89 | ||
90 | #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_RESIZE_HPP_DEFINED |