Chris@16
|
1 /*
|
Chris@16
|
2 [auto_generated]
|
Chris@16
|
3 boost/numeric/odeint/util/copy.hpp
|
Chris@16
|
4
|
Chris@16
|
5 [begin_description]
|
Chris@16
|
6 Copy abstraction for the usage in the steppers.
|
Chris@16
|
7 [end_description]
|
Chris@16
|
8
|
Chris@16
|
9 Copyright 2009-2011 Karsten Ahnert
|
Chris@16
|
10 Copyright 2009-2011 Mario Mulansky
|
Chris@16
|
11
|
Chris@16
|
12 Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
13 (See accompanying file LICENSE_1_0.txt or
|
Chris@16
|
14 copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
15 */
|
Chris@16
|
16
|
Chris@16
|
17
|
Chris@16
|
18 #ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
|
Chris@16
|
19 #define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
|
Chris@16
|
20
|
Chris@16
|
21
|
Chris@16
|
22 #include <boost/range/algorithm/copy.hpp>
|
Chris@16
|
23
|
Chris@16
|
24 #include <boost/utility/enable_if.hpp>
|
Chris@16
|
25
|
Chris@16
|
26 #include <boost/numeric/odeint/util/detail/is_range.hpp>
|
Chris@16
|
27
|
Chris@16
|
28 namespace boost {
|
Chris@16
|
29 namespace numeric {
|
Chris@16
|
30 namespace odeint {
|
Chris@16
|
31
|
Chris@16
|
32 namespace detail {
|
Chris@16
|
33
|
Chris@16
|
34 template< class Container1 , class Container2 >
|
Chris@16
|
35 void do_copying( const Container1 &from , Container2 &to , boost::mpl::true_ )
|
Chris@16
|
36 {
|
Chris@16
|
37 boost::range::copy( from , boost::begin( to ) );
|
Chris@16
|
38 }
|
Chris@16
|
39
|
Chris@16
|
40 template< class Container1 , class Container2 >
|
Chris@16
|
41 void do_copying( const Container1 &from , Container2 &to , boost::mpl::false_ )
|
Chris@16
|
42 {
|
Chris@16
|
43 to = from;
|
Chris@16
|
44 }
|
Chris@16
|
45
|
Chris@16
|
46 } // namespace detail
|
Chris@16
|
47
|
Chris@16
|
48
|
Chris@16
|
49 /*
|
Chris@16
|
50 * Default implementation of the copy operation used the assign operator
|
Chris@16
|
51 * gsl_vector must copied differently
|
Chris@16
|
52 */
|
Chris@16
|
53 template< class Container1, class Container2 , class Enabler = void >
|
Chris@16
|
54 struct copy_impl
|
Chris@16
|
55 {
|
Chris@16
|
56 static void copy( const Container1 &from , Container2 &to )
|
Chris@16
|
57 {
|
Chris@16
|
58 typedef typename boost::numeric::odeint::detail::is_range< Container1 >::type is_range_type;
|
Chris@16
|
59 detail::do_copying( from , to , is_range_type() );
|
Chris@16
|
60 }
|
Chris@16
|
61 };
|
Chris@16
|
62
|
Chris@16
|
63 template< class Container1 , class Container2 >
|
Chris@16
|
64 void copy( const Container1 &from , Container2 &to )
|
Chris@16
|
65 {
|
Chris@16
|
66 copy_impl< Container1 , Container2 >::copy( from , to );
|
Chris@16
|
67 }
|
Chris@16
|
68
|
Chris@16
|
69
|
Chris@16
|
70 } // namespace odeint
|
Chris@16
|
71 } // namespace numeric
|
Chris@16
|
72 } // namespace boost
|
Chris@16
|
73
|
Chris@16
|
74
|
Chris@16
|
75 #endif // BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
|