You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use boost library's odeint with std::vector or std::array. I have no issues with compilation in either case, however, I have runtime issues regarding write to unknown address in the case of std::array. Given below is a MWE.
I have defined two classes: ODE1, and ODE2 with std::vector, and std::array respectively in the header file ode.hpp.
And the main function is defined in the file `ode.cpp'
// related header
#include "ode.hpp"
// other library headers
#include <boost/numeric/odeint.hpp>
int main() {
constexpr double abs_err = 1.0e-10;
constexpr double rel_err = 1.0e-8;
constexpr double sim_duration = 20.0; // ms
constexpr double t_start = 0; // ms
constexpr double t_stop = t_start + sim_duration; // ms
constexpr double dt = 5e-3; // ms
{
std::cout << "ODE 1: ";
using namespace boost::numeric::odeint;
using error_stepper_type = runge_kutta_dopri5<std::vector<double>>;
ODE1 o(-60.0);
integrate_adaptive(make_controlled<error_stepper_type>(abs_err, rel_err), o,
o.GetVoltage(), t_start, t_stop, dt);
}
{
std::cout << "ODE 1: ";
using namespace boost::numeric::odeint;
using error_stepper_type =
runge_kutta_dopri5<std::array<double, ode::n_variables>>;
ODE2 o(-60.0);
integrate_adaptive(make_controlled<error_stepper_type>(abs_err, rel_err), o,
o.GetVoltage(), t_start, t_stop, dt);
}
return 0;
}
I am compiling using the clang compiler as follows c++ -O0 -g -fsanitize=address -fno-omit-frame-pointer -Wall -Wextra -Wpedantic -std=c++17 ode.cpp -o ode
Compilation output (warnings)
In file included from ode.cpp:5:
In file included from /usr/local/include/boost/numeric/odeint.hpp:79:
In file included from /usr/local/include/boost/numeric/odeint/stepper/generation.hpp:32:
/usr/local/include/boost/numeric/odeint/stepper/generation/generation_controlled_adams_bashforth_moulton.hpp:43:99: warning: unused parameter 'stepper' [-Wunused-parameter]
controller_type operator()( value_type abs_error , value_type rel_error , const stepper_type &stepper )
^
/usr/local/include/boost/numeric/odeint/stepper/generation/generation_controlled_adams_bashforth_moulton.hpp:49:71: warning: unused parameter 'stepper' [-Wunused-parameter]
time_type max_dt, const stepper_type &stepper )
^
2 warnings generated.
As I mentioned above, I do not run into issues with compilation. When I run the executable, I have the following issues
Strange enough, I do not have issues when I change the parameter, n_sections, in the header from 1800 to 1000. I could not figure out the issue, is this something to with the boost library containers? Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
I am trying to use boost library's odeint with
std::vector
orstd::array
. I have no issues with compilation in either case, however, I have runtime issues regarding write to unknown address in the case ofstd::array
. Given below is a MWE.I have defined two classes:
ODE1
, andODE2
withstd::vector
, andstd::array
respectively in the header fileode.hpp
.And the main function is defined in the file `ode.cpp'
I am compiling using the clang compiler as follows
c++ -O0 -g -fsanitize=address -fno-omit-frame-pointer -Wall -Wextra -Wpedantic -std=c++17 ode.cpp -o ode
Compilation output (warnings)
As I mentioned above, I do not run into issues with compilation. When I run the executable, I have the following issues
Strange enough, I do not have issues when I change the parameter,
n_sections
, in the header from 1800 to 1000. I could not figure out the issue, is this something to with the boost library containers? Any help would be greatly appreciated.The text was updated successfully, but these errors were encountered: