- odeint-v2.zip
- odeint-v2
- boost
- numeric
- doc
- index.html
- Jamroot
- libs
- numeric
- odeint
- code_analyzer
- doc
- concepts.qbk
- concepts
- controlled_stepper.qbk
- dense_output_stepper.qbk
- error_stepper.qbk
- implicit_system.qbk
- observer.qbk
- state_algebra_operations.qbk
- state_wrapper.qbk
- stepper.qbk
- symplectic_system.qbk
- system.qbk
- concepts_old.qbk
- details.qbk
- examples_table.qbk
- extend.qbk
- getting_started.qbk
- html
- boostbook.css
- phase_lattice_2d_0000.jpg
- phase_lattice_2d_0100.jpg
- phase_lattice_2d_1000.jpg
- solar_system.jpg
- Jamfile
- make_controlled_table.qbk
- make_dense_output_table.qbk
- odeint.qbk
- reference.xml
- reference_integrate_functions.qbk
- reference_old.qbk
- reference_steppers.qbk
- stepper_table.qbk
- tutorial.qbk
- tutorial_chaotic_system.qbk
- tutorial_harmonic_oscillator.qbk
- tutorial_solar_system.qbk
- tutorial_special_topics.qbk
- tutorial_stiff_systems.qbk
- tutorial_thrust_cuda.qbk
- examples
- ideas
- performance
- regression_test
- test
- test_external
- README
- tex
- TODO
|
/*
* gsl_rk4_lorenz.cpp
*
* Created on: May 11, 2011
* Author: mario
*/
#include <gsl/gsl_odeiv.h>
#include "rk_performance_test_case.hpp"
#include "lorenz_gsl.hpp"
const size_t dim = 3;
class gsl_wrapper
{
public:
gsl_wrapper()
{
m_s = gsl_odeiv_step_alloc( gsl_odeiv_step_rk4 , dim);
m_sys.function = lorenz_gsl;
m_sys.jacobian = 0;
m_sys.dimension = dim;
m_sys.params = 0;
}
void reset_init_cond()
{
m_x[0] = 10.0 * rand() / RAND_MAX;
m_x[1] = 10.0 * rand() / RAND_MAX;
m_x[2] = 10.0 * rand() / RAND_MAX;
m_t = 0.0;
}
inline void do_step( const double dt )
{
gsl_odeiv_step_apply ( m_s , m_t , dt , m_x , m_x_err , 0 , 0 , &m_sys );
//m_t += dt;
}
double state( const size_t i ) const
{ return m_x[i]; }
~gsl_wrapper()
{
gsl_odeiv_step_free( m_s );
}
private:
double m_x[dim];
double m_x_err[dim];
double m_t;
gsl_odeiv_step *m_s;
gsl_odeiv_system m_sys;
};
int main()
{
gsl_wrapper stepper;
run( stepper , 20000000 / 3 , 1E-10 * 3);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.