1[/============================================================================ 2 Boost.odeint 3 4 Copyright 2012 Karsten Ahnert 5 Copyright 2012 Mario Mulansky 6 Copyright 2012 Sylwester Arabas 7 8 Use, modification and distribution is subject to the Boost Software License, 9 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 10 http://www.boost.org/LICENSE_1_0.txt) 11=============================================================================/] 12 13[section Generation functions] 14 15[import ../examples/generation_functions.cpp] 16 17In the __tutorial we have learned how we can use the generation functions `make_controlled` and `make_dense_output` to create controlled and dense output stepper from a simple stepper or an error stepper. The syntax of these two functions is very simple: 18 19[generation_functions_syntax_auto] 20 21The first two parameters are the absolute and the relative error tolerances and the third parameter is the stepper. Additionally, a second version exists where additionally a maximal step size is supplied which ensures the the step size is not increased above this value. 22 In C++03 you can infer the type from the `result_of` mechanism: 23 24[generation_functions_syntax_result_of] 25 26To use your own steppers with the `make_controlled` or `make_dense_output` you need to specialize two class templates. Suppose your steppers are called `custom_stepper`, `custom_controller` and `custom_dense_output`. Then, the first class you need to specialize is `boost::numeric::get_controller`, a meta function returning the type of the controller: 27 28[generation_functions_get_controller] 29 30The second one is a factory class `boost::numeric::odeint::controller_factory` which constructs the controller from the tolerances and the stepper. In our dummy implementation this class is 31 32[generation_functions_controller_factory] 33 34This is all to use the `make_controlled` mechanism. Now you can use your controller via 35 36[generation_functions_example_custom_controller] 37 38For the dense_output_stepper everything works similar. Here you have to specialize `boost::numeric::odeint::get_dense_output` and `boost::numeric::odeint::dense_output_factory`. These two classes have the same syntax as their relatives `get_controller` and `controller_factory`. 39 40All controllers and dense-output steppers in odeint can be used with these mechanisms. In the table below you will find, which steppers is constructed from `make_controlled` or `make_dense_output` if applied on a stepper from odeint: 41 42[include make_controlled_table.qbk] 43[include make_dense_output_table.qbk] 44 45[endsect] 46