mirror of
https://github.com/boostorg/odeint.git
synced 2025-05-09 23:24:01 +00:00
Merge branch 'master' of https://github.com/headmyshoulder/odeint-v2 into develop
This commit is contained in:
commit
fbd9ed0010
39
.travis.yml
39
.travis.yml
@ -1,14 +1,25 @@
|
||||
sudo: false
|
||||
language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
- linux
|
||||
- osx
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
- gcc
|
||||
- clang
|
||||
install:
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.8
|
||||
- g++-4.8
|
||||
- clang
|
||||
|
||||
env:
|
||||
- CXXSTD=''
|
||||
- CXXSTD='cxxflags="-std=c++0x"'
|
||||
- CXXSTD=""
|
||||
- CXXSTD="cxxflags='-std=c++0x'"
|
||||
|
||||
# For now disable gcc on osx as g++4.8 is not yet available
|
||||
matrix:
|
||||
@ -17,11 +28,14 @@ matrix:
|
||||
compiler: gcc
|
||||
|
||||
before_install:
|
||||
- wget http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.bz2/download -O /tmp/boost.tar.bz2
|
||||
# 1.55: http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.bz2/download
|
||||
# 1.57: http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.bz2/download
|
||||
# 1.58: http://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.bz2\?r\=\&ts\=1435589970\&use_mirror\=garr
|
||||
- wget http://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.bz2\?r\=\&ts\=1435589970\&use_mirror\=garr -O /tmp/boost.tar.bz2
|
||||
- tar jxf /tmp/boost.tar.bz2
|
||||
- mv boost_1_55_0 $PWD/boost-trunk
|
||||
# patch the boost build system
|
||||
- patch $PWD/boost-trunk/tools/build/v2/build/toolset.jam toolset.jam.patch
|
||||
- mv boost_1_58_0 $PWD/boost-trunk
|
||||
# patch the boost build system - not neccessary with 1.58 anymore
|
||||
# - patch $PWD/boost-trunk/tools/build/v2/build/toolset.jam toolset.jam.patch
|
||||
- export BOOST_ROOT="$PWD/boost-trunk"
|
||||
|
||||
- cd $BOOST_ROOT
|
||||
@ -31,7 +45,4 @@ before_install:
|
||||
- $CC --version
|
||||
|
||||
script:
|
||||
- $BOOST_ROOT/b2 toolset=$CC $CXXSTD
|
||||
# build in c++11 mode only with gcc
|
||||
# - if [ "$CXX" = "g++" ]; then $BOOST_ROOT/b2 -a toolset=$CC$GCCVER cxxflags="-std=c++0x"; fi
|
||||
|
||||
- $BOOST_ROOT/b2 toolset=$CC $CXXSTD
|
1
README
1
README
@ -1 +0,0 @@
|
||||
odeint is a highly flexible library for solving ordinary differential equations.
|
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
||||
odeint is a highly flexible library for solving ordinary differential equations.
|
@ -1,8 +1,8 @@
|
||||
[/============================================================================
|
||||
Boost.odeint
|
||||
|
||||
Copyright 2011-2012 Karsten Ahnert
|
||||
Copyright 2011-2012 Mario Mulansky
|
||||
Copyright 2011-2015 Karsten Ahnert
|
||||
Copyright 2011-2015 Mario Mulansky
|
||||
Copyright 2012 Sylwester Arabas
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software License,
|
||||
@ -21,7 +21,8 @@
|
||||
[[Fehlberg 78] [`runge_kutta_fehlberg78`] [__error_stepper] [__system] [8] [Yes (7)] [No] [No] [Good high order method with error estimation, to be used in controlled_error_stepper.]]
|
||||
|
||||
[[Adams Bashforth] [`adams_bashforth`] [__stepper] [__system] [configurable] [No] [No] [Yes] [Multistep method]]
|
||||
[[Adams Moulton] [`adams_moulton`] [__stepper] [__system] [configurable] [No] [No] [Yes] [Multistep method]]
|
||||
[/ # removed as it is not an independent algorithm.
|
||||
[[Adams Moulton] [`adams_moulton`] [__stepper] [__system] [configurable] [No] [No] [Yes] [Multistep method]] \]
|
||||
[[Adams Bashforth Moulton] [`adams_bashforth_moulton`] [__stepper] [__system] [configurable] [No] [No] [Yes] [Combined multistep method]]
|
||||
|
||||
[[Controlled Runge-Kutta] [`controlled_runge_kutta`] [__controlled_stepper] [__system] [depends] [Yes] [No] [depends] [Error control for __error_stepper. Requires an __error_stepper from above. Order depends on the given ErrorStepper]]
|
||||
|
@ -134,7 +134,7 @@ Depending on the MPI implementation the code might need to be compiled with i.e.
|
||||
Instead of reading another thread's data, we asynchronously send and receive the
|
||||
relevant data from neighbouring nodes, performing some computation in the interim
|
||||
to hide the latency.
|
||||
[phase_chain_rhs]
|
||||
[phase_chain_mpi_rhs]
|
||||
|
||||
Analogous to `openmp_state<T>` we use `mpi_state< InnerState<T> >`, which
|
||||
automatically selects `mpi_nested_algebra` and the appropriate MPI-oblivious
|
||||
|
5
examples/gmpxx/Makefile
Normal file
5
examples/gmpxx/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
CXXFLAGS = -I${BOOST_ROOT} -O2 -static
|
||||
LDFLAGS = -lgmpxx -lgmp
|
||||
|
||||
lorenz_gmpxx: lorenz_gmpxx.cpp
|
||||
${CXX} ${CXXFLAGS} lorenz_gmpxx.cpp ${LDFLAGS} -o lorenz_gmpxx
|
@ -57,19 +57,21 @@ int main() {
|
||||
|
||||
state_type X(n, point_type(10, 10, 10));
|
||||
|
||||
typedef runge_kutta4<
|
||||
state_type, double,
|
||||
state_type, double,
|
||||
openmp_range_algebra
|
||||
> stepper;
|
||||
|
||||
const double t_max = 10.0, dt = 0.01;
|
||||
|
||||
integrate_const(
|
||||
stepper(),
|
||||
sys_func(R), X,
|
||||
0.0, t_max, dt
|
||||
);
|
||||
// Simple stepper with constant step size
|
||||
// typedef runge_kutta4<state_type, double, state_type, double,
|
||||
// openmp_range_algebra> stepper;
|
||||
|
||||
// integrate_const(stepper(), sys_func(R), X, 0.0, t_max, dt);
|
||||
|
||||
// Controlled stepper with variable step size
|
||||
typedef runge_kutta_fehlberg78<state_type, double, state_type, double,
|
||||
openmp_range_algebra> error_stepper_type;
|
||||
typedef controlled_runge_kutta<error_stepper_type> controlled_stepper_type;
|
||||
controlled_stepper_type controlled_stepper;
|
||||
|
||||
integrate_adaptive(controlled_stepper, sys_func(R), X, 0.0, t_max, dt);
|
||||
|
||||
copy( X.begin(), X.end(), ostream_iterator<point_type>(cout, "\n") );
|
||||
|
||||
|
@ -259,7 +259,7 @@ BOOST_ODEINT_GEN_FOR_EACH(BOOST_ODEINT_GEN_BODY)
|
||||
typedef typename norm_result_type< S >::type result_type;
|
||||
result_type init = static_cast< result_type >( 0 );
|
||||
const size_t len = boost::size(s);
|
||||
typename boost::range_iterator<S>::type beg = boost::begin(s);
|
||||
typename boost::range_iterator<const S>::type beg = boost::begin(s);
|
||||
# pragma omp parallel for reduction(max: init) schedule(dynamic)
|
||||
for( size_t i = 0 ; i < len ; ++i )
|
||||
init = max( init , abs( beg[i] ) );
|
||||
|
@ -98,7 +98,7 @@ size_t integrate_adaptive(
|
||||
}
|
||||
|
||||
size_t trials = 0;
|
||||
controlled_step_result res = success;
|
||||
controlled_step_result res;
|
||||
do
|
||||
{
|
||||
res = st.try_step( system , start_state , start_time , dt );
|
||||
|
@ -130,7 +130,9 @@ size_t integrate_times(
|
||||
if( start_time == end_time )
|
||||
return 0;
|
||||
|
||||
Time last_time_point = static_cast<time_type>(*(end_time-1));
|
||||
TimeIterator last_time_iterator = end_time;
|
||||
--last_time_iterator;
|
||||
Time last_time_point = static_cast<time_type>(*last_time_iterator);
|
||||
|
||||
st.initialize( start_state , *start_time , dt );
|
||||
obs( start_state , *start_time++ );
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
m_table( m_k_max ) ,
|
||||
m_mp_states( m_k_max+1 ) ,
|
||||
m_derivs( m_k_max+1 ) ,
|
||||
m_diffs( 2*m_k_max+1 ) ,
|
||||
m_diffs( 2*m_k_max+2 ) ,
|
||||
STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 )
|
||||
{
|
||||
BOOST_USING_STD_MIN();
|
||||
@ -139,7 +139,7 @@ public:
|
||||
*/
|
||||
}
|
||||
int num = 1;
|
||||
for( int i = 2*(m_k_max) ; i >=0 ; i-- )
|
||||
for( int i = 2*(m_k_max)+1 ; i >=0 ; i-- )
|
||||
{
|
||||
m_diffs[i].resize( num );
|
||||
num += (i+1)%2;
|
||||
@ -587,7 +587,7 @@ private:
|
||||
for( size_t i = 0 ; i < m_k_max+1 ; ++i )
|
||||
for( size_t j = 0 ; j < m_derivs[i].size() ; ++j )
|
||||
resized |= adjust_size_by_resizeability( m_derivs[i][j] , x , typename is_resizeable<deriv_type>::type() );
|
||||
for( size_t i = 0 ; i < 2*m_k_max+1 ; ++i )
|
||||
for( size_t i = 0 ; i < 2*m_k_max+2 ; ++i )
|
||||
for( size_t j = 0 ; j < m_diffs[i].size() ; ++j )
|
||||
resized |= adjust_size_by_resizeability( m_diffs[i][j] , x , typename is_resizeable<deriv_type>::type() );
|
||||
|
||||
|
@ -47,9 +47,9 @@ 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();
|
||||
return t1-t2 <= std::numeric_limits<T>::epsilon();
|
||||
else
|
||||
return t2-t1 < std::numeric_limits<T>::epsilon();
|
||||
return t2-t1 <= std::numeric_limits<T>::epsilon();
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
|
@ -25,5 +25,6 @@ test-suite "odeint"
|
||||
:
|
||||
[ run regression_147.cpp ]
|
||||
[ compile regression_149.cpp : <cxxflags>-std=c++0x ]
|
||||
[ run regression_168.cpp ]
|
||||
: <testing.launcher>valgrind
|
||||
;
|
||||
|
90
test/regression/regression_168.cpp
Normal file
90
test/regression/regression_168.cpp
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
|
||||
[begin_description]
|
||||
Test case for issue 149:
|
||||
Error C2582 with msvc-10 when using iterator-based integration
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2015 Karsten Ahnert
|
||||
Copyright 2011-2015 Mario Mulansky
|
||||
|
||||
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)
|
||||
*/
|
||||
|
||||
|
||||
// disable checked iterator warning for msvc
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#define BOOST_TEST_MODULE odeint_regression_147
|
||||
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/range/algorithm/find_if.hpp>
|
||||
|
||||
#include <boost/numeric/odeint.hpp>
|
||||
#include <boost/numeric/odeint/algebra/fusion_algebra.hpp>
|
||||
#include <boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp>
|
||||
|
||||
|
||||
#include <boost/units/systems/si/length.hpp>
|
||||
#include <boost/units/systems/si/time.hpp>
|
||||
#include <boost/units/systems/si/velocity.hpp>
|
||||
#include <boost/units/systems/si/acceleration.hpp>
|
||||
#include <boost/units/systems/si/io.hpp>
|
||||
|
||||
#include <boost/fusion/container.hpp>
|
||||
|
||||
|
||||
using namespace boost::unit_test;
|
||||
using namespace boost::numeric::odeint;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace units = boost::units;
|
||||
namespace si = boost::units::si;
|
||||
|
||||
typedef units::quantity< si::time , double > time_type;
|
||||
typedef units::quantity< si::length , double > length_type;
|
||||
typedef units::quantity< si::velocity , double > velocity_type;
|
||||
typedef units::quantity< si::acceleration , double > acceleration_type;
|
||||
typedef units::quantity< si::frequency , double > frequency_type;
|
||||
|
||||
typedef fusion::vector< length_type , velocity_type > state_type;
|
||||
typedef fusion::vector< velocity_type , acceleration_type > deriv_type;
|
||||
|
||||
|
||||
struct oscillator
|
||||
{
|
||||
frequency_type m_omega;
|
||||
|
||||
oscillator( const frequency_type &omega = 1.0 * si::hertz ) : m_omega( omega ) { }
|
||||
|
||||
void operator()( const state_type &x , deriv_type &dxdt , time_type t ) const
|
||||
{
|
||||
fusion::at_c< 0 >( dxdt ) = fusion::at_c< 1 >( x );
|
||||
fusion::at_c< 1 >( dxdt ) = - m_omega * m_omega * fusion::at_c< 0 >( x );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( regression_168 )
|
||||
{
|
||||
typedef runge_kutta_dopri5< state_type , double , deriv_type , time_type > stepper_type;
|
||||
|
||||
state_type x( 1.0 * si::meter , 0.0 * si::meter_per_second );
|
||||
|
||||
integrate_const( make_dense_output( 1.0e-6 , 1.0e-6 , stepper_type() ) , oscillator( 2.0 * si::hertz ) ,
|
||||
x , 0.0 * si::second , 100.0 * si::second , 0.1 * si::second);
|
||||
}
|
@ -7,10 +7,11 @@
|
||||
import testing ;
|
||||
import boost ;
|
||||
|
||||
boost.use-project ;
|
||||
# boost.use-project ;
|
||||
use-project boost : $(BOOST_ROOT) ;
|
||||
|
||||
# set your MTL4 directory here
|
||||
MTL4_INCLUDE = /home/mario/MTL4 ;
|
||||
MTL4_INCLUDE = /home/mario/MTL4/usr/include ;
|
||||
|
||||
project
|
||||
: requirements
|
||||
@ -25,6 +26,5 @@ project
|
||||
test-suite "odeint-mtl4"
|
||||
:
|
||||
[ run mtl4_resize.cpp ]
|
||||
[ run lorenz.cpp ]
|
||||
: <testing.launcher>valgrind
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user