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/resizer.hpp
0004 
0005  [begin_description]
0006  Implementation of the resizers.
0007  [end_description]
0008 
0009  Copyright 2011-2012 Mario Mulansky
0010  Copyright 2011 Karsten Ahnert
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_RESIZER_HPP_INCLUDED
0019 #define BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED
0020 
0021 
0022 #include <boost/numeric/odeint/util/is_resizeable.hpp>
0023 #include <boost/numeric/odeint/util/same_size.hpp>
0024 #include <boost/numeric/odeint/util/resize.hpp>
0025 
0026 namespace boost {
0027 namespace numeric {
0028 namespace odeint {
0029 
0030 template< class ResizeWrappedState , class State >
0031 bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , boost::true_type )
0032 {
0033     if ( !same_size( x.m_v , y ) )
0034     {
0035         resize( x.m_v , y );
0036         return true;
0037     }
0038     else
0039         return false;
0040 }
0041 
0042 template< class ResizeWrappedState , class State >
0043 bool adjust_size_by_resizeability( ResizeWrappedState & /* x */ , const State & /* y */ , boost::false_type )
0044 {
0045     return false;
0046 }
0047 
0048 struct always_resizer
0049 {
0050     template< class State , class ResizeFunction >
0051     bool adjust_size( const State &x , ResizeFunction f )
0052     {
0053         return f( x );
0054     }
0055 };
0056 
0057 
0058 struct initially_resizer
0059 {
0060 
0061     bool m_initialized;
0062 
0063     initially_resizer() : m_initialized( false )
0064     { }
0065 
0066     template< class State , class ResizeFunction >
0067     bool adjust_size( const State &x , ResizeFunction f )
0068     {
0069         if( !m_initialized )
0070         {
0071             m_initialized = true;
0072             return f( x );
0073         } else
0074             return false;
0075     }
0076 };
0077 
0078 
0079 struct never_resizer
0080 {
0081     template< class State , class ResizeFunction >
0082     bool adjust_size( const State &/*x*/ , ResizeFunction /*f*/ )
0083     {
0084         return false;
0085     }
0086 };
0087 
0088 
0089 }
0090 }
0091 }
0092 
0093 #endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED