mirror of
https://github.com/boostorg/odeint.git
synced 2025-05-11 21:44:03 +00:00
Merge branch 'develop' of github.com:boostorg/odeint into develop
This commit is contained in:
commit
2bbc186b43
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "doc"]
|
|
||||||
path = doc
|
|
||||||
url = git@github.com:headmyshoulder/odeint-v2.git
|
|
@ -141,8 +141,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct transform_functor : public std::unary_function< size_t , size_t >
|
struct transform_functor
|
||||||
{
|
{
|
||||||
|
typedef size_t argument_type;
|
||||||
|
typedef size_t result_type;
|
||||||
hash_vector const* m_index;
|
hash_vector const* m_index;
|
||||||
transform_functor( hash_vector const& index ) : m_index( &index ) { }
|
transform_functor( hash_vector const& index ) : m_index( &index ) { }
|
||||||
size_t operator()( size_t i ) const { return (*m_index)[i]; }
|
size_t operator()( size_t i ) const { return (*m_index)[i]; }
|
||||||
|
@ -30,7 +30,7 @@ namespace odeint {
|
|||||||
/*
|
/*
|
||||||
* This class template has to be overload in order to call vector_space_algebra::norm_inf
|
* This class template has to be overload in order to call vector_space_algebra::norm_inf
|
||||||
*/
|
*/
|
||||||
template< class State > struct vector_space_norm_inf;
|
template< class State, class Enabler = void > struct vector_space_norm_inf;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Example: instantiation for sole doubles and complex
|
* Example: instantiation for sole doubles and complex
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
if( m_steps++ >= m_max_steps )
|
if( m_steps++ >= m_max_steps )
|
||||||
{
|
{
|
||||||
char error_msg[200];
|
char error_msg[200];
|
||||||
sprintf(error_msg, "Max number of iterations exceeded (%d).", m_max_steps);
|
std::sprintf(error_msg, "Max number of iterations exceeded (%d).", m_max_steps);
|
||||||
BOOST_THROW_EXCEPTION( no_progress_error(error_msg) );
|
BOOST_THROW_EXCEPTION( no_progress_error(error_msg) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ public:
|
|||||||
if( m_steps++ >= m_max_steps )
|
if( m_steps++ >= m_max_steps )
|
||||||
{
|
{
|
||||||
char error_msg[200];
|
char error_msg[200];
|
||||||
sprintf(error_msg, "Max number of iterations exceeded (%d). A new step size was not found.", m_max_steps);
|
std::sprintf(error_msg, "Max number of iterations exceeded (%d). A new step size was not found.", m_max_steps);
|
||||||
BOOST_THROW_EXCEPTION( step_adjustment_error(error_msg) );
|
BOOST_THROW_EXCEPTION( step_adjustment_error(error_msg) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,4 +111,4 @@ public:
|
|||||||
} // namespace numeric
|
} // namespace numeric
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include <boost/numeric/ublas/vector.hpp>
|
#include <boost/numeric/ublas/vector.hpp>
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
using namespace boost::unit_test;
|
using namespace boost::unit_test;
|
||||||
using namespace boost::numeric::odeint;
|
using namespace boost::numeric::odeint;
|
||||||
namespace mpl = boost::mpl;
|
namespace mpl = boost::mpl;
|
||||||
|
@ -24,7 +24,7 @@ project
|
|||||||
test-suite "odeint"
|
test-suite "odeint"
|
||||||
:
|
:
|
||||||
[ run regression_147.cpp ]
|
[ run regression_147.cpp ]
|
||||||
[ compile regression_149.cpp : <cxxflags>-std=c++0x ]
|
[ compile regression_149.cpp ]
|
||||||
[ run regression_168.cpp ]
|
[ run regression_168.cpp ]
|
||||||
[ run regression_189.cpp ]
|
[ run regression_189.cpp ]
|
||||||
: <testing.launcher>valgrind
|
: <testing.launcher>valgrind
|
||||||
|
@ -52,11 +52,20 @@ struct perform_test
|
|||||||
bulirsch_stoer< state_type > stepper( 1e-9, 0.0, 0.0, 0.0 );
|
bulirsch_stoer< state_type > stepper( 1e-9, 0.0, 0.0, 0.0 );
|
||||||
state_type x( 3, 10.0 );
|
state_type x( 3, 10.0 );
|
||||||
|
|
||||||
auto iter = boost::find_if(
|
print( boost::find_if(
|
||||||
make_adaptive_time_range( stepper, rhs, x, 0.0, 1.0, 0.01 ),
|
make_adaptive_time_range( stepper, rhs, x, 0.0, 1.0, 0.01 ),
|
||||||
[]( const std::pair< const state_type &, double > &x )
|
pred ) );
|
||||||
{ return ( x.first[0] < 0.0 ); } );
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool pred( const std::pair< const state_type &, double > &x )
|
||||||
|
{
|
||||||
|
return ( x.first[0] < 0.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Iterator>
|
||||||
|
void print( Iterator iter )
|
||||||
|
{
|
||||||
std::cout << iter->second << "\t" << iter->first[0] << "\t"
|
std::cout << iter->second << "\t" << iter->first[0] << "\t"
|
||||||
<< iter->first[1] << "\t" << iter->first[2] << "\n";
|
<< iter->first[1] << "\t" << iter->first[2] << "\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user