3 boost/numeric/odeint/stepper/detail/rotating_buffer.hpp
6 Implemetation of a rotating (cyclic) buffer for use in the Adam Bashforth stepper
9 Copyright 2011 Karsten Ahnert
10 Copyright 2011 Mario Mulansky
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)
18 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
21 #include <boost/array.hpp>
28 template< class T , size_t N >
34 const static size_t dim = N;
36 rotating_buffer( void ) : m_first( 0 )
39 size_t size( void ) const
44 value_type& operator[]( size_t i )
46 return m_data[ get_index( i ) ];
49 const value_type& operator[]( size_t i ) const
51 return m_data[ get_index( i ) ];
68 size_t get_index( size_t i ) const
70 return ( ( i + m_first ) % dim );
84 #endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED