File indexing completed on 2025-07-11 08:18:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
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 #include <type_traits>
0026
0027 namespace boost {
0028 namespace numeric {
0029 namespace odeint {
0030
0031 template< class ResizeWrappedState , class State >
0032 bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , std::true_type )
0033 {
0034 if ( !same_size( x.m_v , y ) )
0035 {
0036 resize( x.m_v , y );
0037 return true;
0038 }
0039 else
0040 return false;
0041 }
0042
0043 template< class ResizeWrappedState , class State >
0044 bool adjust_size_by_resizeability( ResizeWrappedState & , const State & , std::false_type )
0045 {
0046 return false;
0047 }
0048
0049 struct always_resizer
0050 {
0051 template< class State , class ResizeFunction >
0052 bool adjust_size( const State &x , ResizeFunction f )
0053 {
0054 return f( x );
0055 }
0056 };
0057
0058
0059 struct initially_resizer
0060 {
0061
0062 bool m_initialized;
0063
0064 initially_resizer() : m_initialized( false )
0065 { }
0066
0067 template< class State , class ResizeFunction >
0068 bool adjust_size( const State &x , ResizeFunction f )
0069 {
0070 if( !m_initialized )
0071 {
0072 m_initialized = true;
0073 return f( x );
0074 } else
0075 return false;
0076 }
0077 };
0078
0079
0080 struct never_resizer
0081 {
0082 template< class State , class ResizeFunction >
0083 bool adjust_size( const State & , ResizeFunction )
0084 {
0085 return false;
0086 }
0087 };
0088
0089
0090 }
0091 }
0092 }
0093
0094 #endif