odeint c++ do_step openmp

197 Views Asked by At

I'm trying to use solve my ode system and use openmp. When I try stepper.do_step with:

typedef runge_kutta_dopri5< state_type , double , state_type , double , openmp_range_algebra > stepper;

I define my state_type as std::vector

And I compile I get:

   error: expected unqualified-id before '.' token stepper.do_step(c , Y , t, dt );

Is it a problem of my typedef or I can't use do_step with openmp?

#include <boost/numeric/odeint.hpp>
#include<omp.h>
#include <boost/numeric/odeint/external/openmp/openmp.hpp>

typedef std::vector< double > state_type;

struct T
 {
   double m_param1;
   double m_param2;
 };

 class sys
 {
   struct T T1;
 public:
   sys(struct T G) : T1(G) {}
   void operator() ( state_type const& Y , state_type& dY , double t )
    {
    const size_t N = Y.size();

    #pragma omp parallel for schedule(runtime)
    for (size_t aux = 0; aux <= N; aux++) {
        mdlfnt(Y,dY,t,T1.m_currents,T1.m_stim); //Here is my ode system
    }
  }
};

struct T T2;

state_type Y(45); // initial conditions

void main()
 {
typedef runge_kutta_dopri5< state_type , double , state_type , double , openmp_range_algebra , default_operations , never_resizer > stepper;


int number_threads = 1;
omp_set_num_threads(number_threads);
int chunk_size = omp_get_max_threads();
omp_set_schedule( omp_sched_static , chunk_size );


for(int i=0;i<nd;i++){
        sys c(T2);
        stepperdo_step(c , Y , t, dt );

     }

  }
0

There are 0 best solutions below