mirror of
https://github.com/boostorg/odeint.git
synced 2025-05-11 05:24:01 +00:00
fix #166
use correct iterator (const) in norm_inf of openmp_range_algebra.
This commit is contained in:
parent
e7f25c0a3b
commit
45fd4331c2
@ -57,19 +57,21 @@ int main() {
|
|||||||
|
|
||||||
state_type X(n, point_type(10, 10, 10));
|
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;
|
const double t_max = 10.0, dt = 0.01;
|
||||||
|
|
||||||
integrate_const(
|
// Simple stepper with constant step size
|
||||||
stepper(),
|
// typedef runge_kutta4<state_type, double, state_type, double,
|
||||||
sys_func(R), X,
|
// openmp_range_algebra> stepper;
|
||||||
0.0, t_max, dt
|
|
||||||
);
|
// 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") );
|
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;
|
typedef typename norm_result_type< S >::type result_type;
|
||||||
result_type init = static_cast< result_type >( 0 );
|
result_type init = static_cast< result_type >( 0 );
|
||||||
const size_t len = boost::size(s);
|
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)
|
# pragma omp parallel for reduction(max: init) schedule(dynamic)
|
||||||
for( size_t i = 0 ; i < len ; ++i )
|
for( size_t i = 0 ; i < len ; ++i )
|
||||||
init = max( init , abs( beg[i] ) );
|
init = max( init , abs( beg[i] ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user