headmyshoulder / odeint-v2

odeint - solving ordinary differential equations in c++ v2
http://headmyshoulder.github.com/odeint-v2/
Other
337 stars 102 forks source link

Error with boost::numeric::odeint::make_contolled for a custom error stepper #239

Open SamyuktaV opened 5 years ago

SamyuktaV commented 5 years ago

Hello, I am trying to do a comparison between implicit and explicit solvers for stiff system as part of my PhD. I wanted to use a runge-kutta-fehlberg45 stepper for the comparison. I used the template from runge_kutta_fehlberg78 to build a custom stepper by changing the number and values of the parameters of the Butchers Tableau. (I am coding in C++) This stepper works just fine when I have the problem set up with boost::numeric::ublas::vector< double >. However when I change the problem from type 'double' to type 'complex< double >', I get an error.

The system I am using has the following specifications:

I get the following error: In file included from /usr/local/include/boost/numeric/odeint/stepper/generation.hpp:21, from /usr/local/include/boost/numeric/odeint.hpp:76, from main.cpp:1: /usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp: In instantiation of ‘struct boost::numeric::odeint::result_of::make_controlled<my_runge_kutta_fehlberg45<boost::numeric::ublas::vector<std::complex > > >’: /usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:71:54: required by substitution of ‘template typename boost::numeric::odeint::result_of::make_controlled::type boost::numeric::odeint::make_controlled(typename Stepper::value_type, typename Stepper::value_type, const Stepper&) [with Stepper = my_runge_kutta_fehlberg45<boost::numeric::ublas::vector<std::complex > >]’ main.cpp:715:88: required from here /usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:65:58: error: no type named ‘type’ in ‘struct boost::numeric::odeint::get_controller<my_runge_kutta_fehlberg45<boost::numeric::ublas::vector<std::complex > > >’ typedef typename get_controller< Stepper >::type type; ^~~~ main.cpp: In function ‘int main()’: main.cpp:715:88: error: no matching function for call to ‘make_controlled(double, double, error_stepper_type_expI)’ nos = integrate_adaptive( make_controlled( a_err , r_err , error_stepper_type_expI() ), phys(gamma), p, 0.0, tau, dt); ^ In file included from /usr/local/include/boost/numeric/odeint/stepper/generation.hpp:21, from /usr/local/include/boost/numeric/odeint.hpp:76, from my_rk4.hpp:11, from main.cpp:1: /usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:71:54: note: candidate: ‘template typename boost::numeric::odeint::result_of::make_controlled::type boost::numeric::odeint::make_controlled(typename Stepper::value_type, typename Stepper::value_type, const Stepper&)’ typename result_of::make_controlled< Stepper >::type make_controlled( ^~~~~~~ /usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:71:54: note: substitution of deduced template arguments resulted in errors seen above /usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:85:54: note: candidate: ‘template typename boost::numeric::odeint::result_of::make_controlled::type boost::numeric::odeint::make_controlled(typename Stepper::value_type, typename Stepper::value_type, typename Stepper::time_type, const Stepper&)’ typename result_of::make_controlled< Stepper >::type make_controlled( ^~~~~~~ /usr/local/include/boost/numeric/odeint/stepper/generation/make_controlled.hpp:85:54: note: template argument deduction/substitution failed: main.cpp:715:88: note: couldn't deduce template parameter ‘Stepper’ nos = integrate_adaptive( make_controlled( a_err , r_err , error_stepper_type_expI() ), phys(gamma), p, 0.0, tau, dt); ^ make: [: main.o] Error 1

I am not able to figure out what is causing the problem as I have only changed the data type for the input parameters. The problem seems to be coming from the namespace result_of{} function in make_contolled. I would really appreciate any assistance for this error.

Thanks in advance and looking forward to your comments. Samyukta