2
0
mirror of https://github.com/boostorg/odeint.git synced 2026-01-19 04:22:12 +00:00

Remove usages of boost::mpl::bool

This commit is contained in:
Matt Borland
2023-12-20 17:02:29 +01:00
parent 7d91d3fb30
commit 91712beba2
5 changed files with 34 additions and 23 deletions

View File

@@ -54,7 +54,7 @@ Symplectic systems are used in symplectic steppers like `symplectic_rkn_sb3a_mcl
[table
[[Name] [Expression] [Type] [Semantics]]
[[Check for pair] [`boost::is_pair< System >::type`] [`boost::mpl::true_`] [Check if System is a pair]]
[[Check for pair] [`boost::is_pair< System >::type`] [`std::integral_constant<bool, true>`] [Check if System is a pair]]
[[Calculate ['dq/dt = f(p)]] [`sys.first( p , dqdt )`] [`void`] [Calculates ['f(p)], the result is stored into `dqdt`] ]
[[Calculate ['dp/dt = g(q)]] [`sys.second( q , dpdt )`] [`void`] [Calculates ['g(q)], the result is stored into `dpdt`] ]
]
@@ -92,7 +92,7 @@ We call this concept ['SimpleSymplecticSystem]
[table
[[Name] [Expression] [Type] [Semantics]]
[[Check for pair] [`boost::is_pair< System >::type`] [`boost::mpl::false_`] [Check if System is a pair, should be evaluated to false in this case.]]
[[Check for pair] [`boost::is_pair< System >::type`] [`std::integral_constant<bool, false>`] [Check if System is a pair, should be evaluated to false in this case.]]
[[Calculate ['dp/dt = g(q)]] [`sys( q , dpdt )`] [`void`] [Calculates ['g(q)], the result is stored into `dpdt`] ]
]

View File

@@ -20,6 +20,7 @@
#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_SYMPLECTIC_RKN_STEPPER_BASE_HPP_INCLUDED
#include <array>
#include <type_traits>
#include <boost/numeric/odeint/util/bind.hpp>
#include <boost/numeric/odeint/util/unwrap_reference.hpp>
@@ -182,7 +183,7 @@ private:
// stepper for systems with function for dq/dt = f(p) and dp/dt = -f(q)
template< class System , class StateIn , class StateOut >
void do_step_impl( System system , const StateIn &in , time_type /* t */ , StateOut &out , time_type dt , boost::mpl::true_ )
void do_step_impl( System system , const StateIn &in , time_type /* t */ , StateOut &out , time_type dt , std::integral_constant<bool, true> )
{
typedef typename odeint::unwrap_reference< System >::type system_type;
typedef typename odeint::unwrap_reference< typename system_type::first_type >::type coor_deriv_func_type;
@@ -236,7 +237,7 @@ private:
// stepper for systems with only function dp /dt = -f(q), dq/dt = p, time not required but still expected for compatibility reasons
template< class System , class StateIn , class StateOut >
void do_step_impl( System system , const StateIn &in , time_type /* t */ , StateOut &out , time_type dt , boost::mpl::false_ )
void do_step_impl( System system , const StateIn &in , time_type /* t */ , StateOut &out , time_type dt , std::integral_constant<bool, false> )
{
typedef typename odeint::unwrap_reference< System >::type momentum_deriv_func_type;
momentum_deriv_func_type &momentum_func = system;

View File

@@ -18,6 +18,7 @@
#ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
#include <type_traits>
#include <boost/range/algorithm/copy.hpp>
@@ -43,6 +44,18 @@ namespace detail {
to = from;
}
template< class Container1 , class Container2 >
void do_copying( const Container1 &from , Container2 &to , std::integral_constant<bool, true>)
{
boost::range::copy( from , boost::begin( to ) );
}
template< class Container1 , class Container2 >
void do_copying( const Container1 &from , Container2 &to , std::integral_constant<bool, false>)
{
to = from;
}
} // namespace detail

View File

@@ -26,9 +26,9 @@
#endif
#include <cstddef>
#include <type_traits>
#include <boost/range/config.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/and.hpp>
namespace boost {
@@ -56,12 +56,12 @@ struct is_range : boost::mpl::and_<range_detail::has_iterator<Range>, range_deta
//////////////////////////////////////////////////////////////////////////
template< typename iteratorT >
struct is_range< std::pair<iteratorT,iteratorT> > : boost::mpl::true_
struct is_range< std::pair<iteratorT,iteratorT> > : std::integral_constant<bool, true>
{
};
template< typename iteratorT >
struct is_range< const std::pair<iteratorT,iteratorT> > : boost::mpl::true_
struct is_range< const std::pair<iteratorT,iteratorT> > : std::integral_constant<bool, true>
{
};
@@ -70,12 +70,12 @@ struct is_range< const std::pair<iteratorT,iteratorT> > : boost::mpl::true_
//////////////////////////////////////////////////////////////////////////
template< typename elementT, std::size_t sz >
struct is_range< elementT[sz] > : boost::mpl::true_
struct is_range< elementT[sz] > : std::integral_constant<bool, true>
{
};
template< typename elementT, std::size_t sz >
struct is_range< const elementT[sz] > : boost::mpl::true_
struct is_range< const elementT[sz] > : std::integral_constant<bool, true>
{
};
@@ -84,42 +84,42 @@ struct is_range< const elementT[sz] > : boost::mpl::true_
//////////////////////////////////////////////////////////////////////////
template<>
struct is_range< char* > : boost::mpl::true_
struct is_range< char* > : std::integral_constant<bool, true>
{
};
template<>
struct is_range< wchar_t* > : boost::mpl::true_
struct is_range< wchar_t* > : std::integral_constant<bool, true>
{
};
template<>
struct is_range< const char* > : boost::mpl::true_
struct is_range< const char* > : std::integral_constant<bool, true>
{
};
template<>
struct is_range< const wchar_t* > : boost::mpl::true_
struct is_range< const wchar_t* > : std::integral_constant<bool, true>
{
};
template<>
struct is_range< char* const > : boost::mpl::true_
struct is_range< char* const > : std::integral_constant<bool, true>
{
};
template<>
struct is_range< wchar_t* const > : boost::mpl::true_
struct is_range< wchar_t* const > : std::integral_constant<bool, true>
{
};
template<>
struct is_range< const char* const > : boost::mpl::true_
struct is_range< const char* const > : std::integral_constant<bool, true>
{
};
template<>
struct is_range< const wchar_t* const > : boost::mpl::true_
struct is_range< const wchar_t* const > : std::integral_constant<bool, true>
{
};

View File

@@ -18,22 +18,19 @@
#ifndef BOOST_NUMERIC_ODEINT_UTIL_IS_PAIR_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_UTIL_IS_PAIR_HPP_INCLUDED
#include <boost/mpl/bool.hpp>
#include <utility>
#include <type_traits>
namespace boost {
namespace numeric {
namespace odeint {
template< class T >
struct is_pair : public boost::mpl::false_
struct is_pair : public std::integral_constant<bool, false>
{
};
template< class T1 , class T2 >
struct is_pair< std::pair< T1 , T2 > > : public boost::mpl::true_
struct is_pair< std::pair< T1 , T2 > > : public std::integral_constant<bool, true>
{
};