Passing runtime parameters to odeint integrator

后端 未结 2 647
闹比i
闹比i 2021-01-20 08:39

I would like to use the odeint boost integrator to look at geodesic curves in the Kerr spacetime. This necessitates running an integrator for a variety of parameter values (

2条回答
  •  忘掉有多难
    2021-01-20 08:55

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

提交回复
热议问题