use correct iterator (const) in norm_inf of openmp_range_algebra.
This commit is contained in:
Mario Mulansky 2015-06-14 16:23:54 +02:00
parent e7f25c0a3b
commit 45fd4331c2
2 changed files with 14 additions and 12 deletions

View File

@ -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") );

View File

@ -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] ) );