factory functions added

This commit is contained in:
Karsten Ahnert 2011-09-26 09:21:28 +02:00
parent b6a544677b
commit df371c5859
12 changed files with 574 additions and 0 deletions

View File

@ -62,5 +62,7 @@
#include <boost/numeric/odeint/integrate/observer_collection.hpp>
#include <boost/numeric/odeint/stepper/generation.hpp>
#endif // BOOST_NUMERIC_ODEINT_HPP_INCLUDED

View File

@ -0,0 +1,36 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation.hpp
[begin_description]
Forward header for the factory functions. Includes all files from the generation directory.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp>
#include <boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp>
#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp>
#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp>
#include <boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp>
#include <boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp>
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_HPP_INCLUDED

View File

@ -0,0 +1,53 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp
[begin_description]
Specialization of the controller factory for the controlled_runge_kutta class.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
namespace boost {
namespace numeric {
namespace odeint {
// controller factory for controlled_runge_kutta
template< class Stepper >
struct controller_factory< Stepper , controlled_runge_kutta< Stepper > >
{
typedef Stepper stepper_type;
typedef controlled_runge_kutta< stepper_type > controller_type;
typedef typename controller_type::error_checker_type error_checker_type;
typedef typename stepper_type::value_type value_type;
controller_type operator()( const value_type &abs_error , const value_type &rel_error , const stepper_type &stepper )
{
return controller_type( error_checker_type( abs_error , rel_error ) , stepper );
}
};
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED

View File

@ -0,0 +1,54 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp
[begin_description]
Specialization of the controller factory for the dense_output_runge_kutta class.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp>
namespace boost {
namespace numeric {
namespace odeint {
// controller factory for controlled_runge_kutta
template< class Stepper >
struct dense_output_factory< Stepper , dense_output_runge_kutta< controlled_runge_kutta< Stepper > > >
{
typedef Stepper stepper_type;
typedef controlled_runge_kutta< stepper_type > controller_type;
typedef typename controller_type::error_checker_type error_checker_type;
typedef typename stepper_type::value_type value_type;
typedef dense_output_runge_kutta< controller_type > dense_output_type;
dense_output_type operator()( const value_type &abs_error , const value_type &rel_error , const stepper_type &stepper )
{
return dense_output_type( controller_type( error_checker_type( abs_error , rel_error ) , stepper ) );
}
};
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED

View File

@ -0,0 +1,72 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp
[begin_description]
Enable the factory functions for the controller and the dense output of the Rosenbrock4 method.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/rosenbrock4.hpp>
#include <boost/numeric/odeint/stepper/rosenbrock4_controller.hpp>
#include <boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp>
namespace boost {
namespace numeric {
namespace odeint {
template< class Value , class Coefficients , class Resize >
struct get_controller< rosenbrock4< Value , Coefficients , Resize > >
{
typedef rosenbrock4< Value , Coefficients , Resize > stepper_type;
typedef rosenbrock4_controller< stepper_type > type;
};
template< class Value , class Coefficients , class Resize >
struct get_dense_output< rosenbrock4< Value , Coefficients , Resize > >
{
typedef rosenbrock4< Value , Coefficients , Resize > stepper_type;
typedef rosenbrock4_controller< stepper_type > controller_type;
typedef rosenbrock4_dense_output< controller_type > type;
};
// controller factory for controlled_runge_kutta
template< class Stepper >
struct dense_output_factory< Stepper , rosenbrock4_dense_output< rosenbrock4_controller< Stepper > > >
{
typedef Stepper stepper_type;
typedef rosenbrock4_controller< stepper_type > controller_type;
typedef typename stepper_type::value_type value_type;
typedef rosenbrock4_dense_output< controller_type > dense_output_type;
dense_output_type operator()( const value_type &abs_error , const value_type &rel_error , const stepper_type &stepper )
{
return dense_output_type( controller_type( abs_error , rel_error , stepper ) );
}
};
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_ROSENBROCK4_HPP_INCLUDED

View File

@ -0,0 +1,47 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp
[begin_description]
Enable the factory functions for the controller and the dense output of the Runge-Kutta-Cash-Karp 54 method.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp>
#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
namespace boost {
namespace numeric {
namespace odeint {
// Specializations for runge_kutta_cash_karp54
template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
struct get_controller< runge_kutta_cash_karp54< State , Value , Deriv , Time , Algebra , Operations , Resize > >
{
typedef runge_kutta_cash_karp54< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
typedef controlled_runge_kutta< stepper_type > type;
};
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_HPP_INCLUDED

View File

@ -0,0 +1,48 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp
[begin_description]
Enable the factory functions for the controller and the dense output of the
Runge-Kutta-Cash-Karp 54 method with the classical implementation.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp>
#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
namespace boost {
namespace numeric {
namespace odeint {
// Specializations for runge_kutta_cash_karp54
template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
struct get_controller< runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resize > >
{
typedef runge_kutta_cash_karp54_classic< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
typedef controlled_runge_kutta< stepper_type > type;
};
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_CASH_KARP54_CLASSIC_HPP_INCLUDED

View File

@ -0,0 +1,56 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp
[begin_description]
Enable the factory functions for the controller and the dense output of the Runge-Kutta-Dormand-Prince5 method.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
#include <boost/numeric/odeint/stepper/generation/make_dense_output.hpp>
namespace boost {
namespace numeric {
namespace odeint {
template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
struct get_controller< runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > >
{
typedef runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
typedef controlled_runge_kutta< stepper_type > type;
};
template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
struct get_dense_output< runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > >
{
typedef runge_kutta_dopri5< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
typedef controlled_runge_kutta< stepper_type > controller_type;
typedef dense_output_runge_kutta< controller_type > type;
};
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_DOPRI5_HPP_INCLUDED

View File

@ -0,0 +1,46 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp
[begin_description]
Enable the factory functions for the controller and the dense output of the Runge-Kutta-Fehlberg 78 method.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
#include <boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp>
#include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
namespace boost {
namespace numeric {
namespace odeint {
template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resize >
struct get_controller< runge_kutta_fehlberg78< State , Value , Deriv , Time , Algebra , Operations , Resize > >
{
typedef runge_kutta_fehlberg78< State , Value , Deriv , Time , Algebra , Operations , Resize > stepper_type;
typedef controlled_runge_kutta< stepper_type > type;
};
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_GENERATION_RUNGE_KUTTA_FEHLBERG78_HPP_INCLUDED

View File

@ -0,0 +1,81 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/make_controlled.hpp
[begin_description]
Factory function to simplify the creation of controlled steppers from error steppers.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED
namespace boost {
namespace numeric {
namespace odeint {
// default template for the controller
template< class Stepper > struct get_controller { };
// default controller factory
template< class Stepper , class Controller >
struct controller_factory
{
Controller operator()(
const typename Stepper::value_type &abs_error ,
const typename Stepper::value_type &rel_error ,
const Stepper &stepper )
{
return Controller( abs_error , rel_error , stepper );
}
};
namespace result_of
{
template< class Stepper >
struct make_controlled
{
typedef typename get_controller< Stepper >::type type;
};
}
template< class Stepper >
typename result_of::make_controlled< Stepper >::type make_controlled(
const typename Stepper::value_type abs_error ,
const typename Stepper::value_type rel_error ,
const Stepper & stepper = Stepper() )
{
typedef Stepper stepper_type;
typedef typename result_of::make_controlled< stepper_type >::type controller_type;
typedef controller_factory< stepper_type , controller_type > factory_type;
factory_type factory;
return factory( abs_error , rel_error , stepper );
}
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_CONTROLLED_HPP_INCLUDED

View File

@ -0,0 +1,78 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/generation/make_dense_output.hpp
[begin_description]
Factory function to simplify the creation of dense output steppers from error steppers.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-2011 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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED
namespace boost {
namespace numeric {
namespace odeint {
// default template for the dense output
template< class Stepper > struct get_dense_output { };
// default dense output factory
template< class Stepper , class DenseOutput >
struct dense_output_factory
{
DenseOutput operator()(
const typename Stepper::value_type &abs_error ,
const typename Stepper::value_type &rel_error ,
const Stepper &stepper )
{
return DenseOutput( abs_error , rel_error , stepper );
}
};
namespace result_of
{
template< class Stepper >
struct make_dense_output
{
typedef typename get_dense_output< Stepper >::type type;
};
}
template< class Stepper >
typename result_of::make_dense_output< Stepper >::type make_dense_output(
const typename Stepper::value_type abs_error ,
const typename Stepper::value_type rel_error ,
const Stepper &stepper = Stepper() )
{
typedef Stepper stepper_type;
typedef typename result_of::make_dense_output< stepper_type >::type dense_output_type;
typedef dense_output_factory< stepper_type , dense_output_type > factory_type;
factory_type factory;
return factory( abs_error , rel_error , stepper );
}
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_GENERATION_MAKE_DENSE_OUTPUT_HPP_INCLUDED

View File

@ -40,5 +40,6 @@ test-suite "odeint"
[ run integrate_times.cpp ]
[ run integrate.cpp ]
[ run integrate_implicit.cpp ]
[ run generation.cpp ]
: <testing.launcher>valgrind
;