Passing runtime parameters to odeint integrator

点点圈 提交于 2019-12-02 03:45:12

You can pass runtime parameters to the system function defining your ODE:

struct ode
{
    double param;
    ode( double param ) : m_param( param ) {}

    void operator()( state_type const& x , state_type& dxdt , time_type t ) const 
    {
        // your ode
    }
};

integrate_const( stepper {} , ode { 0.1 } , x , t_start , t_end , dt , observer );

I ran into a similar problem. What I did was defined global vars so that my function could access the variable I passed via argvs. Let me know if you need example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!