annotate DEPENDENCIES/generic/include/boost/numeric/odeint/util/resize.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 /*
Chris@16 2 [auto_generated]
Chris@16 3 boost/numeric/odeint/util/state_wrapper.hpp
Chris@16 4
Chris@16 5 [begin_description]
Chris@16 6 State wrapper for the state type in all stepper. The state wrappers are responsible for construction,
Chris@16 7 destruction, copying construction, assignment and resizing.
Chris@16 8 [end_description]
Chris@16 9
Chris@101 10 Copyright 2011-2013 Karsten Ahnert
Chris@101 11 Copyright 2011 Mario Mulansky
Chris@16 12
Chris@16 13 Distributed under the Boost Software License, Version 1.0.
Chris@16 14 (See accompanying file LICENSE_1_0.txt or
Chris@16 15 copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 16 */
Chris@16 17
Chris@16 18
Chris@16 19 #ifndef BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
Chris@16 20 #define BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
Chris@16 21
Chris@16 22 #include <boost/range.hpp>
Chris@16 23
Chris@16 24 #include <boost/utility/enable_if.hpp>
Chris@16 25 #include <boost/fusion/include/is_sequence.hpp>
Chris@16 26 #include <boost/fusion/include/zip_view.hpp>
Chris@16 27 #include <boost/fusion/include/vector.hpp>
Chris@16 28 #include <boost/fusion/include/make_fused.hpp>
Chris@16 29 #include <boost/fusion/include/for_each.hpp>
Chris@16 30
Chris@16 31 #include <boost/numeric/odeint/util/is_resizeable.hpp>
Chris@16 32
Chris@16 33 namespace boost {
Chris@16 34 namespace numeric {
Chris@16 35 namespace odeint {
Chris@16 36
Chris@101 37
Chris@101 38 template< class StateOut , class StateIn , class Enabler = void >
Chris@101 39 struct resize_impl_sfinae
Chris@101 40 {
Chris@101 41 static void resize( StateOut &x1 , const StateIn &x2 )
Chris@101 42 {
Chris@101 43 x1.resize( boost::size( x2 ) );
Chris@101 44 }
Chris@101 45 };
Chris@101 46
Chris@16 47 // resize function
Chris@16 48 // standard implementation relies on boost.range and resize member function
Chris@101 49 template< class StateOut , class StateIn >
Chris@16 50 struct resize_impl
Chris@16 51 {
Chris@16 52 static void resize( StateOut &x1 , const StateIn &x2 )
Chris@16 53 {
Chris@101 54 resize_impl_sfinae< StateOut , StateIn >::resize( x1 , x2 );
Chris@16 55 }
Chris@16 56 };
Chris@16 57
Chris@16 58
Chris@16 59 // do not overload or specialize this function, specialize resize_impl<> instead
Chris@16 60 template< class StateOut , class StateIn >
Chris@16 61 void resize( StateOut &x1 , const StateIn &x2 )
Chris@16 62 {
Chris@16 63 resize_impl< StateOut , StateIn >::resize( x1 , x2 );
Chris@16 64 }
Chris@16 65
Chris@16 66
Chris@16 67 namespace detail {
Chris@16 68
Chris@16 69 struct resizer
Chris@16 70 {
Chris@16 71 typedef void result_type;
Chris@16 72
Chris@16 73 template< class StateOut , class StateIn >
Chris@16 74 void operator()( StateOut &x1 , const StateIn &x2 ) const
Chris@16 75 {
Chris@16 76 resize_op( x1 , x2 , typename is_resizeable< StateOut >::type() );
Chris@16 77 }
Chris@16 78
Chris@16 79 template< class StateOut , class StateIn >
Chris@16 80 void resize_op( StateOut &x1 , const StateIn &x2 , boost::true_type ) const
Chris@16 81 {
Chris@16 82 resize( x1 , x2 );
Chris@16 83 }
Chris@16 84
Chris@16 85 template< class StateOut , class StateIn >
Chris@16 86 void resize_op( StateOut &x1 , const StateIn &x2 , boost::false_type ) const
Chris@16 87 {
Chris@16 88 }
Chris@16 89
Chris@16 90 };
Chris@16 91 } // namespace detail
Chris@16 92
Chris@16 93
Chris@16 94 /*
Chris@16 95 * specialization for fusion sequences
Chris@16 96 */
Chris@16 97 template< class FusionSeq >
Chris@101 98 struct resize_impl_sfinae< FusionSeq , FusionSeq ,
Chris@101 99 typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type >
Chris@16 100 {
Chris@16 101 static void resize( FusionSeq &x1 , const FusionSeq &x2 )
Chris@16 102 {
Chris@16 103 typedef boost::fusion::vector< FusionSeq& , const FusionSeq& > Sequences;
Chris@16 104 Sequences sequences( x1 , x2 );
Chris@16 105 boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( detail::resizer() ) );
Chris@16 106 }
Chris@16 107 };
Chris@16 108
Chris@16 109
Chris@16 110
Chris@16 111
Chris@16 112 }
Chris@16 113 }
Chris@16 114 }
Chris@16 115
Chris@16 116
Chris@16 117
Chris@16 118 #endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED