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/state_wrapper.hpp
0004 
0005  [begin_description]
0006  State wrapper for the state type in all stepper. The state wrappers are responsible for construction,
0007  destruction, copying construction, assignment and resizing.
0008  [end_description]
0009 
0010  Copyright 2011-2013 Karsten Ahnert
0011  Copyright 2011 Mario Mulansky
0012 
0013  Distributed under the Boost Software License, Version 1.0.
0014  (See accompanying file LICENSE_1_0.txt or
0015  copy at http://www.boost.org/LICENSE_1_0.txt)
0016  */
0017 
0018 
0019 #ifndef BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
0020 #define BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
0021 
0022 #include <boost/range.hpp>
0023 
0024 #include <boost/utility/enable_if.hpp>
0025 #include <boost/fusion/include/is_sequence.hpp>
0026 #include <boost/fusion/include/zip_view.hpp>
0027 #include <boost/fusion/include/vector.hpp>
0028 #include <boost/fusion/include/make_fused.hpp>
0029 #include <boost/fusion/include/for_each.hpp>
0030 
0031 #include <boost/numeric/odeint/util/is_resizeable.hpp>
0032 
0033 namespace boost {
0034 namespace numeric {
0035 namespace odeint {
0036 
0037 
0038 template< class StateOut , class StateIn , class Enabler = void >
0039 struct resize_impl_sfinae
0040 {
0041     static void resize( StateOut &x1 , const StateIn &x2 )
0042     {
0043         x1.resize( boost::size( x2 ) );
0044     }
0045 };
0046 
0047 // resize function
0048 // standard implementation relies on boost.range and resize member function
0049 template< class StateOut , class StateIn >
0050 struct resize_impl
0051 {
0052     static void resize( StateOut &x1 , const StateIn &x2 )
0053     {
0054         resize_impl_sfinae< StateOut , StateIn >::resize( x1 , x2 );
0055     }
0056 };
0057 
0058 
0059 // do not overload or specialize this function, specialize resize_impl<> instead
0060 template< class StateOut , class StateIn >
0061 void resize( StateOut &x1 , const StateIn &x2 )
0062 {
0063     resize_impl< StateOut , StateIn >::resize( x1 , x2 );
0064 }
0065 
0066 
0067 namespace detail {
0068 
0069     struct resizer
0070     {
0071         typedef void result_type;
0072 
0073         template< class StateOut , class StateIn >
0074         void operator()( StateOut &x1 , const StateIn &x2 ) const
0075         {
0076             resize_op( x1 , x2 , typename is_resizeable< StateOut >::type() );
0077         }
0078 
0079         template< class StateOut , class StateIn >
0080         void resize_op( StateOut &x1 , const StateIn &x2 , boost::true_type ) const
0081         {
0082             resize( x1 , x2 );
0083         }
0084 
0085         template< class StateOut , class StateIn >
0086         void resize_op( StateOut &/*x1*/ , const StateIn &/*x2*/ , boost::false_type ) const
0087         {
0088         }
0089 
0090     };
0091 } // namespace detail
0092 
0093 
0094 /*
0095  * specialization for fusion sequences
0096  */
0097 template< class FusionSeq >
0098 struct resize_impl_sfinae< FusionSeq , FusionSeq ,
0099     typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type >
0100 {
0101     static void resize( FusionSeq &x1 , const FusionSeq &x2 )
0102     {
0103         typedef boost::fusion::vector< FusionSeq& , const FusionSeq& > Sequences;
0104         Sequences sequences( x1 , x2 );
0105         boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( detail::resizer() ) );
0106     }
0107 };
0108 
0109 
0110 
0111 
0112 }
0113 }
0114 }
0115 
0116 
0117 
0118 #endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED