整理
This commit is contained in:
127
include/boost/numeric/odeint/util/detail/is_range.hpp
Normal file
127
include/boost/numeric/odeint/util/detail/is_range.hpp
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/util/detail/is_range.hpp
|
||||
|
||||
[begin_description]
|
||||
is_range implementation. Taken from the boost::range library.
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2013 Karsten Ahnert
|
||||
Copyright 2011-2013 Thorsten Ottosen
|
||||
|
||||
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/numeric/odeint/tools/traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
namespace detail {
|
||||
|
||||
BOOST_NUMERIC_ODEINT_HAS_NAMED_TRAIT(has_iterator, iterator);
|
||||
BOOST_NUMERIC_ODEINT_HAS_NAMED_TRAIT(has_const_iterator, const_iterator);
|
||||
|
||||
template< typename Range >
|
||||
struct is_range : std::integral_constant<bool, (has_iterator<Range>::value && has_const_iterator<Range>::value)>
|
||||
{
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// pair
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename iteratorT >
|
||||
struct is_range< std::pair<iteratorT,iteratorT> > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template< typename iteratorT >
|
||||
struct is_range< const std::pair<iteratorT,iteratorT> > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// array
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename elementT, std::size_t sz >
|
||||
struct is_range< elementT[sz] > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template< typename elementT, std::size_t sz >
|
||||
struct is_range< const elementT[sz] > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// string
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<>
|
||||
struct is_range< char* > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_range< wchar_t* > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_range< const char* > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_range< const wchar_t* > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_range< char* const > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_range< wchar_t* const > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_range< const char* const > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_range< const wchar_t* const > : std::integral_constant<bool, true>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED
|
||||
78
include/boost/numeric/odeint/util/detail/less_with_sign.hpp
Normal file
78
include/boost/numeric/odeint/util/detail/less_with_sign.hpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/util/detail/less_with_sign.hpp
|
||||
|
||||
[begin_description]
|
||||
Helper function to compare times taking into account the sign of dt
|
||||
[end_description]
|
||||
|
||||
Copyright 2012-2015 Mario Mulansky
|
||||
Copyright 2012 Karsten Ahnert
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_LESS_WITH_SIGN_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_LESS_WITH_SIGN_HPP_INCLUDED
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <boost/numeric/odeint/util/unit_helper.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* return t1 < t2 if dt > 0 and t1 > t2 if dt < 0 with epsilon accuracy
|
||||
*/
|
||||
template< typename T >
|
||||
bool less_with_sign( T t1 , T t2 , T dt )
|
||||
{
|
||||
if( get_unit_value(dt) > 0 )
|
||||
//return t1 < t2;
|
||||
return t2-t1 > std::numeric_limits<T>::epsilon();
|
||||
else
|
||||
//return t1 > t2;
|
||||
return t1-t2 > std::numeric_limits<T>::epsilon();
|
||||
}
|
||||
|
||||
/**
|
||||
* return t1 <= t2 if dt > 0 and t1 => t2 if dt < 0 with epsilon accuracy
|
||||
*/
|
||||
template< typename T >
|
||||
bool less_eq_with_sign( T t1 , T t2 , T dt )
|
||||
{
|
||||
if( get_unit_value(dt) > 0 )
|
||||
return t1-t2 <= std::numeric_limits<T>::epsilon();
|
||||
else
|
||||
return t2-t1 <= std::numeric_limits<T>::epsilon();
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
T min_abs( T t1 , T t2 )
|
||||
{
|
||||
BOOST_USING_STD_MIN();
|
||||
BOOST_USING_STD_MAX();
|
||||
if( get_unit_value(t1)>0 )
|
||||
return min BOOST_PREVENT_MACRO_SUBSTITUTION ( t1 , t2 );
|
||||
else
|
||||
return max BOOST_PREVENT_MACRO_SUBSTITUTION ( t1 , t2 );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
T max_abs( T t1 , T t2 )
|
||||
{
|
||||
BOOST_USING_STD_MIN();
|
||||
BOOST_USING_STD_MAX();
|
||||
if( get_unit_value(t1)>0 )
|
||||
return max BOOST_PREVENT_MACRO_SUBSTITUTION ( t1 , t2 );
|
||||
else
|
||||
return min BOOST_PREVENT_MACRO_SUBSTITUTION ( t1 , t2 );
|
||||
}
|
||||
} } } }
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user