Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:58

0001 /*
0002  [auto_generated]
0003  boost/numeric/odeint/util/copy.hpp
0004 
0005  [begin_description]
0006  Copy abstraction for the usage in the steppers.
0007  [end_description]
0008 
0009  Copyright 2011-2012 Karsten Ahnert
0010  Copyright 2011-2012 Mario Mulansky
0011 
0012  Distributed under the Boost Software License, Version 1.0.
0013  (See accompanying file LICENSE_1_0.txt or
0014  copy at http://www.boost.org/LICENSE_1_0.txt)
0015  */
0016 
0017 
0018 #ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
0019 #define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
0020 
0021 
0022 #include <boost/range/algorithm/copy.hpp>
0023 
0024 #include <boost/utility/enable_if.hpp>
0025 
0026 #include <boost/numeric/odeint/util/detail/is_range.hpp>
0027 
0028 namespace boost {
0029 namespace numeric {
0030 namespace odeint {
0031 
0032 namespace detail {
0033 
0034     template< class Container1 , class Container2 >
0035     void do_copying( const Container1 &from , Container2 &to , boost::mpl::true_ )
0036     {
0037         boost::range::copy( from , boost::begin( to ) );
0038     }
0039 
0040     template< class Container1 , class Container2 >
0041     void do_copying( const Container1 &from , Container2 &to , boost::mpl::false_ )
0042     {
0043         to = from;
0044     }
0045 
0046 } // namespace detail
0047 
0048 
0049 
0050 /*
0051  * Default implementation of the copy operation used the assign operator
0052  * gsl_vector must copied differently
0053  */
0054 template< class Container1 , class Container2 , class Enabler = void >
0055 struct copy_impl_sfinae
0056 {
0057     static void copy( const Container1 &from , Container2 &to )
0058     {
0059         typedef typename boost::numeric::odeint::detail::is_range< Container1 >::type is_range_type;
0060         detail::do_copying( from , to , is_range_type() );
0061     }
0062 
0063 };
0064 
0065 template< class Container1, class Container2 >
0066 struct copy_impl
0067 {
0068     static void copy( const Container1 &from , Container2 &to )
0069     {
0070         copy_impl_sfinae< Container1 , Container2 >::copy( from , to );
0071     }
0072 };
0073 
0074 // ToDo: allow also to copy INTO a range, not only from a range! Needs "const Container2 &to"
0075 template< class Container1 , class Container2 >
0076 void copy( const Container1 &from , Container2 &to )
0077 {
0078     copy_impl< Container1 , Container2 >::copy( from , to );
0079 }
0080 
0081 
0082 } // namespace odeint
0083 } // namespace numeric
0084 } // namespace boost
0085 
0086 
0087 #endif // BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED